Re: [PATCH] Correct nr_processes() when CPUs have been unplugged

From: Linus Torvalds
Date: Tue Nov 03 2009 - 10:52:20 EST




On Tue, 3 Nov 2009, Ian Campbell wrote:
>
> Therefore calculating the sum of process_counts over only the online
> CPUs omits the processes which were started or stopped on any CPU which
> has since been unplugged. Only the sum of process_counts across all
> possible CPUs has meaning.

I think your patch is fine, but I also suspect that we could/should
instead fix it by doing something like

per_cpu(process_counts, this_cpu) += per_cpu(process_counts, down_cpu);
per_cpu(process_counts, down_cpu) = 0;

in the CPU off-lining case after having quieted 'down_cpu'. That way we
could always use online CPU's rather than possible CPU's. I think that
just sounds nicer.

So I'll apply the patch, but I get the feeling it could be done better.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/