mm: minor cleanups in rmap
Subsystems (2)
v2 cover mm: minor cleanups in rmap
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(-)
Signature · 1 line
2.25.1
PATCH v2 1/2 mm/rmap: rename page__anon_vma to page_anon_vma for consistency
From: Ye Liu <[email protected]>
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.
--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/rmap.c +4 -4
@@ -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 ); }
Signature · 1 line
2.25.1
Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
Quoted 11 lines · Ye Liu
From: Ye Liu <[email protected]>
Renamed local variable
page__anon_vmainpage_address_in_vma()topage_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 <[email protected]>
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:
Quoted 37 lines
--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)mm/rmap.c +4
-5@@ -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
Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
Quoted 9 lines · Lorenzo Stoakes
Quoted 8 lines · Ye Liu
From: Ye Liu <[email protected]>
Renamed local variable
page__anon_vmainpage_address_in_vma()topage_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.
Quoted 6 lines
Quoted 3 lines
Functionality unchanged.
Signed-off-by Ye Liu <[email protected]>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
Quoted 41 lines
Anyway for avoidance of doubt:
Reviewed-by Lorenzo Stoakes <[email protected]>Quoted 37 lines
--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)mm/rmap.c +4
-5@@ -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
Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
In reply to Ye LiuQuoted 20 lines · Ye Liu
From: Ye Liu <[email protected]>
Renamed local variable
page__anon_vmainpage_address_in_vma()topage_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 <[email protected]>--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)mm/rmap.c +0
-0
mm/rmap.c unsigned long page_address_in_vma(const struct folio *folio, · line 792
Quoted 5 lines
mm/rmap.c +1
-1@@ -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* ?
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
Quoted 16 lines · David Hildenbrand
Quoted 15 lines · Ye Liu
From: Ye Liu <[email protected]>
Renamed local variable
page__anon_vmainpage_address_in_vma()topage_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 <[email protected]>--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 13 lines
mm/rmap.c unsigned long page_address_in_vma(const struct folio *folio, · line 792
Quoted 10 lines
mm/rmap.c +1
-1@@ -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!
Quoted 6 lines
--
Cheers,David / dhildenb
Re: [PATCH v2 1/2] mm/rmap: rename page__anon_vma to page_anon_vma for consistency
Quoted 31 lines · Lorenzo Stoakes
Quoted 16 lines · David Hildenbrand
Quoted 15 lines · Ye Liu
From: Ye Liu <[email protected]>
Renamed local variable
page__anon_vmainpage_address_in_vma()topage_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 <[email protected]>--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Quoted 13 lines
mm/rmap.c unsigned long page_address_in_vma(const struct folio *folio, · line 792
Quoted 10 lines
mm/rmap.c +1
-1@@ -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* ?
Quoted 2 lines
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 :)
Quoted 5 lines
The original patch is strictly an improvement so I'm fine with that, but we could also rename this to
anon_vmato make the function a little simpler to read.
Quoted 8 lines
I guess the key bit where this becomes vaguely relevant is:
vma->anon_vma->root != page_anon_vma->rootThis 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.
Signature · 3 lines
Cheers, David / dhildenb
PATCH v2 2/2 mm/rmap: fix typo in comment in page_address_in_vma
In reply to Ye LiuFrom: Ye Liu <[email protected]>
Fixes a minor typo in the comment above page_address_in_vma():
"responsibililty" → "responsibility"
--- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/rmap.c +1 -1
@@ -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.
Signature · 1 line
2.25.1
Re: [PATCH v2 2/2] mm/rmap: fix typo in comment in page_address_in_vma
Quoted 6 lines · Ye Liu
From: Ye Liu <[email protected]>
Fixes a minor typo in the comment above
page_address_in_vma():
"responsibililty" → "responsibility"Signed-off-by Ye Liu <[email protected]>
Quoted 20 lines
--- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/rmap.c +1
-2@@ -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