On 19 Mar 2026, at 4:19, David Hildenbrand (Arm) wrote: > CONFIG_MEMORY_HOTREMOVE, CONFIG_COMPACTION and CONFIG_CMA all select > CONFIG_MIGRATION, because they require it to work (users). > > Only CONFIG_NUMA_BALANCING and CONFIG_BALLOON_MIGRATION depend on > CONFIG_MIGRATION. CONFIG_BALLOON_MIGRATION is not an actual user, but > an implementation of migration support, so the dependency is correct > (CONFIG_BALLOON_MIGRATION does not make any sense without > CONFIG_MIGRATION). > > However, kconfig-language.rst clearly states "In general use select only > for non-visible symbols". So far CONFIG_MIGRATION is user-visible ... > and the dependencies rather confusing. > > The whole reason why CONFIG_MIGRATION is user-visible is because of > CONFIG_NUMA: some users might want CONFIG_NUMA but not page migration > support. > > Let's clean all that up by introducing a dedicated CONFIG_NUMA_MIGRATION > config option for that purpose only. Make CONFIG_NUMA_BALANCING that so > far depended on CONFIG_NUMA && CONFIG_MIGRATION to depend on > CONFIG_MIGRATION instead. CONFIG_NUMA_MIGRATION will depend on > CONFIG_NUMA && CONFIG_MMU. > > CONFIG_NUMA_MIGRATION is user-visible and will default to "y". We > use that default so new configs will automatically enable it, just > like it was the case with CONFIG_MIGRATION. The downside is that > some configs that used to have CONFIG_MIGRATION=n might get it > re-enabled by CONFIG_NUMA_MIGRATION=y, which shouldn't be a problem. > > CONFIG_MIGRATION is now a non-visible config option. Any code that > select CONFIG_MIGRATION (as before) must depend directly or indirectly > on CONFIG_MMU. > > CONFIG_NUMA_MIGRATION is responsible for any NUMA migration code, which is > mempolicy migration code, memory-tiering code, and move_pages() code in > migrate.c. CONFIG_NUMA_BALANCING uses its functionality. > > Note that this implies that with CONFIG_NUMA_MIGRATION=n, move_pages() will > not be available even though CONFIG_MIGRATION=y, which is an expected > change. > > In migrate.c, we can remove the CONFIG_NUMA check as both > CONFIG_NUMA_MIGRATION and CONFIG_NUMA_BALANCING depend on it. > > With this change, CONFIG_MIGRATION is an internal config, all users of > migration selects CONFIG_MIGRATION, and only CONFIG_BALLOON_MIGRATION > depends on it. > > Signed-off-by: David Hildenbrand (Arm) <[email protected]> > --- > include/linux/memory-tiers.h | 2 +- > init/Kconfig | 2 +- > mm/Kconfig | 26 +++++++++++++------------- > mm/memory-tiers.c | 12 ++++++------ > mm/mempolicy.c | 2 +- > mm/migrate.c | 5 ++--- > 6 files changed, 24 insertions(+), 25 deletions(-) > LGTM.
Acked-by: Zi Yan <[email protected]> Best Regards, Yan, Zi
