Skip to content

Commit 22cf8bc

Browse files
shligittorvalds
authored andcommitted
kernel/kthread.c: kthread_worker: don't hog the cpu
If the worker thread continues getting work, it will hog the cpu and rcu stall complains. Make it a good citizen. This is triggered in a loop block device test. Link: http://lkml.kernel.org/r/5de0a179b3184e1a2183fc503448b0269f24d75b.1503697127.git.shli@fb.com Signed-off-by: Shaohua Li <shli@fb.com> Cc: Petr Mladek <pmladek@suse.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tejun Heo <tj@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e746bf7 commit 22cf8bc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎kernel/kthread.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ int kthread_worker_fn(void *worker_ptr)
637637
schedule();
638638

639639
try_to_freeze();
640+
cond_resched();
640641
goto repeat;
641642
}
642643
EXPORT_SYMBOL_GPL(kthread_worker_fn);

0 commit comments

Comments
 (0)