From f8e3cb124dca859ea6e68860d1195ddfb0aee576 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Date: Mon, 25 Aug 2014 13:13:51 +0800
Subject: [PATCH 23/23] x86_64: modify runq only to display online cpus' data

runq [-t/-m/-g/-d] is used to display data on run queues of each cpu.
This patch is used to skip offline cpus' run queues.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
---
 task.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/task.c b/task.c
index 192cef0..676beec 100755
--- a/task.c
+++ b/task.c
@@ -7551,6 +7551,9 @@ dump_on_rq_timestamp(void)
 		option_not_supported('t');
 
 	for (cpu = 0; cpu < kt->cpus; cpu++) {
+		if (check_offline_cpu(cpu))
+			continue;
+
 		if ((kt->flags & SMP) && (kt->flags &PER_CPU_OFF))
 			runq = rq_sp->value + kt->__per_cpu_offset[cpu];
 		else
@@ -7619,6 +7622,9 @@ dump_on_rq_milliseconds(void)
 	max_days = days = 0;
 
 	for (cpu = 0; cpu < kt->cpus; cpu++) {
+		if (check_offline_cpu(cpu))
+			continue;
+
 		if ((kt->flags & SMP) && (kt->flags &PER_CPU_OFF))
 			runq = rq_sp->value + kt->__per_cpu_offset[cpu];
 		else
@@ -7762,6 +7768,9 @@ dump_runqueues(void)
         runqbuf = GETBUF(SIZE(runqueue));
 
 	for (cpu = 0; cpu < kt->cpus; cpu++, runq += SIZE(runqueue)) {
+		if (check_offline_cpu(cpu))
+			continue;
+
 		if (rq_sp) {
 			if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF))
 				runq = rq_sp->value + kt->__per_cpu_offset[cpu];
@@ -8224,6 +8233,8 @@ dump_on_rq_tasks(void)
 	}
 
 	for (cpu = 0; cpu < kt->cpus; cpu++) {
+		if (check_offline_cpu(cpu))
+			continue;
 
                 fprintf(fp, "%sCPU %d\n", cpu ? "\n" : "", cpu);
 
@@ -8353,6 +8364,9 @@ dump_CFS_runqueues(void)
 	get_active_set();
 
         for (cpu = 0; cpu < kt->cpus; cpu++) {
+		if (check_offline_cpu(cpu))
+			continue;
+
 		if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF))
 			runq = rq_sp->value + kt->__per_cpu_offset[cpu];
 		else
@@ -8847,6 +8861,9 @@ dump_tasks_by_task_group(void)
 	get_active_set();
 
 	for (cpu = 0; cpu < kt->cpus; cpu++) {
+		if (check_offline_cpu(cpu))
+			continue;
+
 		readmem(rt_rq + cpu * sizeof(ulong), KVADDR, &rt_rq_p,
 			sizeof(ulong), "task_group rt_rq", FAULT_ON_ERROR);
 		readmem(cfs_rq + cpu * sizeof(ulong), KVADDR, &cfs_rq_p,
-- 
1.8.5.3

