Messages in this thread |  | | Date | Sat, 17 Nov 2001 22:24:44 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: VM-related Oops: 2.4.15pre1 |
| |
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).
> so yes, we hold the page lock both in swap_out and in > shrink_cache, but swap_out can drop it for a moment and then later > pretend to be the onwer again without a real trylock.
No, it doesn't get dropped for a moment. The bit is always set, and somebody else who tries to lock the page will never see it clear, and can never succeed in locking it.
Is the __add_to_page_cache() playing with the page flags ugly? It sure is. I'd _almost_ call it buggy, but not because of PG_locked, but because of all the other bits it does horrible things to. It's one of those borderline cases, but I don't think it's borderline wrt the lock bit.
Linus
- 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/
|  |