On Thu, 25 Jun 2020, 孙世龙 sunshilong wrote: > >Grouping pages by mobility simply means that we attempt (best > >effort) to allocate unmovable pages from the same pageblocks and movable > >pages from the same pageblocks. > > How can I understand it in the right way, especially for "from the same > pageblocks"? Could you please explain that in more detail? > Movable page allocations (__GFP_MOVABLE) are first attempted from MIGRATE_MOVABLE pageblocks; unmovable page allocations (~__GFP_MOVABLE) are first attempted from MIGRATE_UNMOVABLE. That doesn't necessarily help if migration and compaction are disabled. __GFP_RECLAIMABLE (like dentries and inodes, for instance) have their own pageblocks, however: MIGRATE_RECLAIMABLE. If we can reclaim all memory from these pageblocks, and it is all reclaimable (we didn't have to allocate unmovable pages from it, for example), it should free up the whole pageblock. Other than that, the page allocator tries to grab the smallest free page when necessary to leave higher order pages available. > Are there still some methods that could be used by the Linux kernel > to reduce memory fragmentation? > Without compaction or migration, that's just about it. > I can draw the conclusion that ZONE_NORMAL is only used to allocate > unmovable memory(i.e. no movable memory could be allocated from > ZONE_NORMAL) while "kernelcore= (or movablecore=)" option is set. > Am I right? > Movable memory can be allocated from ZONE_NORMAL on fallback. The reverse is not true: unmovable memory cannot be allocated from ZONE_MOVABLE.