https://elixir.bootlin.com/linux/latest/source/arch/arm/kernel/process.c#L40 example: #if defined ( CONFIG_CURRENT_POINTER_IN_TPIDRURO ) || defined ( CONFIG_SMP ) DEFINE_PER_CPU ( struct task_struct * , __entry_task ); #endif
Spin lock It's a spinning (polling) lock which is running and try to take a lock in a tight loop and checking again and again if lock is got freed up or not and once it free it will immediately take it up . Basically spin lock divided in to 4 Parts : 1. Preempt Disable : 1st operation spinlock will disable other Hardware interrupts so that what ever context is got scheduled will not preempt 2. Spin_lock_acquire : It will generate a lock context for further tracking in lock dep 3. do_spin_try_lock : Spinning in a loop (do -while) to take the lock and spin till not get the lock free. 4. do_spin_lock : Take the lock After taking the lock it use to put a memory barrier to make sure memory will not be overwritten mistakenly Spin unlock use to unlock the spin lock . Divided in to 3 parts. 1. Spin_release : Mark in lock context for lock dep that we are going to release the lock for this particular lock context 2....