Re: [PATCH][RFC] oprofile for 2.5.39

Andrew Morton (akpm@digeo.com)
Sat, 28 Sep 2002 20:47:06 -0700


Andi Kleen wrote:
>
> smp_processor_id

Using smp_processor_id() is usually a bug.

Please default to using get_cpu()/put_cpu().

- It pins the caller onto that CPU if the kernel is preemptive.

- You may not sleep inside get_cpu/put_cpu.

- If you do something which might sleep inside get_cpu/put_cpu,
you get might_sleep() warnings.

Probably, smp_processor_id() needs to be renamed to something
which is hard to type.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/