From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Some doubts on MUTEX
Date: Tue, 22 Feb 2011 16:20:05 -0700 [thread overview]
Message-ID: <AANLkTinWnLHEw_isvCONeTsT4uiUsBgwT4z7boT2c0-5@mail.gmail.com> (raw)
In-Reply-To: <AANLkTindsRmVXGM7z-Sd6o6mMi3GQNw33YkCo6TJLu=2@mail.gmail.com>
Hi Subin,
On Tue, Feb 22, 2011 at 4:00 PM, subin gangadharan
<subingangadharan@gmail.com> 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.
Dave Hylands
next prev parent reply other threads:[~2011-02-22 23:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 23:00 Some doubts on MUTEX subin gangadharan
2011-02-22 23:20 ` Dave Hylands [this message]
2011-02-23 3:58 ` subin gangadharan
2011-02-23 8:04 ` Dave Hylands
2011-02-23 15:03 ` subin gangadharan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTinWnLHEw_isvCONeTsT4uiUsBgwT4z7boT2c0-5@mail.gmail.com \
--to=dhylands@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).