Skip to content

Commit a28e785

Browse files
Michal Hockorafaeljw
authored andcommitted
PM: convert do_each_thread to for_each_process_thread
as per 0c740d0 (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: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Michal Hocko <mhocko@suse.cz> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5695be1 commit a28e785

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎kernel/power/process.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ static int try_to_freeze_tasks(bool user_only)
4646
while (true) {
4747
todo = 0;
4848
read_lock(&tasklist_lock);
49-
do_each_thread(g, p) {
49+
for_each_process_thread(g, p) {
5050
if (p == current || !freeze_task(p))
5151
continue;
5252

5353
if (!freezer_should_skip(p))
5454
todo++;
55-
} while_each_thread(g, p);
55+
}
5656
read_unlock(&tasklist_lock);
5757

5858
if (!user_only) {
@@ -93,11 +93,11 @@ static int try_to_freeze_tasks(bool user_only)
9393

9494
if (!wakeup) {
9595
read_lock(&tasklist_lock);
96-
do_each_thread(g, p) {
96+
for_each_process_thread(g, p) {
9797
if (p != current && !freezer_should_skip(p)
9898
&& freezing(p) && !frozen(p))
9999
sched_show_task(p);
100-
} while_each_thread(g, p);
100+
}
101101
read_unlock(&tasklist_lock);
102102
}
103103
} else {
@@ -229,11 +229,11 @@ void thaw_processes(void)
229229
thaw_workqueues();
230230

231231
read_lock(&tasklist_lock);
232-
do_each_thread(g, p) {
232+
for_each_process_thread(g, p) {
233233
/* No other threads should have PF_SUSPEND_TASK set */
234234
WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK));
235235
__thaw_task(p);
236-
} while_each_thread(g, p);
236+
}
237237
read_unlock(&tasklist_lock);
238238

239239
WARN_ON(!(curr->flags & PF_SUSPEND_TASK));
@@ -256,10 +256,10 @@ void thaw_kernel_threads(void)
256256
thaw_workqueues();
257257

258258
read_lock(&tasklist_lock);
259-
do_each_thread(g, p) {
259+
for_each_process_thread(g, p) {
260260
if (p->flags & (PF_KTHREAD | PF_WQ_WORKER))
261261
__thaw_task(p);
262-
} while_each_thread(g, p);
262+
}
263263
read_unlock(&tasklist_lock);
264264

265265
schedule();

0 commit comments

Comments
 (0)