On Wed, 24 Jun 2020, 孙世龙 sunshilong wrote: > >> Are there still some methods that could be used by the Linux kernel > >> to reduce memory fragmentation while both CONFIG-MIGRATION > >> and CONFIG-COMPACTION are disabled? > > > > > >We do have mobility grouping on pageblock order. > >Also, I think you can use ZONE_MOVABLE without migration and compaction, > >to at least locally limit unmovable fragmentation. > It's a good news. > > Could you please explain that in more detail for me or suggest some documents > for me to go through. > /proc/buddyinfo and /proc/pagetypeinfo will show the various pageblocks on the system. 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. > As per the post(http://lkml.iu.edu/hypermail/linux/kernel/1703.1/06782.html), > I think it's something like ZONE_NORMAL. And I find that > "ZONE_MOVEABLE" is available on Linux-v4.9. > Yes, you can use kernelcore= (or movablecore=) on the kernel command line to set this up: allocations from this zone must have __GFP_MOVABLE so they "should" be migratable. This is typically only useful when CONFIG_COMPACTION is enabled, however, to do that defragmentation work so that higher order memory becomes available. > Is there some potential problems that I should be aware of if I enable > "ZONE_MOVABLE" on real-time system? > Yes, if ZONE_MOVABLE is made too big then you can risk out of memory kills: movable allocations can fallback to ZONE_NORMAL but unmovable allocations cannot graduate to ZONE_MOVABLE. So if ZONE_NORMAL is full (either because you have too much unmovable memory in-use or too much movable fell back to ZONE_NORMAL), and you have more unmovable allocations, you'll get reclaim in ZONE_NORMAL and, at worst case, oom kills.