From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, <linux-kernel@vger.kernel.org>
Subject: Re: VM-related Oops: 2.4.15pre1
Date: 19 Nov 2001 11:03:20 -0700 [thread overview]
Message-ID: <m1wv0m7i53.fsf@frodo.biederman.org> (raw)
In-Reply-To: <Pine.LNX.4.33.0111190833440.8103-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.33.0111190833440.8103-100000@penguin.transmeta.com>
Linus Torvalds <torvalds@transmeta.com> writes:
> That's fine - if you have two threads modifying the same variable at the
> same time, you need to lock it.
>
> That's not the case under discussion.
>
> The case under discussion is gcc writing back values to a variable that
> NEVER HAD ANY VALIDITY, even in the single-threaded case. And it _is_
> single-threaded at that point, you only have other users that test the
> value, not change it.
>
> That's not an optimization, that's just plain broken. It breaks even
> user-level applications that use sigatomic_t.
>
> And note how gcc doesn't actually do it. I'm not saying that gcc is broken
> - I' saying that gcc is NOT broken, and we depend on it being not broken.
Linus I agree that gcc works. And even if page->flags is written
to, with two separate write operations page->flags & PG_locked should
still be true.
However this case seems to violate code clarity. If you can have
other users testing PG_locked it is non-intuitive that you can still
normally assign to page->flags.
Would it make sense to add a set_bits macro that is a just an
assignment except on extremely weird architectures or to work
around compiler bugs? I'm just thinking it would make sense
to document that we depend on the compiler not writing some
strange intermediate values into the variable.
I can't imagine why a compiler ever would but it is remotely possible
a compiler but generate an instruction sequence like:
xorl flags, $0xFFFFFFFF
xorl flags, $0xFFFFFFFe
To flip the low bit. I would be terribly surprised, and it would
certainly break sigatomic_t if it was a plain typedef, but stranger
things have happened.
Eric
next prev parent reply other threads:[~2001-11-19 18:22 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-16 22:23 VM-related Oops: 2.4.15pre1 Simon Kirby
2001-11-17 22:53 ` Christian Ehrhardt
2001-11-18 3:12 ` Linus Torvalds
2001-11-18 4:10 ` Andrea Arcangeli
2001-11-18 6:24 ` Linus Torvalds
2001-11-18 6:37 ` Andrea Arcangeli
2001-11-18 7:31 ` Linus Torvalds
2001-11-18 12:05 ` Alan Cox
2001-11-19 2:02 ` Linus Torvalds
2001-11-19 2:27 ` Linus Torvalds
2001-11-19 18:40 ` kuznet
2001-11-19 10:15 ` Alan Cox
2001-11-19 16:39 ` Linus Torvalds
2001-11-19 18:03 ` Eric W. Biederman [this message]
2001-11-19 19:04 ` Linus Torvalds
2001-11-19 23:52 ` John Alvord
2001-11-21 2:31 ` Pavel Machek
[not found] ` <200111180731.fAI7VFa01371@penguin.transmeta.com>
2001-11-18 7:51 ` Andrea Arcangeli
2001-11-18 17:10 ` Horst von Brand
2001-11-19 2:04 ` Linus Torvalds
2001-11-19 3:22 ` Jeff V. Merkey
2001-11-19 8:44 ` David Woodhouse
2001-11-19 16:57 ` Linus Torvalds
2001-11-19 17:56 ` Simon Kirby
2001-11-19 18:03 ` Linus Torvalds
2001-11-19 18:31 ` Simon Kirby
2001-11-19 20:01 ` Marcelo Tosatti
2001-11-19 21:26 ` Linus Torvalds
2001-11-19 21:49 ` Rik van Riel
2001-11-19 22:40 ` Linus Torvalds
2001-11-19 22:59 ` Rik van Riel
2001-11-19 23:03 ` Linus Torvalds
2001-11-20 0:06 ` Rik van Riel
2001-11-20 0:08 ` Linus Torvalds
2001-11-20 0:27 ` Rik van Riel
2001-11-19 23:27 ` Simon Kirby
2001-11-19 23:38 ` Linus Torvalds
2001-11-19 23:52 ` Simon Kirby
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=m1wv0m7i53.fsf@frodo.biederman.org \
--to=ebiederm@xmission.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox