ipc/shm.c | 2 +- mm/mempolicy.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
Instead of accessing vma->vm_policy directly, use vma_policy() like
other places for consistency.
Signed-off-by: Shivank Garg <shivankg@amd.com>
---
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
On Fri, 1 Nov 2024, Shivank Garg wrote: > Instead of accessing vma->vm_policy directly, use vma_policy() like > other places for consistency. > > Signed-off-by: Shivank Garg <shivankg@amd.com> NAK. The vma_policy(vma) wrapper exists to avoid #ifdef CONFIG_NUMAs all over the place; there is no point to it inside CONFIG_NUMA source. Hugh > --- > 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
On Fri, Nov 01, 2024 at 12:37:45AM -0700, Hugh Dickins wrote: > On Fri, 1 Nov 2024, Shivank Garg wrote: > > > Instead of accessing vma->vm_policy directly, use vma_policy() like > > other places for consistency. > > > > Signed-off-by: Shivank Garg <shivankg@amd.com> > > NAK. The vma_policy(vma) wrapper exists to avoid #ifdef CONFIG_NUMAs > all over the place; there is no point to it inside CONFIG_NUMA source. > > Hugh > In that case we should do the opposite of this patch inside mempolicy.c Only 1 place to update ~Gregory diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b858e22b259d..beffdc17aad5 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1572,7 +1572,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le * or MPOL_PREFERRED_MANY we return error. We don't reset * the home node for vmas we already updated before. */ - old = vma_policy(vma); + old = vma->vm_policy; if (!old) { prev = vma; continue;
© 2016 - 2024 Red Hat, Inc.