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 <khandual@xxxxxxxxxxxxxxxxxx> --- 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 5f4d828..ff0c6bc 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 6559d19..523508c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2482,7 +2482,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; } -- 2.9.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>