Re: [RFC] should VM_BUG_ON(cond) really evaluate cond
From: Ben Hutchings
Date: Thu Oct 27 2011 - 23:29:42 EST
On Fri, 2011-10-28 at 04:52 +0200, Eric Dumazet wrote:
> Le vendredi 28 octobre 2011 Ã 02:44 +0100, Ben Hutchings a Ãcrit :
> > Whether or not it needs to provide any ordering guarantee, atomic_read()
> > must never read more than once, and I think that requires the volatile
> > qualification. It might be clearer to use the ACCESS_ONCE macro,
> > however.
> Where this requirement comes from ?
That is the conventional behaviour of 'atomic' operations, and callers
may depend on it.
> Maybe then introduce atomic_read_once() for users really needing it :)
> ACCESS_ONCE will force the read/move instruction I try to avoid :(
I'm sure you can find some other way to avoid it.
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
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/