linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm: minor cleanups in rmap
@ 2025-04-18  9:55 Ye Liu
  2025-04-18  9:55 ` [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency Ye Liu
  2025-04-18  9:56 ` [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma Ye Liu
  0 siblings, 2 replies; 9+ messages in thread
From: Ye Liu @ 2025-04-18  9:55 UTC (permalink / raw)
  To: akpm, nao.horiguchi, linmiaohe
  Cc: linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, david,
	harry.yoo, riel, vbabka, liuye, ye.liu

Minor cleanups in mm/rmap.c:

- Rename a local variable for consistency
- Fix a typo in a comment

No functional changes.

Changes in v2:
- Dropped the "mm/memory-failure" patch.
- Kept only the uncontroversial rmap cleanups.

Ye Liu (2):
  mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  mm/rmap: fix typo in comment in page_address_in_vma

 mm/rmap.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  2025-04-18  9:55 [PATCH v2 0/2] mm: minor cleanups in rmap Ye Liu
@ 2025-04-18  9:55 ` Ye Liu
  2025-04-18 10:00   ` Lorenzo Stoakes
  2025-04-18 10:40   ` David Hildenbrand
  2025-04-18  9:56 ` [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma Ye Liu
  1 sibling, 2 replies; 9+ messages in thread
From: Ye Liu @ 2025-04-18  9:55 UTC (permalink / raw)
  To: akpm, nao.horiguchi, linmiaohe
  Cc: linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, david,
	harry.yoo, riel, vbabka, liuye, ye.liu

From: Ye Liu <liuye@kylinos.cn>

Renamed local variable page__anon_vma in page_address_in_vma() to
page_anon_vma. The previous naming convention of using double underscores
(__) is unnecessary and inconsistent with typical kernel style, which uses
single underscores to denote local variables. Also updated comments to
reflect the new variable name.

Functionality unchanged.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/rmap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 67bb273dfb80..b509c226e50d 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio *folio,
 		const struct page *page, const struct vm_area_struct *vma)
 {
 	if (folio_test_anon(folio)) {
-		struct anon_vma *page__anon_vma = folio_anon_vma(folio);
+		struct anon_vma *page_anon_vma = folio_anon_vma(folio);
 		/*
 		 * Note: swapoff's unuse_vma() is more efficient with this
 		 * check, and needs it to match anon_vma when KSM is active.
 		 */
-		if (!vma->anon_vma || !page__anon_vma ||
-		    vma->anon_vma->root != page__anon_vma->root)
+		if (!vma->anon_vma || !page_anon_vma ||
+		    vma->anon_vma->root != page_anon_vma->root)
 			return -EFAULT;
 	} else if (!vma->vm_file) {
 		return -EFAULT;
@@ -803,7 +803,7 @@ unsigned long page_address_in_vma(const struct folio *folio,
 		return -EFAULT;
 	}
 
-	/* KSM folios don't reach here because of the !page__anon_vma check */
+	/* KSM folios don't reach here because of the !page_anon_vma check */
 	return vma_address(vma, page_pgoff(folio, page), 1);
 }
 
-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma
  2025-04-18  9:55 [PATCH v2 0/2] mm: minor cleanups in rmap Ye Liu
  2025-04-18  9:55 ` [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency Ye Liu
@ 2025-04-18  9:56 ` Ye Liu
  2025-04-18 10:00   ` Lorenzo Stoakes
  1 sibling, 1 reply; 9+ messages in thread
From: Ye Liu @ 2025-04-18  9:56 UTC (permalink / raw)
  To: akpm, nao.horiguchi, linmiaohe
  Cc: linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, david,
	harry.yoo, riel, vbabka, liuye, ye.liu

From: Ye Liu <liuye@kylinos.cn>

Fixes a minor typo in the comment above page_address_in_vma():
"responsibililty" → "responsibility"

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index b509c226e50d..a9eed8981e18 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -774,7 +774,7 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags)
  * @vma: The VMA we need to know the address in.
  *
  * Calculates the user virtual address of this page in the specified VMA.
- * It is the caller's responsibililty to check the page is actually
+ * It is the caller's responsibility to check the page is actually
  * within the VMA.  There may not currently be a PTE pointing at this
  * page, but if a page fault occurs at this address, this is the page
  * which will be accessed.
-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  2025-04-18  9:55 ` [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency Ye Liu
@ 2025-04-18 10:00   ` Lorenzo Stoakes
  2025-04-18 10:12     ` Ye Liu
  2025-04-18 10:40   ` David Hildenbrand
  1 sibling, 1 reply; 9+ messages in thread
From: Lorenzo Stoakes @ 2025-04-18 10:00 UTC (permalink / raw)
  To: Ye Liu
  Cc: akpm, nao.horiguchi, linmiaohe, linux-kernel, linux-mm,
	Liam.Howlett, david, harry.yoo, riel, vbabka, liuye

On Fri, Apr 18, 2025 at 05:55:59PM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
>
> Renamed local variable page__anon_vma in page_address_in_vma() to
> page_anon_vma. The previous naming convention of using double underscores
> (__) is unnecessary and inconsistent with typical kernel style, which uses
> single underscores to denote local variables. Also updated comments to
> reflect the new variable name.
>
> Functionality unchanged.
>
> Signed-off-by: Ye Liu <liuye@kylinos.cn>

For future reference, if you don't change the patch substantially, it's best
practice to propagate the tags you already received :) that way it should just
get taken!

Anyway for avoidance of doubt:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  mm/rmap.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 67bb273dfb80..b509c226e50d 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio *folio,
>  		const struct page *page, const struct vm_area_struct *vma)
>  {
>  	if (folio_test_anon(folio)) {
> -		struct anon_vma *page__anon_vma = folio_anon_vma(folio);
> +		struct anon_vma *page_anon_vma = folio_anon_vma(folio);
>  		/*
>  		 * Note: swapoff's unuse_vma() is more efficient with this
>  		 * check, and needs it to match anon_vma when KSM is active.
>  		 */
> -		if (!vma->anon_vma || !page__anon_vma ||
> -		    vma->anon_vma->root != page__anon_vma->root)
> +		if (!vma->anon_vma || !page_anon_vma ||
> +		    vma->anon_vma->root != page_anon_vma->root)
>  			return -EFAULT;
>  	} else if (!vma->vm_file) {
>  		return -EFAULT;
> @@ -803,7 +803,7 @@ unsigned long page_address_in_vma(const struct folio *folio,
>  		return -EFAULT;
>  	}
>
> -	/* KSM folios don't reach here because of the !page__anon_vma check */
> +	/* KSM folios don't reach here because of the !page_anon_vma check */
>  	return vma_address(vma, page_pgoff(folio, page), 1);
>  }
>
> --
> 2.25.1
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma
  2025-04-18  9:56 ` [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma Ye Liu
@ 2025-04-18 10:00   ` Lorenzo Stoakes
  0 siblings, 0 replies; 9+ messages in thread
From: Lorenzo Stoakes @ 2025-04-18 10:00 UTC (permalink / raw)
  To: Ye Liu
  Cc: akpm, nao.horiguchi, linmiaohe, linux-kernel, linux-mm,
	Liam.Howlett, david, harry.yoo, riel, vbabka, liuye

On Fri, Apr 18, 2025 at 05:56:00PM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
>
> Fixes a minor typo in the comment above page_address_in_vma():
> "responsibililty" → "responsibility"
>
> Signed-off-by: Ye Liu <liuye@kylinos.cn>

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  mm/rmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index b509c226e50d..a9eed8981e18 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -774,7 +774,7 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags)
>   * @vma: The VMA we need to know the address in.
>   *
>   * Calculates the user virtual address of this page in the specified VMA.
> - * It is the caller's responsibililty to check the page is actually
> + * It is the caller's responsibility to check the page is actually
>   * within the VMA.  There may not currently be a PTE pointing at this
>   * page, but if a page fault occurs at this address, this is the page
>   * which will be accessed.
> --
> 2.25.1
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  2025-04-18 10:00   ` Lorenzo Stoakes
@ 2025-04-18 10:12     ` Ye Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Ye Liu @ 2025-04-18 10:12 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: akpm, nao.horiguchi, linmiaohe, linux-kernel, linux-mm,
	Liam.Howlett, david, harry.yoo, riel, vbabka, liuye

[-- Attachment #1: Type: text/plain, Size: 2293 bytes --]


在 2025/4/18 18:00, Lorenzo Stoakes 写道:
> On Fri, Apr 18, 2025 at 05:55:59PM +0800, Ye Liu wrote:
>> From: Ye Liu <liuye@kylinos.cn>
>>
>> Renamed local variable page__anon_vma in page_address_in_vma() to
>> page_anon_vma. The previous naming convention of using double underscores
>> (__) is unnecessary and inconsistent with typical kernel style, which uses
>> single underscores to denote local variables. Also updated comments to
>> reflect the new variable name.
>>
>> Functionality unchanged.
>>
>> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> For future reference, if you don't change the patch substantially, it's best
> practice to propagate the tags you already received :) that way it should just
> get taken!
Got it, thanks for the tip! I’ll make sure to retain the ACKs and reviewers
if the patch doesn’t change much next time. Appreciate the guidance :)

Thanks,
Ye
> Anyway for avoidance of doubt:
>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
>> ---
>>  mm/rmap.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/mm/rmap.c b/mm/rmap.c
>> index 67bb273dfb80..b509c226e50d 100644
>> --- a/mm/rmap.c
>> +++ b/mm/rmap.c
>> @@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio *folio,
>>  		const struct page *page, const struct vm_area_struct *vma)
>>  {
>>  	if (folio_test_anon(folio)) {
>> -		struct anon_vma *page__anon_vma = folio_anon_vma(folio);
>> +		struct anon_vma *page_anon_vma = folio_anon_vma(folio);
>>  		/*
>>  		 * Note: swapoff's unuse_vma() is more efficient with this
>>  		 * check, and needs it to match anon_vma when KSM is active.
>>  		 */
>> -		if (!vma->anon_vma || !page__anon_vma ||
>> -		    vma->anon_vma->root != page__anon_vma->root)
>> +		if (!vma->anon_vma || !page_anon_vma ||
>> +		    vma->anon_vma->root != page_anon_vma->root)
>>  			return -EFAULT;
>>  	} else if (!vma->vm_file) {
>>  		return -EFAULT;
>> @@ -803,7 +803,7 @@ unsigned long page_address_in_vma(const struct folio *folio,
>>  		return -EFAULT;
>>  	}
>>
>> -	/* KSM folios don't reach here because of the !page__anon_vma check */
>> +	/* KSM folios don't reach here because of the !page_anon_vma check */
>>  	return vma_address(vma, page_pgoff(folio, page), 1);
>>  }
>>
>> --
>> 2.25.1
>>

[-- Attachment #2: Type: text/html, Size: 9544 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  2025-04-18  9:55 ` [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency Ye Liu
  2025-04-18 10:00   ` Lorenzo Stoakes
@ 2025-04-18 10:40   ` David Hildenbrand
  2025-04-18 10:50     ` Lorenzo Stoakes
  1 sibling, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2025-04-18 10:40 UTC (permalink / raw)
  To: Ye Liu, akpm, nao.horiguchi, linmiaohe
  Cc: linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, harry.yoo,
	riel, vbabka, liuye

On 18.04.25 11:55, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> Renamed local variable page__anon_vma in page_address_in_vma() to
> page_anon_vma. The previous naming convention of using double underscores
> (__) is unnecessary and inconsistent with typical kernel style, which uses
> single underscores to denote local variables. Also updated comments to
> reflect the new variable name.
> 
> Functionality unchanged.
> 
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
>   mm/rmap.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 67bb273dfb80..b509c226e50d 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio *folio,
>   		const struct page *page, const struct vm_area_struct *vma)
>   {
>   	if (folio_test_anon(folio)) {
> -		struct anon_vma *page__anon_vma = folio_anon_vma(folio);
> +		struct anon_vma *page_anon_vma = folio_anon_vma(folio);

I'm extremely confused why this should not simply be called "anon_vma". 
Why do we need the "page" in here *at all* ?

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  2025-04-18 10:40   ` David Hildenbrand
@ 2025-04-18 10:50     ` Lorenzo Stoakes
  2025-04-18 10:58       ` David Hildenbrand
  0 siblings, 1 reply; 9+ messages in thread
From: Lorenzo Stoakes @ 2025-04-18 10:50 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Ye Liu, akpm, nao.horiguchi, linmiaohe, linux-kernel, linux-mm,
	Liam.Howlett, harry.yoo, riel, vbabka, liuye

On Fri, Apr 18, 2025 at 12:40:10PM +0200, David Hildenbrand wrote:
> On 18.04.25 11:55, Ye Liu wrote:
> > From: Ye Liu <liuye@kylinos.cn>
> >
> > Renamed local variable page__anon_vma in page_address_in_vma() to
> > page_anon_vma. The previous naming convention of using double underscores
> > (__) is unnecessary and inconsistent with typical kernel style, which uses
> > single underscores to denote local variables. Also updated comments to
> > reflect the new variable name.
> >
> > Functionality unchanged.
> >
> > Signed-off-by: Ye Liu <liuye@kylinos.cn>
> > ---
> >   mm/rmap.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/mm/rmap.c b/mm/rmap.c
> > index 67bb273dfb80..b509c226e50d 100644
> > --- a/mm/rmap.c
> > +++ b/mm/rmap.c
> > @@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio *folio,
> >   		const struct page *page, const struct vm_area_struct *vma)
> >   {
> >   	if (folio_test_anon(folio)) {
> > -		struct anon_vma *page__anon_vma = folio_anon_vma(folio);
> > +		struct anon_vma *page_anon_vma = folio_anon_vma(folio);
>
> I'm extremely confused why this should not simply be called "anon_vma". Why
> do we need the "page" in here *at all* ?

Presumably to differentiate from the VMA's anon_vma, but it seems redundant
and silly to preface it as the page's (really, folio's) anon_vma.

The original patch is strictly an improvement so I'm fine with that, but we
could also rename this to anon_vma to make the function a little simpler to
read.

I guess the key bit where this becomes vaguely relevant is:

		    vma->anon_vma->root != page_anon_vma->root

This whole thing seems to be to deal with races with unuse_vma() as per the
comment.

Anyway, TL;DR: fine with that rename if we want it!

>
> --
> Cheers,
>
> David / dhildenb
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
  2025-04-18 10:50     ` Lorenzo Stoakes
@ 2025-04-18 10:58       ` David Hildenbrand
  0 siblings, 0 replies; 9+ messages in thread
From: David Hildenbrand @ 2025-04-18 10:58 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Ye Liu, akpm, nao.horiguchi, linmiaohe, linux-kernel, linux-mm,
	Liam.Howlett, harry.yoo, riel, vbabka, liuye

On 18.04.25 12:50, Lorenzo Stoakes wrote:
> On Fri, Apr 18, 2025 at 12:40:10PM +0200, David Hildenbrand wrote:
>> On 18.04.25 11:55, Ye Liu wrote:
>>> From: Ye Liu <liuye@kylinos.cn>
>>>
>>> Renamed local variable page__anon_vma in page_address_in_vma() to
>>> page_anon_vma. The previous naming convention of using double underscores
>>> (__) is unnecessary and inconsistent with typical kernel style, which uses
>>> single underscores to denote local variables. Also updated comments to
>>> reflect the new variable name.
>>>
>>> Functionality unchanged.
>>>
>>> Signed-off-by: Ye Liu <liuye@kylinos.cn>
>>> ---
>>>    mm/rmap.c | 8 ++++----
>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/mm/rmap.c b/mm/rmap.c
>>> index 67bb273dfb80..b509c226e50d 100644
>>> --- a/mm/rmap.c
>>> +++ b/mm/rmap.c
>>> @@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio *folio,
>>>    		const struct page *page, const struct vm_area_struct *vma)
>>>    {
>>>    	if (folio_test_anon(folio)) {
>>> -		struct anon_vma *page__anon_vma = folio_anon_vma(folio);
>>> +		struct anon_vma *page_anon_vma = folio_anon_vma(folio);
>>
>> I'm extremely confused why this should not simply be called "anon_vma". Why
>> do we need the "page" in here *at all* ?
> 
> Presumably to differentiate from the VMA's anon_vma, but it seems redundant
> and silly to preface it as the page's (really, folio's) anon_vma.

Exactly, thus my confusion :)

> 
> The original patch is strictly an improvement so I'm fine with that, but we
> could also rename this to anon_vma to make the function a little simpler to
> read.
> 
> I guess the key bit where this becomes vaguely relevant is:
> 
> 		    vma->anon_vma->root != page_anon_vma->root
> 
> This whole thing seems to be to deal with races with unuse_vma() as per the
> comment.
> 
> Anyway, TL;DR: fine with that rename if we want it!

Okay, let's drop the "page_" part if possible.

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-04-18 10:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-18  9:55 [PATCH v2 0/2] mm: minor cleanups in rmap Ye Liu
2025-04-18  9:55 ` [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency Ye Liu
2025-04-18 10:00   ` Lorenzo Stoakes
2025-04-18 10:12     ` Ye Liu
2025-04-18 10:40   ` David Hildenbrand
2025-04-18 10:50     ` Lorenzo Stoakes
2025-04-18 10:58       ` David Hildenbrand
2025-04-18  9:56 ` [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma Ye Liu
2025-04-18 10:00   ` Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox