Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2007-08-16 10:37:51
Also in:
linux-arch, lkml
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2007-08-16 10:37:51
Also in:
linux-arch, lkml
On Thu, Aug 16, 2007 at 11:54:44AM +0200, Stefan Richter wrote:
One example was discussed here earlier: The for (;;) loop in nodemgr_host_thread. There an msleep_interruptible implicitly acted as barrier (at the moment because it's in a different translation unit; if it were the same, then because it hopefully has own barriers). So that happens to work, although such an implicit barrier is bad style: Better enforce the desired behaviour (== guaranteed load operation) *explicitly*.
Hmm, it's not bad style at all. Let's assume that everything is in the same scope. Such a loop must either call a function that busy-waits, which should always have a cpu_relax or something equivalent, or it'll call a function that schedules away which immediately invalidates any values the compiler might have cached for the atomic_read. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt