'Is there any way to print list of runnable tasks on the per cpu runqueue, without using for_each_process_thread()
Note: cat /proc/sched_debug //It prints percpu runque list
source path: kernel/sched/debug.c There is a way which available in Linux kernel to print runque task list as below:
static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
{
struct task_struct *g, *p;
SEQ_printf(m, "\n");
SEQ_printf(m, "runnable tasks:\n");
SEQ_printf(m, " S task PID tree-key switches prio"
" wait-time sum-exec sum-sleep\n");
SEQ_printf(m, "-------------------------------------------------------"
"------------------------------------------------------\n");
rcu_read_lock();
for_each_process_thread(g, p) {
if (task_cpu(p) != rq_cpu)
continue;
print_task(m, rq, p);
}
rcu_read_unlock();
}
But, to print each runqueue task list it unnecessary traversing all the task's in the system and checking is this task on required cpu(rq_cpu). So, is there a way by which we can print runque task list, I know as each cpu runqueue has multiple sub runqueue's(cfs_rq,rt_rq,dl_rq) which all are not in doubly linked list fashion, some are mapped using rb-tree fashion. Can someone give provide any inputs or other ways by which we can display per cpu task list??
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|