public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	hugh@veritas.com, paulus@samba.org, anton@samba.org,
	torvalds@osdl.org, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: Possible memory ordering bug in page reclaim?
Date: Sun, 16 Oct 2005 08:16:30 +1000	[thread overview]
Message-ID: <1129414591.7620.13.camel@gaston> (raw)
In-Reply-To: <20051015180018.GN18159@opteron.random>


> Even a write barrier is required on the left side, the read barrier on
> the right side is useless if there is no write barrier on the left side.
> 
> Note that the barrier in atomic_add_negative is useless here because it
> happens way too late, _after_ the count is decremented (not _before_)
> so the decreased count could be already visible to the other cpu.

Not on ppc64. Our atomic*return functions have a write barrier before
the atomic operation. I think there is just too much code out there that
either expects implicit barriers done by atomics (abuse them as locks)
or simply written by people who don't understand those ordering issues
(to be fair, they can be fairly brain damaging).

I agree this is not a good generic solution though.

> Not all archs are like x86 where a barrier happens implicitly both
> before and after the instruction, and the way atomic_add_negative is
> implemented the barrier from a common code point of view is only added
> _after_ the instruction. 


  parent reply	other threads:[~2005-10-15 22:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-15  3:28 Possible memory ordering bug in page reclaim? Nick Piggin
2005-10-15  6:17 ` Hugh Dickins
2005-10-15  7:43   ` Benjamin Herrenschmidt
2005-10-15  8:00     ` Herbert Xu
2005-10-15 16:57       ` Linus Torvalds
2005-10-15 19:29         ` David S. Miller
2005-10-15 22:17           ` Benjamin Herrenschmidt
2005-10-16  0:04         ` Nick Piggin
2005-10-15  8:59     ` Nick Piggin
2005-10-15 12:08       ` Herbert Xu
2005-10-15 13:35         ` Nick Piggin
2005-10-15 18:00         ` Andrea Arcangeli
2005-10-15 19:48           ` Herbert Xu
2005-10-15 20:07             ` Andrea Arcangeli
2005-10-15 23:07               ` David S. Miller
2005-10-16 19:36                 ` Ivan Kokshaysky
2005-10-17  4:29                   ` David S. Miller
2005-10-17  7:23                     ` Ivan Kokshaysky
2005-10-17 11:28                   ` Andrea Arcangeli
2005-10-15 22:16           ` Benjamin Herrenschmidt [this message]
2005-10-15 23:13             ` David S. Miller

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=1129414591.7620.13.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=anton@samba.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=paulus@samba.org \
    --cc=torvalds@osdl.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