Re: [rfc 03/45] Generic CPU operations: Core piece

From: Mathieu Desnoyers
Date: Mon Nov 19 2007 - 23:07:42 EST


* Christoph Lameter (clameter@xxxxxxx) wrote:
> On Mon, 19 Nov 2007, Mathieu Desnoyers wrote:
>
> >
> > Very interesting patch! I did not expect we could mix local atomic ops
> > with per CPU offsets in an atomic manner.. brilliant :)
> >
> > Some nitpicking follows...
>
> Well this is a draft so I was not that thorough. The beast is getting too
> big. It would be good if I could get the first patches merged that just
> deal with the two allocators and then gradually work the rest.
>
> > I think you could use extra () around old, new etc.. ?
>
> Right.
>
> > Same here.
> >
> > > + (x); \
> >
> > () seems unneeded here, since x is local.
>
> But (x) is returned to the "caller" of the macro so it should be specially
> marged.
>

I don't think that it really matters.. the preprocessor already wraps
all the ({ }) in a single statement, doesn't it ?


Grepping for usage of ({ in include/linux shows that the return value is
never surrounded by supplementary ().

> > > + * In that case we can simply disable preemption which
> > > + * may be free if the kernel is compiled without preemption.
> > > + */
> > > +
> > > +#define _CPU_READ(addr) \
> > > +({ \
> > > + (__CPU_READ(addr)); \
> > > +})
> >
> > ({ }) seems to be unneeded here.
>
> Hmmm.... I wanted a consistent style.
>

Since checkpatch.pl emits a warning when a one liner if() uses brackets,
I guess compactness of code is preferred to a consistent style.

Just my 2 cents though :)

Mathieu

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/