Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernel/hung_task.c: change hung_task.c to use for_each_process_thread()

In check_hung_uninterruptible_tasks() avoid the use of deprecated
while_each_thread().

The "max_count" logic will prevent a livelock - see commit 0c740d0a
("introduce for_each_thread() to replace the buggy while_each_thread()").
Having said this let's use for_each_process_thread().

Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Dave Wysochanski <dwysocha@redhat.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Aaron Tomlin and committed by
Linus Torvalds
972fae69 96831c0a

+2 -2
+2 -2
kernel/hung_task.c
··· 169 169 return; 170 170 171 171 rcu_read_lock(); 172 - do_each_thread(g, t) { 172 + for_each_process_thread(g, t) { 173 173 if (!max_count--) 174 174 goto unlock; 175 175 if (!--batch_count) { ··· 180 180 /* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */ 181 181 if (t->state == TASK_UNINTERRUPTIBLE) 182 182 check_hung_task(t, timeout); 183 - } while_each_thread(g, t); 183 + } 184 184 unlock: 185 185 rcu_read_unlock(); 186 186 }