[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What is meant by fastpath and slowpath function in linux kernel?



Hi All,
 
What is the major difference between and mutex and semaphore. till this time I though mutext is binary semaphore. While going through the linux code thier is seperate generic mutext subsystem in avaliable in linux kernel.
 
while going through the kernel/mutext.h and kernel/mutex.c their are two specific keyword "fastpath" and "slowpath" functions. What is meant by it.
 
per ex: following comments I coppied from kernel/mutext.c
 
/*
 * We split the mutex lock/unlock logic into separate fastpath and
 * slowpath functions, to reduce the register pressure on the fastpath.
 * We also put the fastpath first in the kernel image, to make sure the
 * branch is predicted by the CPU as default-untaken.
 */
static void fastcall noinline __sched
__mutex_lock_slowpath(atomic_t *lock_count __IP_DECL__);
 
 
 
Thanks
Manjunath