From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: "David S. Miller" <davem@davemloft.net>
Cc: andrea@suse.de, herbert@gondor.apana.org.au,
nickpiggin@yahoo.com.au, benh@kernel.crashing.org,
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 23:36:00 +0400 [thread overview]
Message-ID: <20051016233600.A13487@jurassic.park.msu.ru> (raw)
In-Reply-To: <20051015.160702.128767261.davem@davemloft.net>; from davem@davemloft.net on Sat, Oct 15, 2005 at 04:07:02PM -0700
On Sat, Oct 15, 2005 at 04:07:02PM -0700, David S. Miller wrote:
> From: Andrea Arcangeli <andrea@suse.de>
> Date: Sat, 15 Oct 2005 22:07:01 +0200
>
> > sure see alpha:
> >
> > __asm__ __volatile__(
> > "1: ldq_l %0,%1\n"
> > " addq %0,%3,%2\n"
> > " addq %0,%3,%0\n"
> > " stq_c %0,%1\n"
> > " beq %0,2f\n"
> > " mb\n"
> >
> > the memory barrier is applied way after the write is visible to other
> > cpus, you can even get an irq before the mb and block there for some
> > usec.
>
> For atomic operations returning values, there must be a memory
> barrier both before and after the atomic operation. This is
> defined in Documentation/atomic_ops.txt, so Alpha needs to be
> fixed to add a memory barrier at the beginning of these
> assembler sequences.
My opinion is that we don't need a barrier even _after_ ll/sc sequences
on Alpha - it's redundant; perhaps it's just a historical baggage.
I strongly believe that ll/sc _does_ imply an SMP memory barrier, as can
be seen from instructions timing: a standalone mb takes tens of cycles,
the mb before/after ll/sc takes 0 to 1 cycle on ev6 (a bit more on ev56)
depending on instruction slotting.
Note that superfluous mb's around atomic stuff still can hurt -
Alpha mb instruction also flushes IO write buffers, so it can
be _extremely_ expensive under heavy IO...
Ivan.
next prev parent reply other threads:[~2005-10-16 19:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-15 3:28 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 [this message]
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
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=20051016233600.A13487@jurassic.park.msu.ru \
--to=ink@jurassic.park.msu.ru \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--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
all inboxes | Powered by JetHome®