--- linux-2.6.38-rc2-vs2.3.0.37-rc4/fs/proc/stat.c 2011-02-01 21:55:05.000000000 +0100 +++ linux-2.6.38-rc2-vs2.3.0.37/fs/proc/stat.c 2011-02-01 21:34:39.000000000 +0100 @@ -9,6 +9,7 @@ #include #include #include +#include #include #ifndef arch_irq_stat_cpu @@ -31,6 +32,7 @@ static int show_stat(struct seq_file *p, u64 sum_softirq = 0; unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; struct timespec boottime; + struct cpumask mask; user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; @@ -38,7 +40,12 @@ static int show_stat(struct seq_file *p, getboottime(&boottime); jif = boottime.tv_sec; + cpuset_cpus_allowed(current, &mask); + for_each_possible_cpu(i) { + if (!cpumask_test_cpu(i, &mask)) + continue; + user = cputime64_add(user, kstat_cpu(i).cpustat.user); nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); system = cputime64_add(system, kstat_cpu(i).cpustat.system); @@ -76,6 +83,8 @@ static int show_stat(struct seq_file *p, (unsigned long long)cputime64_to_clock_t(guest), (unsigned long long)cputime64_to_clock_t(guest_nice)); for_each_online_cpu(i) { + if (!cpumask_test_cpu(i, &mask)) + continue; /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ user = kstat_cpu(i).cpustat.user;