Skip to contentSkip to conversation

mm/vma: correct legacy comment in vm_[un]lock_anon_vma()

PATCH In review Wei Yang 2 participants 5 messages Apr 1, 2025

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 mm/vma: correct legacy comment in vm_[un]lock_anon_vma()

In commit bf181b9f9d8d ("mm anon rmap: replace same_anon_vma linked list with an interval tree."), the anon_vma.same_anon_vma is replaced by interval tree.

But the related comment is left behind. Correct it here.

Cc Lorenzo Stoakes <[email protected]>
Cc Jann Horn <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Michel Lespinasse <[email protected]>
---
 mm/vma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
mm/vma.c +5 -5
index 5cdc5612bfc1..1a155031f1fb 100644
@@ -1989,16 +1989,16 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma)
 {
 	if (!test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) {
 		/*
-		 * The LSB of head.next can't change from under us
+		 * The LSB of rb_root.rb_node can't change from under us
 		 * because we hold the mm_all_locks_mutex.
 		 */
 		down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_lock);
 		/*
-		 * We can safely modify head.next after taking the
+		 * We can safely modify rb_root.rb_node after taking the
 		 * anon_vma->root->rwsem. If some other vma in this mm shares
 		 * the same anon_vma we won't take it again.
 		 *
-		 * No need of atomic instructions here, head.next
+		 * No need of atomic instructions here, rb_root.rb_node
 		 * can't change from under us thanks to the
 		 * anon_vma->root->rwsem.
 		 */
@@ -2124,14 +2124,14 @@ static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
 {
 	if (test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) {
 		/*
-		 * The LSB of head.next can't change to 0 from under
+		 * The LSB of rb_root.rb_node can't change to 0 from under
 		 * us because we hold the mm_all_locks_mutex.
 		 *
 		 * We must however clear the bitflag before unlocking
 		 * the vma so the users using the anon_vma->rb_root will
 		 * never see our bitflag.
 		 *
-		 * No need of atomic instructions here, head.next
+		 * No need of atomic instructions here, rb_root.rb_node
 		 * can't change from under us until we release the
 		 * anon_vma->root->rwsem.
 		 */
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Wei Yang

In commit bf181b9f9d8d ("mm anon rmap: replace same_anon_vma linked list with an interval tree."), the anon_vma.same_anon_vma is replaced by interval tree.

But the related comment is left behind. Correct it here.

Sorry, but I'd rather we didn't, this is un-useful churn, and I am planning to make fairly wide-ranging alterations to anon_vma going forward, at which point things like this can be addressed if needed.

Also, not to sound mean, but we have repeatedly asked you not to submit these kinds of small 'fix up' patches. This one is relatively benign as it's a comment change only, but previous ones you have made have been directly problematic for us.

So to reiterate - please stop sending patches like this. Core mm is not the place for them.

Thanks!

Quoted 53 lines
Cc Lorenzo Stoakes <[email protected]>
Cc Jann Horn <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Michel Lespinasse <[email protected]>
---
 mm/vma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
mm/vma.c +5 -6
index 5cdc5612bfc1..1a155031f1fb 100644
@@ -1989,16 +1989,16 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma)
 {
 	if (!test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) {
 		/*
-		 * The LSB of head.next can't change from under us
+		 * The LSB of rb_root.rb_node can't change from under us
 		 * because we hold the mm_all_locks_mutex.
 		 */
 		down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_lock);
 		/*
-		 * We can safely modify head.next after taking the
+		 * We can safely modify rb_root.rb_node after taking the
 		 * anon_vma->root->rwsem. If some other vma in this mm shares
 		 * the same anon_vma we won't take it again.
 		 *
-		 * No need of atomic instructions here, head.next
+		 * No need of atomic instructions here, rb_root.rb_node
 		 * can't change from under us thanks to the
 		 * anon_vma->root->rwsem.
 		 */
@@ -2124,14 +2124,14 @@ static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
 {
 	if (test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) {
 		/*
-		 * The LSB of head.next can't change to 0 from under
+		 * The LSB of rb_root.rb_node can't change to 0 from under
 		 * us because we hold the mm_all_locks_mutex.
 		 *
 		 * We must however clear the bitflag before unlocking
 		 * the vma so the users using the anon_vma->rb_root will
 		 * never see our bitflag.
 		 *
-		 * No need of atomic instructions here, head.next
+		 * No need of atomic instructions here, rb_root.rb_node
 		 * can't change from under us until we release the
 		 * anon_vma->root->rwsem.
 		 */
--

2.34.1

author
#2 lore raw
Quoted 5 lines · Lorenzo Stoakes
Quoted 4 lines · Wei Yang

In commit bf181b9f9d8d ("mm anon rmap: replace same_anon_vma linked list with an interval tree."), the anon_vma.same_anon_vma is replaced by interval tree.

Quoted 8 lines
Quoted 3 lines

But the related comment is left behind. Correct it here.

Sorry, but I'd rather we didn't, this is un-useful churn, and I am planning to make fairly wide-ranging alterations to anon_vma going forward, at which point things like this can be addressed if needed.

Would you mind telling more about your plan on anon_vma alteration?

Quoted 63 lines

Also, not to sound mean, but we have repeatedly asked you not to submit these kinds of small 'fix up' patches. This one is relatively benign as it's a comment change only, but previous ones you have made have been directly problematic for us.

So to reiterate - please stop sending patches like this. Core mm is not the place for them.

Thanks!

Quoted 53 lines
Cc Lorenzo Stoakes <[email protected]>
Cc Jann Horn <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Michel Lespinasse <[email protected]>
---
 mm/vma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
mm/vma.c +5 -6
index 5cdc5612bfc1..1a155031f1fb 100644
@@ -1989,16 +1989,16 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma)
 {
 	if (!test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) {
 		/*
-		 * The LSB of head.next can't change from under us
+		 * The LSB of rb_root.rb_node can't change from under us
 		 * because we hold the mm_all_locks_mutex.
 		 */
 		down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_lock);
 		/*
-		 * We can safely modify head.next after taking the
+		 * We can safely modify rb_root.rb_node after taking the
 		 * anon_vma->root->rwsem. If some other vma in this mm shares
 		 * the same anon_vma we won't take it again.
 		 *
-		 * No need of atomic instructions here, head.next
+		 * No need of atomic instructions here, rb_root.rb_node
 		 * can't change from under us thanks to the
 		 * anon_vma->root->rwsem.
 		 */
@@ -2124,14 +2124,14 @@ static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
 {
 	if (test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) {
 		/*
-		 * The LSB of head.next can't change to 0 from under
+		 * The LSB of rb_root.rb_node can't change to 0 from under
 		 * us because we hold the mm_all_locks_mutex.
 		 *
 		 * We must however clear the bitflag before unlocking
 		 * the vma so the users using the anon_vma->rb_root will
 		 * never see our bitflag.
 		 *
-		 * No need of atomic instructions here, head.next
+		 * No need of atomic instructions here, rb_root.rb_node
 		 * can't change from under us until we release the
 		 * anon_vma->root->rwsem.
 		 */
--

2.34.1

Signature · 2 lines
Wei Yang
Help you, Help me
#3 lore raw
Quoted 8 lines · Wei Yang
Quoted 7 lines · Lorenzo Stoakes
Quoted 6 lines · Wei Yang

In commit bf181b9f9d8d ("mm anon rmap: replace same_anon_vma linked list with an interval tree."), the anon_vma.same_anon_vma is replaced by interval tree.

But the related comment is left behind. Correct it here.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Sorry, but I'd rather we didn't, this is un-useful churn, and I am planning to make fairly wide-ranging alterations to anon_vma going forward, at which point things like this can be addressed if needed.

Would you mind telling more about your plan on anon_vma alteration?

Well ultimately finding some means of representing this better _in general_ :)

But you can see some early spring roots of this in the LWN article on my talk at lsf/mm - https://lwn.net/Articles/1015762/

There's a bunch of patches in relation to this, the article links the MREMAP_RELOCATE_ANON stuff but there's also a preparatory patch that improves merging.

I plan to do quite a bit more with all of this.

author
#4 lore raw
Quoted 18 lines · Lorenzo Stoakes
Quoted 8 lines · Wei Yang
Quoted 7 lines · Lorenzo Stoakes
Quoted 6 lines · Wei Yang

In commit bf181b9f9d8d ("mm anon rmap: replace same_anon_vma linked list with an interval tree."), the anon_vma.same_anon_vma is replaced by interval tree.

But the related comment is left behind. Correct it here.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Sorry, but I'd rather we didn't, this is un-useful churn, and I am planning to make fairly wide-ranging alterations to anon_vma going forward, at which point things like this can be addressed if needed.

Would you mind telling more about your plan on anon_vma alteration?

Quoted 9 lines

Well ultimately finding some means of representing this better _in general_ :)

But you can see some early spring roots of this in the LWN article on my talk at lsf/mm - https://lwn.net/Articles/1015762/

There's a bunch of patches in relation to this, the article links the MREMAP_RELOCATE_ANON stuff but there's also a preparatory patch that improves merging.

Thanks for your information. I would take a look.

Quoted 1 line

I plan to do quite a bit more with all of this.

Signature · 2 lines
Wei Yang
Help you, Help me