Re: [patch 1/2] mm, zone: track number of pages in free area by migratetype

From: Vlastimil Babka
Date: Thu Nov 17 2016 - 12:27:19 EST


On 11/17/2016 02:32 AM, David Rientjes wrote:
> Each zone's free_area tracks the number of free pages for all free lists.
> This does not allow the number of free pages for a specific migratetype
> to be determined without iterating its free list.
>
> An upcoming change will use this information to preclude doing async
> memory compaction when the number of MIGRATE_UNMOVABLE pageblocks is
> below a certain threshold.
>
> The total number of free pages is still tracked, however, to not make
> zone_watermark_ok() more expensive. Reading /proc/pagetypeinfo, however,
> is faster.

Yeah I've already seen a case with /proc/pagetypeinfo causing soft
lockups due to high number of iterations...

> This patch introduces no functional change and increases the amount of
> per-zone metadata at worst by 48 bytes per memory zone (when CONFIG_CMA
> and CONFIG_MEMORY_ISOLATION are enabled).

Isn't it 48 bytes per zone and order?

> Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>

I'd be for this if there are no performance regressions. It affects hot
paths and increases cache footprint. I think at least some allocator
intensive microbenchmark should be used.

Vlastimil