From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
mingo@elte.hu, KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Steven Rostedt <rostedt@goodmis.org>,
Nicholas Miell <nmiell@comcast.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, josh@joshtriplett.org,
dvhltc@us.ibm.com, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, Valdis.Kletnieks@vt.edu,
dhowells@redhat.com, Nick Piggin <npiggin@suse.de>,
Chris Friesen <cfriesen@nortel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] introduce sys_membarrier(): process-wide memory barrier (v10)
Date: Mon, 5 Apr 2010 18:01:28 -0400 [thread overview]
Message-ID: <20100405220128.GA16208@Krystal> (raw)
In-Reply-To: <20100405213953.GJ2525@linux.vnet.ibm.com>
* Paul E. McKenney (paulmck@linux.vnet.ibm.com) wrote:
> On Mon, Apr 05, 2010 at 01:23:55PM -0700, Randy Dunlap wrote:
> > Paul E. McKenney wrote:
> > > On Mon, Apr 05, 2010 at 03:10:57PM -0400, Mathieu Desnoyers wrote:
> > >> * Randy Dunlap (randy.dunlap@oracle.com) wrote:
> > >>> On Mon, 5 Apr 2010 13:57:37 -0400 Mathieu Desnoyers wrote:
> > >
> > > [ . . . ]
> > >
> > >>>> +#else /* #ifdef CONFIG_SMP */
> > >>> I don't know that we have a known convention for that, but I would use:
> > >>>
> > >>> #else /* not CONFIG_SMP */
> > >>>
> > >>> or
> > >>>
> > >>> #else /* !CONFIG_SMP */
> > >>>
> > >>>> +
> > >>>> +SYSCALL_DEFINE1(membarrier, unsigned int, flags)
> > >>>> +{
> > >>>> + return 0;
> > >>>> +}
> > >>>> +
> > >>>> +#endif /* #else #ifdef CONFIG_SMP */
> >
> > or just:
> >
> > #endif /* #else #ifdef CONFIG_SMP : tell the reader that the #else part of the #ifdef CONFIG_SMP just ended */
> >
> > ad nauseum.
>
> You lost me on this one.
>
> > >>> and:
> > >>>
> > >>> #endif /* CONFIG_SMP */
> > >>>
> > >>> The "#else #ifdef" is both ugly and too wordy IMO.
> > >
> > > The extra words make it very clear that we are in at the end of the #else
> > > clause of a #ifdef with the given condition. With "#endif /* CONFIG_SMP
> > > */", is the immediately preceding code compiled under CONFIG_SMP or
> > > !CONFIG_SMP? You have to dig back and see whether or not there is a
> > > #else clause.
> > >
> > > But there is no accounting for taste. ;-)
> >
> > IYHO.
>
> Indeed, in both directions.
I strongly prefer Paul's approach, because it represents ifdef nesting much more
clearly, but I'll follow the coding style used by sched.c for these bits.
So maybe his approach is too verbose, but the
#ifdef X
#else /* !X */
#endif /* X */
is just a pain to follow with large chunks of code, especially when #ifndef
comes into play.
Thanks,
Mathieu
>
> Thanx, Paul
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2010-04-05 22:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-05 17:57 [PATCH] introduce sys_membarrier(): process-wide memory barrier (v10) Mathieu Desnoyers
2010-04-05 18:38 ` Randy Dunlap
2010-04-05 19:10 ` Mathieu Desnoyers
2010-04-05 20:40 ` Paul E. McKenney
2010-04-05 20:23 ` Randy Dunlap
2010-04-05 21:39 ` Paul E. McKenney
2010-04-05 22:01 ` Mathieu Desnoyers [this message]
2010-04-05 21:08 ` Josh Triplett
2010-04-05 22:08 ` Mathieu Desnoyers
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=20100405220128.GA16208@Krystal \
--to=mathieu.desnoyers@efficios.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=cfriesen@nortel.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhltc@us.ibm.com \
--cc=josh@joshtriplett.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=nmiell@comcast.net \
--cc=npiggin@suse.de \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=randy.dunlap@oracle.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--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