On Tue, Feb 22, 2011 at 3:20 PM, Dave Hylands <[email protected]> wrote:
> Hi Subin, > > On Tue, Feb 22, 2011 at 4:00 PM, subin gangadharan > <[email protected]> wrote: > > Hi All, > > I am trying to understand how to use mutex API's properly,so while going > > through the documentation, > > there is section mentioning fast path and slow path for mutexes. > > For your reference I am pasting this here.(kernel/mutex.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 __used noinline void __sched > > __mutex_lock_slowpath(atomic_t *lock_count); > > > > Can someone help me to understand what is the difference between fastpath > > lock and slowpath lock? > > The fastpath is taken when nobody else is holding the lock (so the > caller acquires the mutex without blocking). > > The slowpath is taken when somebody else is holding the lock and the > caller needs to block (i.e. sleep) until the mutex is released. > > Thanks David. Could you give a bit more idea on the "How this reduce the register pressure on fast path" > Dave Hyland > -- With Regards Subin Gangadharan Everything should be made as simple as possible,but not simpler.
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
