From: Jarek Poplawski <jarkao2@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [patch 2/4] net: use mutex_is_locked() for ASSERT_RTNL()
Date: Mon, 17 Dec 2007 08:26:01 +0100 [thread overview]
Message-ID: <20071217072601.GA1654@ff.dom.local> (raw)
In-Reply-To: <20071217012632.GA8475@gondor.apana.org.au>
On Mon, Dec 17, 2007 at 09:26:32AM +0800, Herbert Xu wrote:
> On Sun, Dec 16, 2007 at 07:06:41PM +0100, Jarek Poplawski wrote:
> >
> > It seemed to exist a few days ago:
> > http://kerneltrap.org/mailarchive/linux-netdev/2007/12/4/473123
> >
> > Btw., I don't know which of the patches: Eric's or yours will be chosen,
> > but, IMHO, there is no reason to remove rtnl_trylock(), which can be still
> > useful, just like mutex_trylock() is.
>
> Doh! Andrew was too convincing :) I misread the grep result on
> in_interrupt. Of course that function returns true if we're
> either in an IRQ handler or have BH off.
>
> I retract what I've said in this thread and continue to oppose
> this change without a might_sleep.
>
...And I think some change is needed here. Btw., I proposed to change
this long time ago too. There were no response - only Ben Greear
mentioned about some applications, which could rely on the trylock
way. I didn't understand what he was talking about at all - and it
didn't change until I've read this and Eric's patch thread!
So, I was surprised, probably just like Eric, ASSERT_RTNL is 2 in 1,
with this atomic somewhere deep in mind. IMHO this should be better
commented at least. But it's still dubious to me: using trylock this
way makes impossible to verify (eg. by lockdep) recursion cases,
when lock is taken with trylock in a loop.
So, I think using might_sleep() explicitly would be much more
readable or, otherwise, Patrick's proposal with adding
ASSERT_RTNL_ATOMIC would implicitly signal the real meaning of the
other one.
Btw. #2: David Miller gave this example of ASSERT_RTNL use:
ASSERT_RTNL();
page = alloc_page(GFP_KERNEL);
But isn't there a debugging duplication: it seems alloc_page() is used
in so many places and this check for GFP is/should_be there already?
Regards,
Jarek P.
next prev parent reply other threads:[~2007-12-17 7:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 0:02 [patch 2/4] net: use mutex_is_locked() for ASSERT_RTNL() akpm
2007-12-14 8:10 ` Herbert Xu
2007-12-14 8:22 ` Andrew Morton
2007-12-14 8:30 ` Herbert Xu
2007-12-14 19:15 ` David Miller
2007-12-14 23:11 ` Andrew Morton
2007-12-15 4:18 ` Herbert Xu
2007-12-15 5:44 ` Andrew Morton
2007-12-15 6:10 ` Herbert Xu
2007-12-15 10:48 ` Andrew Morton
2007-12-15 13:10 ` Herbert Xu
2007-12-16 5:44 ` David Miller
2007-12-16 7:13 ` Herbert Xu
2007-12-16 18:06 ` Jarek Poplawski
2007-12-17 1:26 ` Herbert Xu
2007-12-17 7:26 ` Jarek Poplawski [this message]
2007-12-17 7:31 ` Herbert Xu
2007-12-17 7:57 ` Jarek Poplawski
2007-12-17 7:44 ` Jarek Poplawski
2007-12-16 5:37 ` David Miller
2007-12-14 12:37 ` Johannes Berg
2007-12-14 12:46 ` Herbert Xu
2007-12-14 12:54 ` Johannes Berg
2007-12-14 19:30 ` 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=20071217072601.GA1654@ff.dom.local \
--to=jarkao2@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.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).