From: Matt Mackall <mpm@selenic.com>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
john stultz <johnstul@us.ibm.com>,
Roman Zippel <zippel@linux-m68k.org>,
Christian Borntraeger <cborntra@de.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] timer/hrtimer: take per cpu locks in sane order
Date: Sun, 4 Mar 2007 17:24:43 -0600 [thread overview]
Message-ID: <20070304232443.GP16722@waste.org> (raw)
In-Reply-To: <20070302224752.GB9514@osiris.ibm.com>
On Fri, Mar 02, 2007 at 11:47:52PM +0100, Heiko Carstens wrote:
> /*
> + * Locks two spinlocks l1 and l2.
> + * l1_first indicates if spinlock l1 should be taken first.
> + */
> +static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2,
> + bool l1_first)
> + __acquires(l1)
> + __acquires(l2)
> +{
> + if (l1_first) {
> + spin_lock(l1);
> + spin_lock(l2);
> + } else {
> + spin_lock(l2);
> + spin_lock(l1);
> + }
> +}
Two observations:
- We probably don't want people using this for locks that aren't
explicitly in the same level of the hierarchy. The name should
somehow indicate that. Something like spin_lock_siblings()?
- And once we know that, we can internally impose a natural stable
ordering on them based on their addresses, eliminating the third
argument and the need to duplicate the ordering calculation.
--
Mathematics is the supreme nostalgia of our time.
prev parent reply other threads:[~2007-03-04 23:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-27 15:30 timer/hrtimer & cpu hotplug lockdep complaints Heiko Carstens
2007-03-02 12:58 ` [patch] timer/hrtimer: take per cpu locks in sane order Heiko Carstens
2007-03-02 13:04 ` Ingo Molnar
2007-03-02 14:23 ` Heiko Carstens
2007-03-02 16:48 ` Andrew Morton
2007-03-02 19:08 ` Heiko Carstens
2007-03-02 19:45 ` Andrew Morton
2007-03-02 21:39 ` Heiko Carstens
2007-03-02 22:47 ` Heiko Carstens
2007-03-04 23:24 ` Matt Mackall [this message]
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=20070304232443.GP16722@waste.org \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=cborntra@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
--cc=zippel@linux-m68k.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