Re: [PATCH] page->flags corruption fix

From: Rik van Riel
Date: Wed Oct 08 2003 - 10:54:44 EST


On Wed, 8 Oct 2003, Hugh Dickins wrote:

> > It's quite possible that one CPU adds the page to the swap
> > cache, while another CPU moves the page around on the inactive
> > list. At that point both CPUs could be fiddling around with
> > the page->flags simultaneously.
>
> Don't both of those TryLockPage (in one case holding page_table_lock,
> in the other case holding pagemap_lru_lock, to hold the page while
> doing so)?

Nope. I'm afraid they don't. Think of eg. mark_page_accessed
moving the page to the active list ...

> > In fact, this has been observed in heavy stress testing by
> > Matt Domsch and Robert Hentosh...
>
> Perhaps Matt could add description of what they observed, in support
> of the patch. I'm not yet convinced that it's necessarily the fix.

I'm not convinced all of the operations need to be atomic
(especially the ones in __free_pages_ok()) but since I've
seen the bug happen I'd rather play safe...

--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

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