Re: [patch] fix smp_processor_id() use in include/asm-generic/percpu.h

From: Nathan Lynch
Date: Fri Dec 23 2005 - 20:11:34 EST


Suresh Kodati wrote:
> This patch suppresses the following BUG() seen during bootup of 2.6.15-rc5-mm3 on i386 machines by replacing smp_processor_id with raw_smp_processor_id().
>
> <snip>
> [ 11.258828] Freeing unused kernel memory: 260k freed
> [ 11.258864] BUG: using smp_processor_id() in preemptible [00000001] code: swapper/1
> [ 11.258878] caller is mod_page_state_offset+0x12/0x28
> </snip>
>
> Signed-off-by: Suresh Kodati <kodatisu@xxxxxxxxxx>
> --
>
> include/asm-generic/percpu.h | 2 +-
> 1 files changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-2.6.15-rc5/include/asm-generic/percpu.h.orig 2005-12-21 15:13:27.000000000 -0600
> +++ linux-2.6.15-rc5/include/asm-generic/percpu.h 2005-12-21 15:13:43.000000000 -0600
> @@ -13,7 +13,7 @@ extern unsigned long __per_cpu_offset[NR
>
> /* var is in discarded region: offset to particular copy we want */
> #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
> -#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
> +#define __get_cpu_var(var) per_cpu(var, raw_smp_processor_id())

Surely this isn't the right way to address the warning you are seeing?

This change would keep us from catching preempt-unsafe uses of per-cpu
data.


Nathan
-
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/