6.9. smp_processor_id() 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.