
From: Anshuman Khandual <khandual@linux.vnet.ibm.com> ascend inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JMLR CVE: NA ------------------- VMA containing CDM memory should be excluded from KSM merging. This change makes madvise(MADV_MERGEABLE) request on target VMA to be ignored. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Lijun Fang <fanglijun3@huawei.com> Reviewed-by: Weilong Chen <chenweilong@huawei.com> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> --- mm/ksm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/ksm.c b/mm/ksm.c index 25b8362a4f89..582c02058baf 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -38,6 +38,7 @@ #include <linux/freezer.h> #include <linux/oom.h> #include <linux/numa.h> +#include <linux/mempolicy.h> #include <asm/tlbflush.h> #include "internal.h" @@ -2454,6 +2455,11 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start, if (vma_is_dax(vma)) return 0; +#ifdef CONFIG_COHERENT_DEVICE + if (is_cdm_vma(vma)) + return 0; +#endif + #ifdef VM_SAO if (*vm_flags & VM_SAO) return 0; -- 2.20.1