On Wed, Mar 24, 2010 at 01:33:47PM -0700, Andrew Morton wrote:
I don't think so. There are two points where zone-related locks are
held.
zone->lock is held in isolate_freepages() while it gets the free pages
necessary for migration to complete. The size of the list of pages
being migrated is constrained by COMPACT_CLUSTER_MAX so it is bounded
by that. Worst case scenario is the zone is almost fully
scanned.
zone->lru_lock is held in isolate_migratepages) while it gets pages for
migration. It's released if COMPACT_CLUSTER_MAX pages are
isolated. Again, worst case scenario is that the zone is
almost fully scanned.
The worst-case scenario in both cases is the lock is held while the zone
is scanned. The concern would be if we managed to scan almost a full
zone and that zone is very large. I could add an additional check to
release the lock when a large number of pages has been scanned but I
don't think it's necessary. I find it very unlikely that a large zone
would not have COMPACT_CLUSTER_MAX pages found quickly for isolation.
It was paranoia after the bugs related to NULL-offsets but unnecessary
paranoia in this case. It would require migration to be very broken for it to
trigger. Even if it was, I cannot imagine a case where it would be exploited
because it's a small structure and not offset by any userspace-supplied
piece of data. I will drop the check.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--