Changes since v9: * Drop the include of "shuffle.h" in mm/memblock.c. This was a missed leftover from the cleanup afforded by the move to page_alloc_init_late() (Mike) * Drop reference to deferred_init_memmap() in the changelog, no longer relevant (Michal) * Clarify mm_shuffle_ctl naming with a code comment (Michal) * Replace per-freearea rand state tracking with global state (Michal) * Move shuffle.h from include/linux/ to mm/. (Andrew) * Mark page_alloc_shuffle() __memint (Andrew) * Drop shuffle_store() since the module parameter is not writable. * Reflow and clarify comments (Andrew) * Make add_to_free_area_random() stub a static inline. (Andrew) * Fix compilation errors on trying to use pfn_valid() as a pfn_present() replacement. Unfortunately this requires a #define rather than a static inline due to header include dependencies (0day kbuild robot) [1]: https://lkml.kernel.org/r/154882453052.1338686.16411162273671426494.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --- Hi Andrew, This addresses all your comments except reworking the shuffling to be dynamically enabled at runtime. I do think that could be useful, but I think it needs to be driven via memory hot-unplug/replug to avoid confusion with the shuffled state of memory relative to existing allocations. I don't think I can turn that around in time for the v5.1 merge window. Otherwise, if you disagree with my "shuffled state relative to active allocations" concern it should be simple enough to enable a best effort shuffle of the current free memory state. Again, though, I'm not sure how useful that is since it can lead to pockets of in-order allocated memory. I went ahead and moved shuffle.h in-tact to mm/. The declaration of page_alloc_shuffle() will eventually need to move to a public location. I expect Keith will take care of that when he hooks up this shuffling with his work-in-progress ACPI HMAT enabling. 0day has been chewing on this version for a few hours with no reports so I think its clean from a build perspective. --- Dan Williams (3): mm: Shuffle initial free memory to improve memory-side-cache utilization mm: Move buddy list manipulations into helpers mm: Maintain randomization of page free lists Documentation/admin-guide/kernel-parameters.txt | 10 + include/linux/list.h | 17 ++ include/linux/mm.h | 3 include/linux/mm_types.h | 3 include/linux/mmzone.h | 59 +++++++ init/Kconfig | 23 +++ mm/Makefile | 7 + mm/compaction.c | 4 mm/memory_hotplug.c | 3 mm/page_alloc.c | 85 +++++----- mm/shuffle.c | 193 +++++++++++++++++++++++ mm/shuffle.h | 64 ++++++++ 12 files changed, 421 insertions(+), 50 deletions(-) create mode 100644 mm/shuffle.c create mode 100644 mm/shuffle.h