From: Andrea Arcangeli <andrea@suse.de>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: mason@suse.com, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: Unnecessary barrier in sync_page()?
Date: Wed, 7 Jul 2004 21:12:33 +0200 [thread overview]
Message-ID: <20040707191233.GP28479@dualathlon.random> (raw)
In-Reply-To: <20040707185814.GA3323@logos.cnet>
Hi Marcelo,
On Wed, Jul 07, 2004 at 03:58:14PM -0300, Marcelo Tosatti wrote:
> I think this comment on i386 bitops.h can lead to
> misunderstanding and should be changed:
>
> /**
> * set_bit - Atomically set a bit in memory
> * @nr: the bit to set
> * @addr: the address to start counting from
> *
> * This function is atomic and may not be reordered.
>
> "This function is atomic and may not be reordered (other architectures MAY reorder it)"
>
> Or something like this. The comment as it is leads people to
> write nonportable code which assumes set_bit() cant be reordered. Like naive me did.
agreed. (as usual trusting comments more than code carries some
risk, last time I was fooled by a comment was only a few months ago too
in some device driver ;)
btw, for completeness, test_bit (the one running before sync_page) can
be reordered even in x86.
The only one that enforces ordering everywhere is test_and_set_bit (as
Linus recently reminded on the list too). And it only enforces ordering
if it returns 0. If it returns 1 no ordering is enforced (for example on
alpha) because no change was made to the memory and supposedly the code
will not be allowed to access any critical section (and in turn no need
of any barrier).
> Andrew, what you think about removing that barrier from sync_page()
> on -mm?
>
> And what about changing the "may not reordered" comments on i386 bitops.h
> to "may not be reordered on i386 only, other arches do reorder it." ?
both looks correct to me, thanks.
prev parent reply other threads:[~2004-07-07 19:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-07 17:57 Unnecessary barrier in sync_page()? Marcelo Tosatti
2004-07-07 18:20 ` Andrea Arcangeli
2004-07-07 18:29 ` Andrew Morton
2004-07-07 18:42 ` Andrea Arcangeli
2004-07-07 18:46 ` Andrea Arcangeli
2004-07-07 20:57 ` Chris Mason
2004-07-07 21:06 ` Andrea Arcangeli
2004-07-07 21:15 ` Chris Mason
2004-07-07 21:30 ` Andrew Morton
2004-07-07 21:34 ` Chris Mason
2004-07-07 22:02 ` Andrea Arcangeli
2004-07-07 22:27 ` Andrew Morton
2004-07-07 18:58 ` Marcelo Tosatti
2004-07-07 19:12 ` Andrea Arcangeli [this message]
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=20040707191233.GP28479@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=mason@suse.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.