Re: [PATCH 4/8] mm: migration: Allow migration to operateasynchronously and avoid synchronous compaction in the faster path

From: Andrea Arcangeli
Date: Thu Nov 18 2010 - 13:21:50 EST


On Wed, Nov 17, 2010 at 04:22:45PM +0000, Mel Gorman wrote:
> @@ -484,6 +486,7 @@ static unsigned long compact_zone_order(struct zone *zone,
> .order = order,
> .migratetype = allocflags_to_migratetype(gfp_mask),
> .zone = zone,
> + .sync = false,
> };
> INIT_LIST_HEAD(&cc.freepages);
> INIT_LIST_HEAD(&cc.migratepages);

I like this because I'm very afraid to avoid wait-I/O latencies
introduced into hugepage allocations that I prefer to fail quickly and
be handled later by khugepaged ;).

But I could have khugepaged call this with sync=true... so I'd need a
__GFP_ flag that only khugepaged would use to notify compaction should
be synchronous for khugepaged (not for the regular allocations in page
faults). Can we do this through gfp_mask only?

> @@ -500,6 +503,7 @@ unsigned long reclaimcompact_zone_order(struct zone *zone,
> .order = order,
> .migratetype = allocflags_to_migratetype(gfp_mask),
> .zone = zone,
> + .sync = true,
> };
> INIT_LIST_HEAD(&cc.freepages);
> INIT_LIST_HEAD(&cc.migratepages);

Is this intentional? That inner compaction invocation is
equivalent to the one one interleaved with the shrinker tried before
invoking the shrinker. So I don't see why they should differ (one sync
and one async).

Anyway I'd prefer the inner invocation to be removed as a whole and to
keep only going with the interleaving and to keep the two jobs of
compaction and shrinking memory fully separated and to stick to the
interleaving. If this reclaimcompact_zone_order helps maybe it means
compact_zone_order isn't doing the right thing and we're hiding it by
randomly calling it more frequently...

I can see a point however in doing:

compaction async
shrink (may wait) (scan 500 pages, freed 32 pages)
compaction sync (may wait)

to:

compaction async
shrink (scan 32 pages, freed 0 pages)
compaction sync (hugepage generated nobody noticed)
shrink (scan 32 pages, freed 0 pages)
compaction sync
shrink (scan 32 pages, freed 0 pages)
[..]
--
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/