Skip to content

Commit

Permalink
kernel/kthread.c: kthread_worker: don't hog the cpu
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
shligit authored and torvalds committed Aug 31, 2017
1 parent e746bf7 commit 22cf8bc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ int kthread_worker_fn(void *worker_ptr)
schedule();

try_to_freeze();
cond_resched();
goto repeat;
}
EXPORT_SYMBOL_GPL(kthread_worker_fn);
Expand Down

0 comments on commit 22cf8bc

Please sign in to comment.