summaryrefslogtreecommitdiffstats
path: root/kernel/kthread.c
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-08-31 16:15:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-31 16:33:15 -0700
commit22cf8bc6cb0d48c6d31da8eccbd4201ab9b0c4c6 (patch)
treed6378366b52388c6e473af901cb82be7903bd577 /kernel/kthread.c
parente746bf730a76fe53b82c9e6b6da72d58e9ae3565 (diff)
downloadtalos-op-linux-22cf8bc6cb0d48c6d31da8eccbd4201ab9b0c4c6.tar.gz
talos-op-linux-22cf8bc6cb0d48c6d31da8eccbd4201ab9b0c4c6.zip
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>
Diffstat (limited to 'kernel/kthread.c')
-rw-r--r--kernel/kthread.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 26db528c1d88..1c19edf82427 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -637,6 +637,7 @@ repeat:
schedule();
try_to_freeze();
+ cond_resched();
goto repeat;
}
EXPORT_SYMBOL_GPL(kthread_worker_fn);
OpenPOWER on IntegriCloud