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.
Hugh
-
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/