From: Linus Torvalds <torvalds@linux-foundation.org>
To: David Miller <davem@davemloft.net>
Cc: hugh@veritas.com, jeremy@goop.org, a.p.zijlstra@chello.nl,
mingo@elte.hu, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org
Subject: Re: [PATCH] lockdep: lock_set_subclass - reset a held lock's subclass
Date: Fri, 1 Aug 2008 16:26:56 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0808011623040.6819@nehalem.linux-foundation.org> (raw)
In-Reply-To: <20080801.162013.06459319.davem@davemloft.net>
On Fri, 1 Aug 2008, David Miller wrote:
>
> Taking more than a few locks of the same class at once is bad
> news and it's better to find an alternative method.
It's not always wrong.
If you can guarantee that anybody that takes more than one lock of a
particular class will always take a single top-level lock _first_, then
that's all good. You can obviously screw up and take the same lock _twice_
(which will deadlock), but at least you cannot get into ABBA situations.
So maybe the right thing to do is to just teach lockdep about "lock
protection locks". That would have solved the multi-queue issues for
networking too - all the actual network drivers would still have taken
just their single queue lock, but the one case that needs to take all of
them would have taken a separate top-level lock first.
Never mind that the multi-queue locks were always taken in the same order:
it's never wrong to just have some top-level serialization, and anybody
who needs to take <n> locks might as well do <n+1>, because they sure as
hell aren't going to be on _any_ fastpaths.
So the simplest solution really sounds like just teaching lockdep about
that one special case. It's not "nesting" exactly, although it's obviously
related to it.
Linus
next prev parent reply other threads:[~2008-08-01 23:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 21:43 [git pull] scheduler fixes Ingo Molnar
2008-07-31 22:04 ` David Miller
2008-07-31 22:26 ` Ingo Molnar
2008-07-31 22:55 ` David Miller
2008-08-01 8:11 ` David Miller
2008-08-01 9:01 ` Ingo Molnar
2008-08-01 9:13 ` David Miller
2008-08-01 11:08 ` [PATCH] lockdep: lock_set_subclass - reset a held lock's subclass Peter Zijlstra
2008-08-01 18:06 ` Jeremy Fitzhardinge
2008-08-01 18:14 ` Linus Torvalds
2008-08-01 19:10 ` Jeremy Fitzhardinge
2008-08-01 19:24 ` Linus Torvalds
2008-08-01 20:08 ` Jeremy Fitzhardinge
2008-08-01 19:59 ` Hugh Dickins
2008-08-01 20:22 ` Jeremy Fitzhardinge
2008-08-01 20:33 ` Hugh Dickins
2008-08-01 23:20 ` David Miller
2008-08-01 23:26 ` Linus Torvalds [this message]
2008-08-01 20:49 ` Peter Zijlstra
2008-08-01 11:08 ` [PATCH] lockdep: re-annotate scheduler runqueues Peter Zijlstra
2008-08-01 17:04 ` Linus Torvalds
2008-08-02 8:34 ` David Miller
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=alpine.LFD.1.10.0808011623040.6819@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=hugh@veritas.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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).