Thread (25 messages) flat view 25 messages, 5 authors, 2011-11-02

Re: >Re: [RFC] should VM_BUG_ON(cond) really evaluate cond

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2011-10-30 17:48:41
Also in: lkml

On Sun, Oct 30, 2011 at 10:41 AM, Eric Dumazet [off-list ref] wrote:
Changing atomic_read(const atomic_t *v) prototype to
atomic_read(atomic_t *v) is not an option.
Why not?

    #define atomic_read(v)     ACCESS_AT_MOST_ONCE((v)->counter)

seems to be the cleanest thing.

And if you don't think this is "an option", I really can't see why you
care about the extra instructions in the code stream either.
4) macro (I personnaly dont like it)
#define atomic_read(v) ACCESS_AT_MOST_ONCE(*(int *)&(v)->counter)
Why the *hell* would you have that cast there?

If somebody passes "const atomic_t"'s around, then just shoot the
bastard. The concept makes no sense.

Grepping for "const atomic_t" shows absolutely *zero* users, except
for the crazy inline function declaration itself.

Stop the insanity already. Get rid of the f*cking "const".

                      Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help