Mark all the applicable VMAs with VM_CDM explicitly during mbind(MPOL_BIND) call if the user provided nodemask has a CDM node. Signed-off-by: Anshuman Khandual <khandual@xxxxxxxxxxxxxxxxxx> --- mm/mempolicy.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 78e095b..4482140 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -175,6 +175,16 @@ static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig, } #ifdef CONFIG_COHERENT_DEVICE +static inline void set_vm_cdm(struct vm_area_struct *vma) +{ + vma->vm_flags |= VM_CDM; +} + +static inline void clr_vm_cdm(struct vm_area_struct *vma) +{ + vma->vm_flags &= ~VM_CDM; +} + static void mark_vma_cdm(nodemask_t *nmask, struct page *page, struct vm_area_struct *vma) { @@ -191,6 +201,9 @@ static void mark_vma_cdm(nodemask_t *nmask, vma->vm_flags |= VM_CDM; } #else +static inline void set_vm_cdm(struct vm_area_struct *vma) { } +static inline void clr_vm_cdm(struct vm_area_struct *vma) { } + static void mark_vma_cdm(nodemask_t *nmask, struct page *page, struct vm_area_struct *vma) { @@ -770,6 +783,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, vmstart = max(start, vma->vm_start); vmend = min(end, vma->vm_end); + if ((new_pol->mode == MPOL_BIND) + && nodemask_has_cdm(new_pol->v.nodes)) + set_vm_cdm(vma); + if (mpol_equal(vma_policy(vma), new_pol)) 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>