linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>, Jann Horn <jannh@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm: rename walk_page_range_mm()
Date: Tue, 11 Nov 2025 08:56:25 +0100	[thread overview]
Message-ID: <66acdf13-a225-4c9b-a29c-9b16079b7e02@suse.cz> (raw)
In-Reply-To: <c684d91464a438d6e31172c9450416a373f10649.1762795245.git.lorenzo.stoakes@oracle.com>

On 11/10/25 18:22, Lorenzo Stoakes wrote:
> Make it clear we're referencing an unsafe variant of this function
> explicitly.
> 
> This is laying the foundation for exposing more such functions and
> maintaining a consistent naming scheme.
> 
> As a part of this change, rename check_ops_valid() to check_ops_safe() for
> consistency.
> 
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/internal.h |  2 +-
>  mm/madvise.c  |  4 ++--
>  mm/pagewalk.c | 22 +++++++++++-----------
>  3 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/mm/internal.h b/mm/internal.h
> index 0af87f6c2889..479234b39394 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -1652,7 +1652,7 @@ static inline void accept_page(struct page *page)
>  #endif /* CONFIG_UNACCEPTED_MEMORY */
>  
>  /* pagewalk.c */
> -int walk_page_range_mm(struct mm_struct *mm, unsigned long start,
> +int walk_page_range_mm_unsafe(struct mm_struct *mm, unsigned long start,
>  		unsigned long end, const struct mm_walk_ops *ops,
>  		void *private);
>  int walk_page_range_debug(struct mm_struct *mm, unsigned long start,
> diff --git a/mm/madvise.c b/mm/madvise.c
> index de918b107cfc..7b938ff44be2 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -1171,8 +1171,8 @@ static long madvise_guard_install(struct madvise_behavior *madv_behavior)
>  		unsigned long nr_pages = 0;
>  
>  		/* Returns < 0 on error, == 0 if success, > 0 if zap needed. */
> -		err = walk_page_range_mm(vma->vm_mm, range->start, range->end,
> -					 &guard_install_walk_ops, &nr_pages);
> +		err = walk_page_range_mm_unsafe(vma->vm_mm, range->start,
> +				range->end, &guard_install_walk_ops, &nr_pages);
>  		if (err < 0)
>  			return err;
>  
> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
> index 6cace2c8814a..ab29b16abd2c 100644
> --- a/mm/pagewalk.c
> +++ b/mm/pagewalk.c
> @@ -452,7 +452,7 @@ static inline void process_vma_walk_lock(struct vm_area_struct *vma,
>   * We usually restrict the ability to install PTEs, but this functionality is
>   * available to internal memory management code and provided in mm/internal.h.
>   */
> -int walk_page_range_mm(struct mm_struct *mm, unsigned long start,
> +int walk_page_range_mm_unsafe(struct mm_struct *mm, unsigned long start,
>  		unsigned long end, const struct mm_walk_ops *ops,
>  		void *private)
>  {
> @@ -518,10 +518,10 @@ int walk_page_range_mm(struct mm_struct *mm, unsigned long start,
>   * This check is performed on all functions which are parameterised by walk
>   * operations and exposed in include/linux/pagewalk.h.
>   *
> - * Internal memory management code can use the walk_page_range_mm() function to
> - * be able to use all page walking operations.
> + * Internal memory management code can use *_unsafe() functions to be able to
> + * use all page walking operations.
>   */
> -static bool check_ops_valid(const struct mm_walk_ops *ops)
> +static bool check_ops_safe(const struct mm_walk_ops *ops)
>  {
>  	/*
>  	 * The installation of PTEs is solely under the control of memory
> @@ -579,10 +579,10 @@ int walk_page_range(struct mm_struct *mm, unsigned long start,
>  		unsigned long end, const struct mm_walk_ops *ops,
>  		void *private)
>  {
> -	if (!check_ops_valid(ops))
> +	if (!check_ops_safe(ops))
>  		return -EINVAL;
>  
> -	return walk_page_range_mm(mm, start, end, ops, private);
> +	return walk_page_range_mm_unsafe(mm, start, end, ops, private);
>  }
>  
>  /**
> @@ -639,7 +639,7 @@ int walk_kernel_page_table_range_lockless(unsigned long start, unsigned long end
>  
>  	if (start >= end)
>  		return -EINVAL;
> -	if (!check_ops_valid(ops))
> +	if (!check_ops_safe(ops))
>  		return -EINVAL;
>  
>  	return walk_pgd_range(start, end, &walk);
> @@ -678,7 +678,7 @@ int walk_page_range_debug(struct mm_struct *mm, unsigned long start,
>  						    pgd, private);
>  	if (start >= end || !walk.mm)
>  		return -EINVAL;
> -	if (!check_ops_valid(ops))
> +	if (!check_ops_safe(ops))
>  		return -EINVAL;
>  
>  	/*
> @@ -709,7 +709,7 @@ int walk_page_range_vma(struct vm_area_struct *vma, unsigned long start,
>  		return -EINVAL;
>  	if (start < vma->vm_start || end > vma->vm_end)
>  		return -EINVAL;
> -	if (!check_ops_valid(ops))
> +	if (!check_ops_safe(ops))
>  		return -EINVAL;
>  
>  	process_mm_walk_lock(walk.mm, ops->walk_lock);
> @@ -729,7 +729,7 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
>  
>  	if (!walk.mm)
>  		return -EINVAL;
> -	if (!check_ops_valid(ops))
> +	if (!check_ops_safe(ops))
>  		return -EINVAL;
>  
>  	process_mm_walk_lock(walk.mm, ops->walk_lock);
> @@ -780,7 +780,7 @@ int walk_page_mapping(struct address_space *mapping, pgoff_t first_index,
>  	unsigned long start_addr, end_addr;
>  	int err = 0;
>  
> -	if (!check_ops_valid(ops))
> +	if (!check_ops_safe(ops))
>  		return -EINVAL;
>  
>  	lockdep_assert_held(&mapping->i_mmap_rwsem);



  parent reply	other threads:[~2025-11-11  7:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 17:22 [PATCH v2 0/2] mm: perform guard region install/remove under VMA lock Lorenzo Stoakes
2025-11-10 17:22 ` [PATCH v2 1/2] mm: rename walk_page_range_mm() Lorenzo Stoakes
2025-11-10 18:27   ` David Hildenbrand (Red Hat)
2025-11-11  7:56   ` Vlastimil Babka [this message]
2025-11-11 17:12   ` Davidlohr Bueso
2025-11-10 17:22 ` [PATCH v2 2/2] mm/madvise: allow guard page install/remove under VMA lock Lorenzo Stoakes
2025-11-10 18:29   ` David Hildenbrand (Red Hat)
2025-11-11  8:12   ` Vlastimil Babka
2025-11-11 17:26   ` Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66acdf13-a225-4c9b-a29c-9b16079b7e02@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox