[PATCH] mm: use vma_policy() to get vm_policy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of accessing vma->vm_policy directly, use vma_policy() like
other places for consistency.

Signed-off-by: Shivank Garg <shivankg@xxxxxxx>
---
 ipc/shm.c      |  2 +-
 mm/mempolicy.c | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index 99564c870084..ebd45e48b0d4 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -577,7 +577,7 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
 					unsigned long addr, pgoff_t *ilx)
 {
 	struct shm_file_data *sfd = shm_file_data(vma->vm_file);
-	struct mempolicy *mpol = vma->vm_policy;
+	struct mempolicy *mpol = vma_policy(vma);
 
 	if (sfd->vm_ops->get_policy)
 		mpol = sfd->vm_ops->get_policy(vma, addr, ilx);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index b646fab3e45e..7ccbeb9966f0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -420,7 +420,7 @@ void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
 	mmap_write_lock(mm);
 	for_each_vma(vmi, vma) {
 		vma_start_write(vma);
-		mpol_rebind_policy(vma->vm_policy, new);
+		mpol_rebind_policy(vma_policy(vma), new);
 	}
 	mmap_write_unlock(mm);
 }
@@ -805,8 +805,8 @@ static int vma_replace_policy(struct vm_area_struct *vma,
 			goto err_out;
 	}
 
-	old = vma->vm_policy;
-	vma->vm_policy = new; /* protected by mmap_lock */
+	old = vma_policy(vma);
+	vma_policy(vma) = new; /* protected by mmap_lock */
 	mpol_put(old);
 
 	return 0;
@@ -830,7 +830,7 @@ static int mbind_range(struct vma_iterator *vmi, struct vm_area_struct *vma,
 		vmstart = vma->vm_start;
 	}
 
-	if (mpol_equal(vma->vm_policy, new_pol)) {
+	if (mpol_equal(vma_policy(vma), new_pol)) {
 		*prev = vma;
 		return 0;
 	}
@@ -1797,7 +1797,7 @@ struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
 {
 	*ilx = 0;
 	return (vma->vm_ops && vma->vm_ops->get_policy) ?
-		vma->vm_ops->get_policy(vma, addr, ilx) : vma->vm_policy;
+		vma->vm_ops->get_policy(vma, addr, ilx) : vma_policy(vma);
 }
 
 /*
@@ -1847,7 +1847,7 @@ bool vma_policy_mof(struct vm_area_struct *vma)
 		return ret;
 	}
 
-	pol = vma->vm_policy;
+	pol = vma_policy(vma);
 	if (!pol)
 		pol = get_task_policy(current);
 
@@ -2559,11 +2559,11 @@ unsigned long alloc_pages_bulk_array_mempolicy_noprof(gfp_t gfp,
 
 int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
 {
-	struct mempolicy *pol = mpol_dup(src->vm_policy);
+	struct mempolicy *pol = mpol_dup(vma_policy(src));
 
 	if (IS_ERR(pol))
 		return PTR_ERR(pol);
-	dst->vm_policy = pol;
+	vma_policy(dst) = pol;
 	return 0;
 }
 
-- 
2.34.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux