smp_processor_id()/cpu_[number/logical]_map()
include/asm/smp.h smp_processor_id() returns the current
processor number, between 0 and NR_CPUS (the
maximum number of CPUs supported by Linux, currently 32). These
values are not necessarily continuous: to get a number between 0
and smp_num_cpus() (the number of actual
processors in this machine), the
cpu_number_map() function is used to map the
processor id to a logical number.
cpu_logical_map() does the reverse.