On Wed, Apr 08, 2020 at 12:41:19PM -0700, Roman Gushchin wrote: > Compaction does treat cma pageblocks on pair with any movable > pageblocks. It means it can easily move non-cma pages into a cma zone. > > It can create problems for the cma allocator. > > The particular problem I'm looking at is related to btrfs metadata > pages, which are allocated without __GFP_MOVABLE, but beside that > are generic pagecache pages. In fact, they are sometimes movable > and sometimes not, depending on whether they are dirty and also > on the extent buffer reference counter. > > Compaction moves them to the hugetlb_cma area, and then sometimes > the cma allocator fails to move them back from the cma area. It > results in failures of gigantic hugepages allocations. > > Also in general cma areas are reserved close to the end of a zone, > and it's where compaction tries to migrate pages. It means > compaction will aggressively fill cma areas, which makes not much > sense. > > So to avoid it, let's preserve non-cma pages from being moved into > a cma area. Because cma areas are usually quite large and the number > of areas is small, it should not significantly affect the memory > fragmentation. > > Signed-off-by: Roman Gushchin <guro@xxxxxx> Friendly ping... Any thoughts, comments, ideas? Thanks! Roman