lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8169912f-82dc-e210-862c-f6eb092db78d@google.com>
Date: Fri, 1 Nov 2024 00:37:45 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Shivank Garg <shivankg@....com>
cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org, 
    linux-mm@...ck.org
Subject: Re: [PATCH] mm: use vma_policy() to get vm_policy

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@....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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ