online, possible and disabled cpus
Srivatsa Bhat
bhat.srivatsa at gmail.com
Tue Oct 23 03:09:00 EDT 2012
Hi,
On Tue, Oct 23, 2012 at 3:03 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
> On Mon, 22 Oct 2012, Srivatsa Bhat wrote:
>
>> Hi,
>>
>> You might want to take a look at Documentation/cpu-hotplug.txt for
>> some details regarding online/possible CPUs...
>
> i'll do one more post on this, even though i never imagined it was
> going to get this complicated. to recap, what i'm trying to
> understand is this output from dmesg:
>
...
> and at that point, i think i'm just going to let it go. but that
> still brings me back to my original question regarding the code for
> /proc/softirqs in fs/proc/softirqs.c -- why iterate through all
> *possible* CPUs when some of them will clearly be disabled and not
> represent actual CPUs?
>
I don't think we should worry too much about this.. I can think of a simple
reason why one would want to iterate through all possible CPUs.. :
IIUC, this function prints, for each softirq, the number of times it ran on a
particular CPU. So if a CPU was online for a while and then was taken offline,
in order to print the softirq stats properly (including how many times it ran on
that CPU when it was online), we will have to iterate through all
possible CPUs..
That is a simple and valid reason, IMHO.
Regards,
Srivatsa S. Bhat
> static int show_softirqs(struct seq_file *p, void *v)
> {
> int i, j;
>
> seq_puts(p, " ");
> for_each_possible_cpu(i)
> seq_printf(p, "CPU%-8d", i);
> seq_putc(p, '\n');
>
> for (i = 0; i < NR_SOFTIRQS; i++) {
> seq_printf(p, "%12s:", softirq_to_name[i]);
> for_each_possible_cpu(j)
> seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
> seq_putc(p, '\n');
> }
> return 0;
> }
>
> anyway, i think i've flogged this enough.
>
More information about the Kernelnewbies
mailing list