NUMA.remote may need a new zone to manage memory. Add ZONE_EXTMEM for future using to avoid kabi broken.
Liu Shixin (2): mm: add ZONE_EXTMEM for future extension to avoid kabi broken openeuler_defconfig: enable CONFIG_ZONE_EXTMEM for arm64
arch/arm64/configs/openeuler_defconfig | 1 + include/linux/gfp.h | 13 +++++++++++++ include/linux/mmzone.h | 3 +++ include/trace/events/mmflags.h | 7 +++++++ mm/Kconfig | 13 +++++++++++++ mm/page_alloc.c | 6 ++++++ 6 files changed, 43 insertions(+)
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/4535 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/R...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/4535 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/R...
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I91BZS
--------------------------------
There are many memory media, and some memory is dedicated. To distinguish it from oridinary memory, add new zone_type ZONE_EXTMEM to manage it.
This patch is only for reserving new zone type to avoid kabi broken.
Signed-off-by: Liu Shixin liushixin2@huawei.com --- include/linux/gfp.h | 22 ++++++++++++++-------- include/linux/mmzone.h | 3 +++ include/trace/events/mmflags.h | 7 +++++++ mm/Kconfig | 10 ++++++++++ mm/page_alloc.c | 6 ++++++ 5 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 83a75c7344c3..9a680447c72b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -98,15 +98,21 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) #error GFP_ZONES_SHIFT too large to create GFP_ZONE_TABLE integer #endif
+#if GFP_ZONES_SHIFT >= 3 +#define TABLE_TYPE(X) ((uint64_t)X) +#else +#define TABLE_TYPE(X) X +#endif + #define GFP_ZONE_TABLE ( \ - (ZONE_NORMAL << 0 * GFP_ZONES_SHIFT) \ - | (OPT_ZONE_DMA << ___GFP_DMA * GFP_ZONES_SHIFT) \ - | (OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * GFP_ZONES_SHIFT) \ - | (OPT_ZONE_DMA32 << ___GFP_DMA32 * GFP_ZONES_SHIFT) \ - | (ZONE_NORMAL << ___GFP_MOVABLE * GFP_ZONES_SHIFT) \ - | (OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * GFP_ZONES_SHIFT) \ - | (ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * GFP_ZONES_SHIFT)\ - | (OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * GFP_ZONES_SHIFT)\ + (TABLE_TYPE(ZONE_NORMAL) << 0 * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(OPT_ZONE_DMA) << ___GFP_DMA * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(OPT_ZONE_HIGHMEM) << ___GFP_HIGHMEM * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(OPT_ZONE_DMA32) << ___GFP_DMA32 * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(ZONE_NORMAL) << ___GFP_MOVABLE * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(OPT_ZONE_DMA) << (___GFP_MOVABLE | ___GFP_DMA) * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(ZONE_MOVABLE) << (___GFP_MOVABLE | ___GFP_HIGHMEM) * GFP_ZONES_SHIFT) \ + | (TABLE_TYPE(OPT_ZONE_DMA32) << (___GFP_MOVABLE | ___GFP_DMA32) * GFP_ZONES_SHIFT) \ )
/* diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 40cfd2f0600f..655157b32fa6 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -777,6 +777,9 @@ enum zone_type { * access. */ ZONE_HIGHMEM, +#endif +#ifdef CONFIG_ZONE_EXTMEM + ZONE_EXTMEM, #endif /* * ZONE_MOVABLE is similar to ZONE_NORMAL, except that it contains diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 37962289a7a5..998a5c590325 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -275,11 +275,18 @@ IF_HAVE_VM_USWAP(VM_USWAP, "userswap" ) \ #define IFDEF_ZONE_HIGHMEM(X) #endif
+#ifdef CONFIG_ZONE_EXTMEM +#define IFDEF_ZONE_EXTMEM(X) X +#else +#define IFDEF_ZONE_EXTMEM(X) +#endif + #define ZONE_TYPE \ IFDEF_ZONE_DMA( EM (ZONE_DMA, "DMA")) \ IFDEF_ZONE_DMA32( EM (ZONE_DMA32, "DMA32")) \ EM (ZONE_NORMAL, "Normal") \ IFDEF_ZONE_HIGHMEM( EM (ZONE_HIGHMEM,"HighMem")) \ + IFDEF_ZONE_EXTMEM( EM (ZONE_EXTMEM, "ExtMem")) \ EMe(ZONE_MOVABLE,"Movable")
#define LRU_NAMES \ diff --git a/mm/Kconfig b/mm/Kconfig index 748c774c1c97..c94de6f29082 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1060,6 +1060,16 @@ config ZONE_DEVICE
If FS_DAX is enabled, then say Y.
+config ZONE_EXTMEM + bool "Extension memory hotplug support" + default n + depends on ARM64 + help + Extension memory hotplug support allows for customizing memory + policy such as UB or CXL memory, mirroring memory, etc. + + If unsure, say N. + # # Helpers to mirror range of the CPU page tables of a process into device page # tables. diff --git a/mm/page_alloc.c b/mm/page_alloc.c index da0ac870a3a9..c68eb753d97a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -252,6 +252,9 @@ static int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = { [ZONE_NORMAL] = 32, #ifdef CONFIG_HIGHMEM [ZONE_HIGHMEM] = 0, +#endif +#ifdef CONFIG_ZONE_EXTMEM + [ZONE_EXTMEM] = 0, #endif [ZONE_MOVABLE] = 0, }; @@ -266,6 +269,9 @@ char * const zone_names[MAX_NR_ZONES] = { "Normal", #ifdef CONFIG_HIGHMEM "HighMem", +#endif +#ifdef CONFIG_ZONE_EXTMEM + "ExtMem", #endif "Movable", #ifdef CONFIG_ZONE_DEVICE
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I91BZS
--------------------------------
Set CONFIG_ZONE_EXTMEM=y in arm64 openeuler_defconfig
Signed-off-by: Liu Shixin liushixin2@huawei.com --- arch/arm64/configs/openeuler_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index eb65de2f5a09..a2717f8f5fce 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -1139,6 +1139,7 @@ CONFIG_ARCH_HAS_ZONE_DMA_SET=y CONFIG_ZONE_DMA=y CONFIG_ZONE_DMA32=y CONFIG_ZONE_DEVICE=y +CONFIG_ZONE_EXTMEM=y CONFIG_HMM_MIRROR=y CONFIG_GET_FREE_REGION=y CONFIG_DEVICE_PRIVATE=y