[PATCH OLK-6.6 0/3] kabi reserve for gmem

From: Ma Wupeng <mawupeng1@huawei.com> Reserve kabi in preparation for gmem. Ma Wupeng (3): mm: gmem: kabi reserve for gmem mm: gmem: Introduce new node state N_HETEROGENEOUS openeuler_defconfig: enable CONFIG_GMEM by default arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + drivers/base/node.c | 6 ++++++ include/linux/device.h | 4 ++++ include/linux/mm.h | 8 ++++++++ include/linux/mm_types.h | 5 +++++ include/linux/nodemask.h | 3 +++ mm/Kconfig | 14 ++++++++++++++ mm/page_alloc.c | 3 +++ 9 files changed, 45 insertions(+) -- 2.25.1

From: Ma Wupeng <mawupeng1@huawei.com> euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8VAVV CVE: NA -------------------------------- Reserve kabi in preparation for gmem. Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> --- include/linux/device.h | 4 ++++ include/linux/mm.h | 8 ++++++++ include/linux/mm_types.h | 5 +++++ mm/Kconfig | 14 ++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 56d93a1ffb7b..f88b261652d5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -31,6 +31,7 @@ #include <linux/device/class.h> #include <linux/device/driver.h> #include <linux/cleanup.h> +#include <linux/kabi.h> #include <asm/device.h> struct device; @@ -805,6 +806,9 @@ struct device { #ifdef CONFIG_DMA_OPS_BYPASS bool dma_ops_bypass : 1; #endif +#ifdef CONFIG_GMEM + KABI_RESERVE(gmem_0) +#endif }; /** diff --git a/include/linux/mm.h b/include/linux/mm.h index 80bacc4da324..af0ac70dd1bc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -327,12 +327,14 @@ extern unsigned int kobjsize(const void *objp); #define VM_HIGH_ARCH_BIT_3 35 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_BIT_4 36 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_BIT_5 37 /* bit only usable on 64-bit architectures */ +#define VM_HIGH_ARCH_BIT_24 56 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_0 BIT(VM_HIGH_ARCH_BIT_0) #define VM_HIGH_ARCH_1 BIT(VM_HIGH_ARCH_BIT_1) #define VM_HIGH_ARCH_2 BIT(VM_HIGH_ARCH_BIT_2) #define VM_HIGH_ARCH_3 BIT(VM_HIGH_ARCH_BIT_3) #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) #define VM_HIGH_ARCH_5 BIT(VM_HIGH_ARCH_BIT_5) +#define VM_HIGH_ARCH_24 BIT(VM_HIGH_ARCH_BIT_24) #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ #ifdef CONFIG_ARCH_HAS_PKEYS @@ -363,6 +365,12 @@ extern unsigned int kobjsize(const void *objp); # define VM_SHADOW_STACK VM_NONE #endif +#ifdef CONFIG_GMEM +#define VM_PEER_SHARED VM_HIGH_ARCH_24 +#else +#define VM_PEER_SHARED VM_NONE +#endif + #if defined(CONFIG_X86) # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ #elif defined(CONFIG_PPC) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 0bc3c7c191a5..354a86c6d2b3 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -19,6 +19,7 @@ #include <linux/workqueue.h> #include <linux/seqlock.h> #include <linux/percpu_counter.h> +#include <linux/kabi.h> #include <asm/mmu.h> @@ -936,6 +937,10 @@ struct mm_struct { #endif /* CONFIG_LRU_GEN */ #ifdef CONFIG_SHARE_POOL struct sp_group_master *sp_group_master; +#endif +#ifdef CONFIG_GMEM + KABI_RESERVE(gmem_0) + KABI_RESERVE(gmem_1) #endif } __randomize_layout; diff --git a/mm/Kconfig b/mm/Kconfig index c277bb069ab7..01e461337495 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1348,6 +1348,20 @@ config CLEAR_FREELIST_PAGE To enable this feature, kernel parameter "clear_freelist" also needs to be added. +config GMEM + bool "generalized memory management for external memory devices" + depends on (ARM64 || X86_64) && MMU && TRANSPARENT_HUGEPAGE + select ARCH_USES_HIGH_VMA_FLAGS + default y + help + Supporting GMEM (generalized memory management) for external memory + devices + + GMEM extends Linux MM to share its machine-independent MM code. Only + high-level interface is provided for device drivers. This prevents + accelerator drivers from reinventing the wheel, but relies on drivers to + implement their hardware-dependent functions declared by GMEM. + source "mm/damon/Kconfig" endmenu -- 2.25.1

From: Ma Wupeng <mawupeng1@huawei.com> euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8VAVV CVE: NA -------------------------------- Introduce new node state N_HETEROGENEOUS to indicate heterogeneous memory devices. Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> --- drivers/base/node.c | 6 ++++++ include/linux/nodemask.h | 3 +++ mm/page_alloc.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/drivers/base/node.c b/drivers/base/node.c index 493d533f8375..aa4d2ca266aa 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -928,6 +928,9 @@ static struct node_attr node_state_attr[] = { [N_CPU] = _NODE_ATTR(has_cpu, N_CPU), [N_GENERIC_INITIATOR] = _NODE_ATTR(has_generic_initiator, N_GENERIC_INITIATOR), +#ifdef CONFIG_GMEM + [N_HETEROGENEOUS] = _NODE_ATTR(has_hetero_memory, N_HETEROGENEOUS), +#endif }; static struct attribute *node_state_attrs[] = { @@ -940,6 +943,9 @@ static struct attribute *node_state_attrs[] = { &node_state_attr[N_MEMORY].attr.attr, &node_state_attr[N_CPU].attr.attr, &node_state_attr[N_GENERIC_INITIATOR].attr.attr, +#ifdef CONFIG_GMEM + &node_state_attr[N_HETEROGENEOUS].attr.attr, +#endif NULL }; diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 8d07116caaf1..56dd145de01f 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -407,6 +407,9 @@ enum node_states { N_MEMORY, /* The node has memory(regular, high, movable) */ N_CPU, /* The node has one or more cpus */ N_GENERIC_INITIATOR, /* The node has one or more Generic Initiators */ +#ifdef CONFIG_GMEM + N_HETEROGENEOUS, /* The node has heterogeneous memory */ +#endif NR_NODE_STATES }; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f5b61c1060d1..ec92406bb68d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -192,6 +192,9 @@ EXPORT_SYMBOL(latent_entropy); nodemask_t node_states[NR_NODE_STATES] __read_mostly = { [N_POSSIBLE] = NODE_MASK_ALL, [N_ONLINE] = { { [0] = 1UL } }, +#ifdef CONFIG_GMEM + [N_HETEROGENEOUS] = NODE_MASK_NONE, +#endif #ifndef CONFIG_NUMA [N_NORMAL_MEMORY] = { { [0] = 1UL } }, #ifdef CONFIG_HIGHMEM -- 2.25.1

From: Ma Wupeng <mawupeng1@huawei.com> euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8VAVV CVE: NA -------------------------------- Enable gmem related configs. Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> --- arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 605b4d5e290e..83adf1803c6c 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -1141,6 +1141,7 @@ CONFIG_LRU_GEN=y CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y CONFIG_PER_VMA_LOCK=y CONFIG_LOCK_MM_AND_FIND_VMA=y +CONFIG_GMEM=y # # Data Access Monitoring diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index 993cce5efd8d..2e892806c680 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -1157,6 +1157,7 @@ CONFIG_LRU_GEN=y CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y CONFIG_PER_VMA_LOCK=y CONFIG_LOCK_MM_AND_FIND_VMA=y +CONFIG_GMEM=y # # Data Access Monitoring -- 2.25.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,转换为PR失败! 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/K... 失败原因:应用补丁/补丁集失败,Patch failed at 0001 mm: gmem: kabi reserve for gmem 建议解决方法:请查看失败原因, 确认补丁是否可以应用在当前期望分支的最新代码上 FeedBack: The patch(es) which you have sent to kernel@openeuler.org has been converted to PR failed! Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/K... Failed Reason: apply patch(es) failed, Patch failed at 0001 mm: gmem: kabi reserve for gmem Suggest Solution: please checkout if the failed patch(es) can work on the newest codes in expected branch
participants (2)
-
patchwork bot
-
Wupeng Ma