From 90cd24b6e1dc17ca043473f637dd91f43b04c8a1 Mon Sep 17 00:00:00 2001 From: Anshuman Khandual Date: Mon, 13 May 2019 22:39:39 +0800 Subject: [PATCH] mm: Exclude CDM marked VMAs from auto NUMA euler inclusion category: feature bugzilla: 11082 CVE: NA ------------------- Kernel cannot track device memory accesses behind VMAs containing CDM memory. Hence all the VM_CDM marked VMAs should not be part of the auto NUMA migration scheme. This patch also adds a new function is_cdm_vma() to detect any VMA marked with flag VM_CDM. Signed-off-by: Anshuman Khandual Signed-off-by: zhong jiang Signed-off-by: Lijun Fang Reviewed-by: zhong jiang Signed-off-by: Yang Yingliang --- include/linux/mempolicy.h | 14 ++++++++++++++ kernel/sched/fair.c | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 5228c62af416..00437ae80b6f 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -172,6 +172,20 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol); extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); +#ifdef CONFIG_COHERENT_DEVICE +static inline bool is_cdm_vma(struct vm_area_struct *vma) +{ + if (vma->vm_flags & VM_CDM) + return true; + return false; +} +#else +static inline bool is_cdm_vma(struct vm_area_struct *vma) +{ + return false; +} +#endif + /* Check if a vma is migratable */ static inline bool vma_migratable(struct vm_area_struct *vma) { diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 87dc36f7800d..f6c9a8a168c9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2560,7 +2560,8 @@ void task_numa_work(struct callback_head *work) } for (; vma; vma = vma->vm_next) { if (!vma_migratable(vma) || !vma_policy_mof(vma) || - is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_MIXEDMAP)) { + is_vm_hugetlb_page(vma) || is_cdm_vma(vma) || + (vma->vm_flags & VM_MIXEDMAP)) { continue; } -- GitLab