Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1720431

[PATCH] kthread_worker: don't hog the cpu

From Shaohua Li <shli@fb.com>
Newsgroups linux.kernel
Subject [PATCH] kthread_worker: don't hog the cpu
Date 2017-08-25 23:50 +0200
Message-ID <uiuEh-UN-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 kernel/kthread.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 26db528..1c19edf 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -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);
-- 
2.9.5

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] kthread_worker: don't hog the cpu Shaohua Li <shli@fb.com> - 2017-08-25 23:50 +0200

csiph-web