`smp_processor_id`() `include/asm/smp.h`
Prev | Chapter 6. Common Routines | Next

## `smp_processor_id`() `include/asm/smp.h`

`get_cpu()` disables preemption (so you won't suddenly get moved to another CPU) and returns the current processor number, between 0 and NR_CPUS. Note that the CPU numbers are not necessarily continuous. You return it again with `put_cpu()` when you are done.

If you know you cannot be preempted by another task (ie. you are in interrupt context, or have preemption disabled) you can use smp_processor_id().

Prev | Up | Next
`local_bh_disable()`/`local_bh_enable()` `include/linux/interrupt.h` | Home | __init/__exit/__initdata `include/linux/init.h`