On Fri 14-04-23 09:22:22, Mel Gorman wrote: [...] > + > + /* > + * Do not migrate huge pages that span the size of the region > + * being allocated contiguous. e.g. Do not migrate a 1G page > + * for a 1G allocation request. CMA is an exception as the > + * region may be reserved for hardware that requires physical > + * memory without a MMU or scatter/gather capability. > + * > + * Note that the compound check is race-prone versus > + * free/split/collapse but it should be safe and result in > + * a premature skip or a useless migration attempt. > + */ > + if (PageHuge(page) && compound_nr(page) >= nr_pages && > + !is_migrate_cma_page(page)) { > + return false; Is the CMA check working as expected? The function sounds quite generic and I agree that it would make sense if it was generic but it is used only for GB pages in fact and unless I am missing something it would allow to migrate CMA pages and potentially allocate over that region without any possibility to migrate GB page out so the CMA region would be essentially unusable for CMA users. GB pages already have their CMA allocator path before we get to alloc_contig_pages. Or do I miss something? -- Michal Hocko SUSE Labs