Re: VM-related Oops: 2.4.15pre1

Andrea Arcangeli (andrea@suse.de)
Sun, 18 Nov 2001 07:37:30 +0100


On Sat, Nov 17, 2001 at 10:24:44PM -0800, Linus Torvalds wrote:
>
> On Sun, 18 Nov 2001, Andrea Arcangeli wrote:
> >
> > I also agree the patch shouldn't matter, but one suspect thing is the
> > fact add_to_swap_cache goes to clobber in a non atomic manner the page
> > lock.
>
> .. you mean __add_to_page_cache(), not add_to_swap_cache().
>
> And nope, not really. It does use plain stores to page->flags, and I agree
> that it is ugly, but if the page was locked before calling it, all the
> stores will be with the PG_lock bit set - and even plain stores _are_
> documented to be atomic on x86 (and on all other reasonable architectures
> too).

I know all is right if GCC just overwrites the page->flags with data
that keeps PG_locked set. But GCC doesn't guarantee that. GCC can as
well do:

flags = page->flags;
page->flags = 0;

change flags here

page->flags = flags

probably gcc doesn't, but that's still a kernel bug.

Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/