Re: [PATCH v2] fs-writeback: writeback_sb_inodes:Recalculate 'wrote' according skipped pages

From: Peter Zijlstra
Date: Tue Apr 19 2022 - 04:18:14 EST


On Mon, Apr 18, 2022 at 12:43:43PM -0700, Linus Torvalds wrote:
> Which all brings us back to how we have that hacky thing in
> writeback_sb_inodes() that does
>
> if (need_resched()) {
> /*
> * We're trying to balance between building up a nice
> * long list of IOs to improve our merge rate, and
> * getting those IOs out quickly for anyone throttling
> * in balance_dirty_pages(). cond_resched() doesn't
> * unplug, so get our IOs out the door before we
> * give up the CPU.
> */
> blk_flush_plug(current->plug, false);
> cond_resched();
> }

Yeah, that's horribly broken for PREEMPT=y.