From: Andrew Morton <akpm@linux-foundation.org>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, mingo@elte.hu, davem@davemloft.net
Subject: Re: [patch 2/6] epoll keyed wakeups v2 - introduce new *_poll() wakeup macros
Date: Tue, 3 Feb 2009 12:10:41 -0800 [thread overview]
Message-ID: <20090203121041.23d440be.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0902031116500.23050@alien.or.mcafeemobile.com>
On Tue, 3 Feb 2009 11:20:46 -0800 (PST)
Davide Libenzi <davidel@xmailserver.org> wrote:
> On Tue, 3 Feb 2009, Davide Libenzi wrote:
>
> > On Tue, 3 Feb 2009, Andrew Morton wrote:
> >
> > > On Sun, 01 Feb 2009 12:04:23 -0800 Davide Libenzi <davidel@xmailserver.org> wrote:
> > >
> > > > +#define wake_up_nested_poll(x, m, s) \
> > > > +do { \
> > > > + unsigned long flags; \
> > > > + \
> > > > + spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \
> > > > + wake_up_locked_poll(x, m); \
> > > > + spin_unlock_irqrestore(&(x)->lock, flags); \
> > > > +} while (0)
> > >
> > > I had to go and find the callsite to work out the type of `x' :(
> > >
> > > - this macro can be passed the address of any structure which has a
> > > `spinlock_t lock;' in it, which seems strange.
> > >
> > > - It references its first arg three times.
> > >
> > > Is there any reason why we can't implement this in C?
> >
> > I don't see any reason why these two couldn't be normal functions (I
> > just referenced wake_up_nested(), that was a macro in the first place).
>
> Actually reading the comments helps :) It triggers an include-hell, if you
> make them inline. Since they're lockdep debug thingies, I think it's kinda
> wasted turn them into non-inline real functions, so they'd better remain
> macros IMO.
>
ho hum. I think it'd be worth at least renaming the arguments to
something less daft, for readability reasons.
One could also do
do {
wait_queue_head_t *__wqh = x;
<use __wqh>
}
which would provide typechecking of the first arg (so people can no
longer "pass the address of any structure which has a `spinlock_t
lock;' in it") and which fixes the multiple-references-to-an-argument
issue.
next prev parent reply other threads:[~2009-02-03 20:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-01 20:04 [patch 2/6] epoll keyed wakeups v2 - introduce new *_poll() wakeup macros Davide Libenzi
2009-02-03 8:14 ` Andrew Morton
2009-02-03 18:24 ` Davide Libenzi
2009-02-03 19:20 ` Davide Libenzi
2009-02-03 20:10 ` Andrew Morton [this message]
2009-02-03 20:24 ` Davide Libenzi
2009-02-03 20:28 ` Linus Torvalds
2009-02-03 20:34 ` Davide Libenzi
2009-02-03 20:53 ` Linus Torvalds
2009-02-03 18:28 ` Davide Libenzi
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=20090203121041.23d440be.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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