Re: [PATCH v2 2/3] md: add cond_resched() to md_do_sync()'s skip path

"yu kuai" <[email protected]>
Newsgroups org.kernel.vger.linux-raid,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
在 2026/7/23 21:55, Yunye Zhao 写道:

> When sync_request() reports a skipped region (*skipped == 1),
> md_do_sync()'s main loop advances the cursor and takes an early
> continue:
>
> 	j += sectors;
> 	...
> 	if (last_check + window > io_sectors || j == max_sectors)
> 		continue;
>
> If the personality returns a small span per call (raid10 recovery
> returns only 128 sectors), syncing a large, mostly clean array iterates
> this branch an enormous number of times without ever yielding the CPU.
> On a non-preemptive kernel the resync thread then trips the soft-lockup
> watchdog:
>
>    watchdog: BUG: soft lockup - CPU#149 stuck for 313s! [mdX_resync]
>     md_bitmap_start_sync+0x6f/0xe0
>     raid10_sync_request+0x2c9/0x1530 [raid10]
>     md_do_sync+0x810/0x1030
>     md_thread+0xa7/0x150
>
> Add a cond_resched().  This does not reduce the wasted iterations; the
> excessive iteration count is a raid10 problem addressed separately.
>
> Cc:[email protected]
> Signed-off-by: Yunye Zhao<[email protected]>

Remove the cc stable as there is no fixtag.

> ---
>   drivers/md/md.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
Applied to md-7.3

-- 
Thanks,
Kuai
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.