Commit a28e785a authored by Michal Hocko's avatar Michal Hocko Committed by Rafael J. Wysocki

PM: convert do_each_thread to for_each_process_thread

as per 0c740d0a (introduce for_each_thread() to replace the buggy
while_each_thread()) get rid of do_each_thread { } while_each_thread()
construct and replace it by a more error prone for_each_thread.

This patch doesn't introduce any user visible change.
Suggested-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarMichal Hocko <mhocko@suse.cz>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 5695be14
...@@ -46,13 +46,13 @@ static int try_to_freeze_tasks(bool user_only) ...@@ -46,13 +46,13 @@ static int try_to_freeze_tasks(bool user_only)
while (true) { while (true) {
todo = 0; todo = 0;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_each_thread(g, p) { for_each_process_thread(g, p) {
if (p == current || !freeze_task(p)) if (p == current || !freeze_task(p))
continue; continue;
if (!freezer_should_skip(p)) if (!freezer_should_skip(p))
todo++; todo++;
} while_each_thread(g, p); }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
if (!user_only) { if (!user_only) {
...@@ -93,11 +93,11 @@ static int try_to_freeze_tasks(bool user_only) ...@@ -93,11 +93,11 @@ static int try_to_freeze_tasks(bool user_only)
if (!wakeup) { if (!wakeup) {
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_each_thread(g, p) { for_each_process_thread(g, p) {
if (p != current && !freezer_should_skip(p) if (p != current && !freezer_should_skip(p)
&& freezing(p) && !frozen(p)) && freezing(p) && !frozen(p))
sched_show_task(p); sched_show_task(p);
} while_each_thread(g, p); }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
} }
} else { } else {
...@@ -229,11 +229,11 @@ void thaw_processes(void) ...@@ -229,11 +229,11 @@ void thaw_processes(void)
thaw_workqueues(); thaw_workqueues();
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_each_thread(g, p) { for_each_process_thread(g, p) {
/* No other threads should have PF_SUSPEND_TASK set */ /* No other threads should have PF_SUSPEND_TASK set */
WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK)); WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK));
__thaw_task(p); __thaw_task(p);
} while_each_thread(g, p); }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
WARN_ON(!(curr->flags & PF_SUSPEND_TASK)); WARN_ON(!(curr->flags & PF_SUSPEND_TASK));
...@@ -256,10 +256,10 @@ void thaw_kernel_threads(void) ...@@ -256,10 +256,10 @@ void thaw_kernel_threads(void)
thaw_workqueues(); thaw_workqueues();
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_each_thread(g, p) { for_each_process_thread(g, p) {
if (p->flags & (PF_KTHREAD | PF_WQ_WORKER)) if (p->flags & (PF_KTHREAD | PF_WQ_WORKER))
__thaw_task(p); __thaw_task(p);
} while_each_thread(g, p); }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
schedule(); schedule();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment