Commit dcb0ac35 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Zheng Zengkai
Browse files

mm: Exclude CDM marked VMAs from auto NUMA

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4JMLR


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: default avatarAnshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: default avatarLijun Fang <fanglijun3@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent ebde394a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -181,6 +181,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 */
extern bool vma_migratable(struct vm_area_struct *vma);

+2 −1
Original line number Diff line number Diff line
@@ -2836,7 +2836,8 @@ static 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;
		}