diff options
author | Jiri Slaby <jslaby@suse.cz> | 2015-05-06 15:54:04 +0200 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-05-06 16:00:47 +0200 |
commit | 05a7deb1d1143bafe0f6f88042ec4231699f9fd6 (patch) | |
tree | f9c19e8990d1bcc1d4878c4cc460457fd5c987a6 | |
parent | 73127cbb661d770c3323f6b48bc8768654aa675f (diff) | |
download | kgraft-05a7deb1d1143bafe0f6f88042ec4231699f9fd6.tar.gz |
kgr: use for_each_process_thread
for_each_process walks only through group leaders. Iterate over all
tasks in the system using for_each_process_thread.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Oleg Nesterov <oleg@redhat.com>
-rw-r--r-- | kernel/kgraft.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/kernel/kgraft.c b/kernel/kgraft.c index ebab5925e4fa9a..639ee05b0403e0 100644 --- a/kernel/kgraft.c +++ b/kernel/kgraft.c @@ -143,16 +143,17 @@ static int kgr_ftrace_disable(struct kgr_patch_fun *pf, struct ftrace_ops *fops) static bool kgr_still_patching(void) { - struct task_struct *p; + struct task_struct *p, *t; bool failed = false; read_lock(&tasklist_lock); - for_each_process(p) { - if (kgr_task_in_progress(p)) { + for_each_process_thread(p, t) { + if (kgr_task_in_progress(t)) { failed = true; - break; + goto unlock; } } +unlock: read_unlock(&tasklist_lock); return failed; } @@ -293,28 +294,28 @@ static void kgr_work_fn(struct work_struct *work) void kgr_unmark_processes(void) { - struct task_struct *p; + struct task_struct *p, *t; read_lock(&tasklist_lock); - for_each_process(p) - kgr_task_safe(p); + for_each_process_thread(p, t) + kgr_task_safe(t); read_unlock(&tasklist_lock); } static void kgr_handle_processes(void) { - struct task_struct *p; + struct task_struct *p, *t; read_lock(&tasklist_lock); - for_each_process(p) { - kgr_mark_task_in_progress(p); + for_each_process_thread(p, t) { + kgr_mark_task_in_progress(t); /* wake up kthreads, they will clean the progress flag */ - if (p->flags & PF_KTHREAD) { + if (t->flags & PF_KTHREAD) { /* * this is incorrect for kthreads waiting still for * their first wake_up. */ - wake_up_process(p); + wake_up_process(t); } } read_unlock(&tasklist_lock); |