Re: [PATCH 4/7] vmscan: narrowing synchrounous lumply reclaimcondition

From: Wu Fengguang
Date: Mon Nov 01 2010 - 22:05:40 EST


> To make compaction a full replacement for lumpy, reclaim would have to
> know how to reclaim order-9 worth of pages and then compact properly.
> It's not setup for this and a naive algorithm would spend a lot of time
> in the compaction scanning code (which is pretty inefficient). A possible
> alternative would be to lumpy-compact i.e. select a page from the LRU and
> move all pages around it elsewhere. Again, this is not what we are currently
> doing but it's a direction that could be taken.

Agreed. The more lumpy reclaim, the more young pages being wrongly
evicted. THP could trigger lumpy reclaims heavily, that's why Andreas
need to disable it. Lumpy migration looks much better. Compaction
looks like some pre/batched lumpy-migration. We may also do on demand
lumpy migration in future.

> +static void set_lumpy_reclaim_mode(int priority, struct scan_control *sc,
> + bool sync)
> +{
> + enum lumpy_mode mode = sync ? LUMPY_MODE_SYNC : LUMPY_MODE_ASYNC;
> +
> + /*
> + * Some reclaim have alredy been failed. No worth to try synchronous
> + * lumpy reclaim.
> + */
> + if (sync && sc->lumpy_reclaim_mode == LUMPY_MODE_NONE)
> + return;
> +
> + /*
> + * If we need a large contiguous chunk of memory, or have
> + * trouble getting a small set of contiguous pages, we
> + * will reclaim both active and inactive pages.
> + */
> + if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
> + sc->lumpy_reclaim_mode = mode;
> + else if (sc->order && priority < DEF_PRIORITY - 2)
> + sc->lumpy_reclaim_mode = mode;
> + else
> + sc->lumpy_reclaim_mode = LUMPY_MODE_NONE;
> +}

Andrea, I don't see the conflicts in doing lumpy reclaim improvements
in parallel to compaction and THP. If lumpy reclaim hurts THP, it can
be trivially disabled in your tree for huge page order allocations?

+ if (sc->order > 9)
+ sc->lumpy_reclaim_mode = LUMPY_MODE_NONE;

Thanks,
Fengguang
--
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/