Re: percpu data for non-existant cpus

From: Matthew Wilcox <willy_at_debian.org>
Date: 2003-11-05 10:04:28
On Tue, Nov 04, 2003 at 10:43:49AM +0900, Takayoshi Kochi wrote:
> --- linux-2.6.0-test6.orig/arch/ia64/mm/tlb.c	Sun Sep 28 09:50:38 2003
> +++ linux-2.6.0-test6/arch/ia64/mm/tlb.c	Wed Oct  8 17:58:42 2003
> @@ -77,7 +77,7 @@
>  	{
>  		int cpu = get_cpu(); /* prevent preemption/migration */
>  		for (i = 0; i < NR_CPUS; ++i)
> -			if (i != cpu)
> +			if (cpu_online(i) && (i != cpu))
>  				per_cpu(ia64_need_tlb_flush, i) = 1;
>  		put_cpu();
>  	}

Surely this should rather be...

	{
		int cpu = get_cpu(); /* prevent preemption/migration */
-		for (i = 0; i < NR_CPUS; ++i)
+		for_each_cpu(i, cpu_online_map)
			if (i != cpu)
				per_cpu(ia64_need_tlb_flush, i) = 1;
		put_cpu();

I suppose one could create a new cpu_map based on cpu_online_map &~ cpu
but that feels rather more heavyweight than a test inside a loop.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Nov 4 18:04:43 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:20 EST