Commit ece4ceaf authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Daniel Thompson

kdb: Use newer api for tasklist scanning

This kills using the do_each_thread/while_each_thread combo to
iterate all threads and uses for_each_process_thread() instead,
maintaining semantics. while_each_thread() is ultimately racy
and deprecated;  although in this particular case there is no
concurrency so it doesn't matter. Still lets trivially get rid
of two more users.
Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Link: https://lore.kernel.org/r/20200907203206.21293-1-dave@stgolabs.netSigned-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
parent b18b099e
...@@ -725,7 +725,7 @@ static void gdb_cmd_query(struct kgdb_state *ks) ...@@ -725,7 +725,7 @@ static void gdb_cmd_query(struct kgdb_state *ks)
} }
} }
do_each_thread(g, p) { for_each_process_thread(g, p) {
if (i >= ks->thr_query && !finished) { if (i >= ks->thr_query && !finished) {
int_to_threadref(thref, p->pid); int_to_threadref(thref, p->pid);
ptr = pack_threadid(ptr, thref); ptr = pack_threadid(ptr, thref);
...@@ -735,7 +735,7 @@ static void gdb_cmd_query(struct kgdb_state *ks) ...@@ -735,7 +735,7 @@ static void gdb_cmd_query(struct kgdb_state *ks)
finished = 1; finished = 1;
} }
i++; i++;
} while_each_thread(g, p); }
*(--ptr) = '\0'; *(--ptr) = '\0';
break; break;
......
...@@ -149,14 +149,14 @@ kdb_bt(int argc, const char **argv) ...@@ -149,14 +149,14 @@ kdb_bt(int argc, const char **argv)
return 0; return 0;
} }
/* Now the inactive tasks */ /* Now the inactive tasks */
kdb_do_each_thread(g, p) { for_each_process_thread(g, p) {
if (KDB_FLAG(CMD_INTERRUPT)) if (KDB_FLAG(CMD_INTERRUPT))
return 0; return 0;
if (task_curr(p)) if (task_curr(p))
continue; continue;
if (kdb_bt1(p, mask, btaprompt)) if (kdb_bt1(p, mask, btaprompt))
return 0; return 0;
} kdb_while_each_thread(g, p); }
} else if (strcmp(argv[0], "btp") == 0) { } else if (strcmp(argv[0], "btp") == 0) {
struct task_struct *p; struct task_struct *p;
unsigned long pid; unsigned long pid;
......
...@@ -2299,10 +2299,10 @@ void kdb_ps_suppressed(void) ...@@ -2299,10 +2299,10 @@ void kdb_ps_suppressed(void)
if (kdb_task_state(p, mask_I)) if (kdb_task_state(p, mask_I))
++idle; ++idle;
} }
kdb_do_each_thread(g, p) { for_each_process_thread(g, p) {
if (kdb_task_state(p, mask_M)) if (kdb_task_state(p, mask_M))
++daemon; ++daemon;
} kdb_while_each_thread(g, p); }
if (idle || daemon) { if (idle || daemon) {
if (idle) if (idle)
kdb_printf("%d idle process%s (state I)%s\n", kdb_printf("%d idle process%s (state I)%s\n",
...@@ -2370,12 +2370,12 @@ static int kdb_ps(int argc, const char **argv) ...@@ -2370,12 +2370,12 @@ static int kdb_ps(int argc, const char **argv)
} }
kdb_printf("\n"); kdb_printf("\n");
/* Now the real tasks */ /* Now the real tasks */
kdb_do_each_thread(g, p) { for_each_process_thread(g, p) {
if (KDB_FLAG(CMD_INTERRUPT)) if (KDB_FLAG(CMD_INTERRUPT))
return 0; return 0;
if (kdb_task_state(p, mask)) if (kdb_task_state(p, mask))
kdb_ps1(p); kdb_ps1(p);
} kdb_while_each_thread(g, p); }
return 0; return 0;
} }
......
...@@ -230,10 +230,6 @@ extern struct task_struct *kdb_curr_task(int); ...@@ -230,10 +230,6 @@ extern struct task_struct *kdb_curr_task(int);
#define kdb_task_has_cpu(p) (task_curr(p)) #define kdb_task_has_cpu(p) (task_curr(p))
/* Simplify coexistence with NPTL */
#define kdb_do_each_thread(g, p) do_each_thread(g, p)
#define kdb_while_each_thread(g, p) while_each_thread(g, p)
#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) #define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
extern void *debug_kmalloc(size_t size, gfp_t flags); extern void *debug_kmalloc(size_t size, gfp_t flags);
......
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