On 14 Sep 2022, at 18:42, Andrew Morton wrote: > On Tue, 13 Sep 2022 22:39:13 -0400 Zi Yan wrote: > >> set_migratetype_isolate() does not allow isolating MIGRATE_CMA pageblocks >> unless it is used for CMA allocation. isolate_single_pageblock() did not >> have the same behavior when it is used together with >> set_migratetype_isolate() in start_isolate_page_range(). This allows >> alloc_contig_range() with migratetype other than MIGRATE_CMA, like >> MIGRATE_MOVABLE (used by alloc_contig_pages()), to isolate first and last >> pageblock but fail the rest. The failure leads to changing migratetype >> of the first and last pageblock to MIGRATE_MOVABLE from MIGRATE_CMA, >> corrupting the CMA region. This can happen during gigantic page >> allocations. > > How does this bug manifest itself as far as the user is concerned? Like Doug said here: https://lore.kernel.org/linux-mm/a3363a52-883b-dcd1-b77f-f2bb378d6f2d@gmail.com/T/#u, for gigantic page allocations, the user would notice no difference, since the allocation on CMA region will fail as well as it did before. But it might hurt the performance of device drivers that use CMA, since CMA region size decreases. > >> Fix it by passing migratetype into isolate_single_pageblock(), so that >> set_migratetype_isolate() used by isolate_single_pageblock() will prevent >> the isolation happening. -- Best Regards, Yan, Zi