Commit fa09ca5e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'block-5.16-2021-12-17' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

 - Fix for hammering on the delayed run queue timer (me)

 - bcache regression fix for this merge window (Lin)

 - Fix a divide-by-zero in the blk-iocost code (Tejun)

* tag 'block-5.16-2021-12-17' of git://git.kernel.dk/linux-block:
  bcache: fix NULL pointer reference in cached_dev_detach_finish
  block: reduce kblockd_mod_delayed_work_on() CPU consumption
  iocost: Fix divide-by-zero on donation from low hweight cgroup
parents cb29eee3 aa97f6cd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1484,6 +1484,8 @@ EXPORT_SYMBOL(kblockd_schedule_work);
int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork,
				unsigned long delay)
{
	if (!delay)
		return queue_work_on(cpu, kblockd_workqueue, &dwork->work);
	return mod_delayed_work_on(cpu, kblockd_workqueue, dwork, delay);
}
EXPORT_SYMBOL(kblockd_mod_delayed_work_on);
+8 −1
Original line number Diff line number Diff line
@@ -2311,7 +2311,14 @@ static void ioc_timer_fn(struct timer_list *timer)
			hwm = current_hweight_max(iocg);
			new_hwi = hweight_after_donation(iocg, old_hwi, hwm,
							 usage, &now);
			if (new_hwi < hwm) {
			/*
			 * Donation calculation assumes hweight_after_donation
			 * to be positive, a condition that a donor w/ hwa < 2
			 * can't meet. Don't bother with donation if hwa is
			 * below 2. It's not gonna make a meaningful difference
			 * anyway.
			 */
			if (new_hwi < hwm && hwa >= 2) {
				iocg->hweight_donating = hwa;
				iocg->hweight_after_donation = new_hwi;
				list_add(&iocg->surplus_list, &surpluses);
+2 −1
Original line number Diff line number Diff line
@@ -1139,6 +1139,7 @@ static void cancel_writeback_rate_update_dwork(struct cached_dev *dc)
static void cached_dev_detach_finish(struct work_struct *w)
{
	struct cached_dev *dc = container_of(w, struct cached_dev, detach);
	struct cache_set *c = dc->disk.c;

	BUG_ON(!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags));
	BUG_ON(refcount_read(&dc->count));
@@ -1156,7 +1157,7 @@ static void cached_dev_detach_finish(struct work_struct *w)

	bcache_device_detach(&dc->disk);
	list_move(&dc->list, &uncached_devices);
	calc_cached_dev_sectors(dc->disk.c);
	calc_cached_dev_sectors(c);

	clear_bit(BCACHE_DEV_DETACHING, &dc->disk.flags);
	clear_bit(BCACHE_DEV_UNLINK_DONE, &dc->disk.flags);