[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170130033602.12275-13-khandual@linux.vnet.ibm.com>
Date: Mon, 30 Jan 2017 09:05:53 +0530
From: Anshuman Khandual <khandual@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: mhocko@...e.com, vbabka@...e.cz, mgorman@...e.de,
minchan@...nel.org, aneesh.kumar@...ux.vnet.ibm.com,
bsingharora@...il.com, srikar@...ux.vnet.ibm.com,
haren@...ux.vnet.ibm.com, jglisse@...hat.com,
dave.hansen@...el.com, dan.j.williams@...el.com
Subject: [RFC V2 12/12] mm: Tag VMA with VM_CDM flag explicitly during mbind(MPOL_BIND)
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@...ux.vnet.ibm.com>
---
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
Powered by blists - more mailing lists