Re: PageBlocks and Migrate Types

From: Michal Hocko
Date: Thu Aug 22 2019 - 09:46:09 EST


On Wed 21-08-19 22:23:44, Pankaj Suryawanshi wrote:
> Hello,
>
> 1. What are Pageblocks and migrate types(MIGRATE_CMA) in Linux memory ?

Pageblocks are a simple grouping of physically contiguous pages with
common set of flags. I haven't checked closely recently so I might
misremember but my recollection is that only the migrate type is stored
there. Normally we would store that information into page flags but
there is not enough room there.

MIGRATE_CMA represent pages allocated for the CMA allocator. There are
other migrate types denoting unmovable/movable allocations or pages that
are isolated from the page allocator.

Very broadly speaking, the migrate type groups pages with similar
movability properties to reduce fragmentation that compaction cannot
do anything about because there are objects of different properties
around. Please note that pageblock might contain objects of a different
migrate type in some cases (e.g. low on memory).

Have a look at gfpflags_to_migratetype and how the gfp mask is converted
to a migratetype for the allocation. Also follow different MIGRATE_$TYPE
to see how it is used in the code.

> How many movable/unmovable pages are defined by default?

There is nothing like that. It depends on how many objects of a specific
type are allocated.

HTH
--
Michal Hocko
SUSE Labs