From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 2/2] mutex: use spin_[un]lock instead of arch_spin_[un]lock
Date: Thu, 24 Jan 2013 18:27:47 +0800 [thread overview]
Message-ID: <20130124102747.GF12678@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <20130124101450.GA27602@gmail.com>
On Thu, Jan 24, 2013 at 11:14:50AM +0100, Ingo Molnar wrote:
>
> * Yuanhan Liu <yuanhan.liu@linux.intel.com> wrote:
>
> > On Thu, Jan 24, 2013 at 10:58:07AM +0100, Ingo Molnar wrote:
> > >
> > > * Yuanhan Liu <yuanhan.liu@linux.intel.com> wrote:
> > >
> > > > Use spin_[un]lock instead of arch_spin_[un]lock in mutex-debug.h so
> > > > that we can collect the lock statistics of spin_lock_mutex from
> > > > /proc/lock_stat.
> > > >
> > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> > > > ---
> > > > kernel/mutex-debug.h | 4 ++--
> > > > 1 files changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/kernel/mutex-debug.h b/kernel/mutex-debug.h
> > > > index 0799fd3..556c0bc 100644
> > > > --- a/kernel/mutex-debug.h
> > > > +++ b/kernel/mutex-debug.h
> > > > @@ -43,13 +43,13 @@ static inline void mutex_clear_owner(struct mutex *lock)
> > > > \
> > > > DEBUG_LOCKS_WARN_ON(in_interrupt()); \
> > > > local_irq_save(flags); \
> > > > - arch_spin_lock(&(lock)->rlock.raw_lock);\
> > > > + spin_lock(lock); \
> > >
> > > But in that case it could probably use the spin_lock_irqsave()
> > > primitive, right?
> >
> > Right, in that case I should use spin_lock_irqsave.
> >
> > But one question, why we use spin_lock at kernel/mutex.h,
> > while use 'local_irq_save(); arch_spin_lock' at
> > kernel/mutex-debug.h?
> >
> > Shouldn't we keep it consistent? Say use spin_lock_irqsave?
>
> I think we did it to increase performance with lockdep enabled -
> this particular lockdep annotation, given the short codepaths,
> is not that hard to verify - and if it breaks it will break a
> thousand mutex locking places in the kernel.
Thanks for the explanation.
>
> So maybe it's better to leave it alone - maybe add a comment
> that explains the reason.
Sorry, I may not get your point clearly. Should I make another patch to
convert 'local_irq_save(..); arch_spin_lock(..);' at kernel/mutex-debug.h
to spin_lock_irqsave() then?
Thanks.
--yliu
next prev parent reply other threads:[~2013-01-24 10:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 9:22 [PATCH 1/2] lockstat: fix a typo Yuanhan Liu
2013-01-24 9:22 ` [PATCH 2/2] mutex: use spin_[un]lock instead of arch_spin_[un]lock Yuanhan Liu
2013-01-24 9:58 ` Ingo Molnar
2013-01-24 10:13 ` Yuanhan Liu
2013-01-24 10:14 ` Ingo Molnar
2013-01-24 10:27 ` Yuanhan Liu [this message]
2013-01-24 10:54 ` Ingo Molnar
2013-01-25 0:14 ` Andrew Morton
2013-01-25 0:50 ` Steven Rostedt
2013-01-25 0:56 ` Andrew Morton
2013-01-25 1:03 ` Steven Rostedt
2013-01-25 7:40 ` Ingo Molnar
[not found] ` <CABBm8944FSNDZ2u=PJy0CsZmz=Vm7e+Y5jX+3UFLN5NOSGRgWQ@mail.gmail.com>
2013-01-25 9:24 ` Ingo Molnar
[not found] ` <CABBm896XGVkubML9TyW_MTXMovd6nHoK0v24jbEDJOipzNqpDA@mail.gmail.com>
2013-01-29 9:01 ` Ingo Molnar
[not found] ` <CABBm8979+XVRA-MQRdczMbStJR7DyPwNUvQL+RTuQL0sECOo8g@mail.gmail.com>
2013-01-29 9:28 ` Ingo Molnar
2013-01-24 20:03 ` [tip:core/locking] locking/stat: Fix a typo tip-bot for Yuanhan Liu
2013-02-22 12:20 ` tip-bot for Yuanhan Liu
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=20130124102747.GF12678@yliu-dev.sh.intel.com \
--to=yuanhan.liu@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.