On Wed, 13 Mar 2002, Martin J. Bligh wrote:
> > I'm surprised it made any difference at all, I think the patch mainly
> > adds more tests: activate_page is only called from mark_page_accessed
> > (after testing !PageActive) and from fail_writepage (where usually
> > !PageActive). I don't think many !PageLRU pages can get there.
> It does seem distinctly odd that we take the lock, *then* test whether
> we actually need to do anything. Is the test just a sanity check that
> should never fail?
It's quite normal to have to recheck flags after taking the relevant
lock. Here I think the two flags have different needs. I've not
checked rigorously, but I believe that the PageLRU flag cannot change
beneath us (but does need to be checked either outside or inside the
lock); whereas it's easy to find races where PageActive is set outside
but found clear once inside the lock, or vice versa.
Now it doesn't matter if we make a wrong activity decision occasionally,
but we do need to keep internal consistency. If PageActive were not
rechecked inside pagemap_lru_lock, nr_active_pages and nr_inactive_pages
would become approximate instead of exact counts; then there's a danger
they would tend to drift in one direction, unbalancing shrink_caches.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Mar 15 2002 - 22:00:17 EST