mm/vma: next is already retrieved
Subsystems (2)
PATCH 1/1 mm/vma: next is already retrieved
vma_iter_next_rewind() here gets next vma and rewind iterator.
Actually the next vma is already been retrieved to new_vma. Since the iterator is initialized to addr, we don't need to adjust it.
--- mm/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vma.c +1 -1
@@ -1727,7 +1727,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, vmg.vma =NULL ;/* New VMA range. */ vmg.pgoff = pgoff; - vmg.next =vma_iter_next_rewind (&vmi,NULL ); + vmg.next = new_vma; new_vma =vma_merge_new_range (&vmg);if (new_vma) {
Signature · 1 line
2.34.1
Hi Wei,
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
I'm talking about small refactorings and optimisations here - for bugs or major issues - please do, of course, submit immediately.
Quoted 19 lines · Wei Yang
vma_iter_next_rewind()here gets next vma and rewind iterator.Actually the next vma is already been retrieved to
new_vma. Since the iterator is initialized to addr, we don't need to adjust it.Signed-off-by Wei Yang <[email protected]>CC Liam R. Howlett <[email protected]>CC Lorenzo Stoakes <[email protected]>CC Vlastimil Babka <[email protected]>CC Jann Horn <[email protected]>--- mm/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/vma.c +0
-0
mm/vma.c struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, · line 1730
Quoted 5 lines
mm/vma.c +1
-1@@ -1727,7 +1727,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, vmg.vma =NULL ;/* New VMA range. */ vmg.pgoff = pgoff; - vmg.next =vma_iter_next_rewind (&vmi,NULL ); + vmg.next = new_vma;
HOWEVER, this is a good spot and you're right (I mean we explicitly _check_ that the found VMA is after the point at which we intend to insert the new one).
But while we're here, can we fix this HORRIBLE variable naming? We reuse 'new_vma' to refer to the _next_ VMA and newly merged one/one we have to create.
So could you update your code to do something like:
vmg.next = find_vma_prev(mm, addr, &vmg.prev); if (vmg.next && ...
This self-documents your fix, avoids the need for the vma_iter_next_rewind(), fixes the inefficiency you've found, and avoids stupidly overloading what new_vma refers to.
Also update the commit message to refer to this.
And can you update the test_copy_vma() test in tools/testing/vma/vma.c to explicitly test for VMAs that come afterwards both merge and non-merge cases?
It's time to really start taking advantage of this huge power we have to userland test things! :)
Quoted 7 lines
mm/vma.c +0
-1new_vma =vma_merge_new_range (&vmg);if (new_vma) { --2.34.1
Thanks, Lorenzo
Quoted 6 lines · Lorenzo Stoakes
Hi Wei,
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
Sure.
Quoted 33 lines
I'm talking about small refactorings and optimisations here - for bugs or major issues - please do, of course, submit immediately.
Quoted 19 lines · Wei Yang
vma_iter_next_rewind()here gets next vma and rewind iterator.Actually the next vma is already been retrieved to
new_vma. Since the iterator is initialized to addr, we don't need to adjust it.Signed-off-by Wei Yang <[email protected]>CC Liam R. Howlett <[email protected]>CC Lorenzo Stoakes <[email protected]>CC Vlastimil Babka <[email protected]>CC Jann Horn <[email protected]>--- mm/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/vma.c +0
-0mm/vma.c struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, · line 1730
Quoted 5 lines
mm/vma.c +1
-1@@ -1727,7 +1727,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, vmg.vma =NULL ;/* New VMA range. */ vmg.pgoff = pgoff; - vmg.next =vma_iter_next_rewind (&vmi,NULL ); + vmg.next = new_vma;HOWEVER, this is a good spot and you're right (I mean we explicitly _check_ that the found VMA is after the point at which we intend to insert the new one).
Quoted 9 lines
But while we're here, can we fix this HORRIBLE variable naming? We reuse '
new_vma' to refer to the _next_ VMA and newly merged one/one we have to create.So could you update your code to do something like:
vmg.next = find_vma_prev(mm, addr, &vmg.prev); if (vmg.next && ...
Sure. I thought you may prefer a small footprint, so I did current version.
Will update it in next version next year.
Quoted 10 lines
This self-documents your fix, avoids the need for the
vma_iter_next_rewind(), fixes the inefficiency you've found, and avoids stupidly overloading whatnew_vmarefers to.Also update the commit message to refer to this.
And can you update the
test_copy_vma()test intools/testing/vma/vma.cto explicitly test for VMAs that come afterwards both merge and non-merge cases?
Currently we have two scenario with merge/non-merge after copy_vma().
I am not sure what exact case you want to have. Would you mind giving more detail?
Quoted 12 lines
It's time to really start taking advantage of this huge power we have to userland test things! :)
Quoted 7 lines
mm/vma.c +0
-1new_vma =vma_merge_new_range (&vmg);if (new_vma) { --2.34.1
Thanks, Lorenzo
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 9 lines · Wei Yang
Quoted 6 lines · Lorenzo Stoakes
Hi Wei,
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
Sure.
Thanks.
Quoted 3 lines
Quoted 3 lines
I'm talking about small refactorings and optimisations here - for bugs or major issues - please do, of course, submit immediately.
Though if you find any bugs or serious problems, please do report them right away!
Quoted 37 lines
Quoted 37 lines · Wei Yang
Quoted 19 lines
vma_iter_next_rewind()here gets next vma and rewind iterator.Actually the next vma is already been retrieved to
new_vma. Since the iterator is initialized to addr, we don't need to adjust it.Signed-off-by Wei Yang <[email protected]>CC Liam R. Howlett <[email protected]>CC Lorenzo Stoakes <[email protected]>CC Vlastimil Babka <[email protected]>CC Jann Horn <[email protected]>--- mm/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/vma.c +0
-0mm/vma.c struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, · line 1730
Quoted 5 lines
mm/vma.c +1
-1@@ -1727,7 +1727,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, vmg.vma =NULL ;/* New VMA range. */ vmg.pgoff = pgoff; - vmg.next =vma_iter_next_rewind (&vmi,NULL ); + vmg.next = new_vma;HOWEVER, this is a good spot and you're right (I mean we explicitly _check_ that the found VMA is after the point at which we intend to insert the new one).
But while we're here, can we fix this HORRIBLE variable naming? We reuse '
new_vma' to refer to the _next_ VMA and newly merged one/one we have to create.So could you update your code to do something like:
Quoted 7 lines
Quoted 3 lines
vmg.next = find_vma_prev(mm, addr, &vmg.prev); if (vmg.next && ...Sure. I thought you may prefer a small footprint, so I did current version.
Will update it in next version next year.
Thanks!
Quoted 12 lines
Quoted 11 lines
This self-documents your fix, avoids the need for the
vma_iter_next_rewind(), fixes the inefficiency you've found, and avoids stupidly overloading whatnew_vmarefers to.Also update the commit message to refer to this.
And can you update the
test_copy_vma()test intools/testing/vma/vma.cto explicitly test for VMAs that come afterwards both merge and non-merge cases?
Quoted 4 lines
Currently we have two scenario with merge/non-merge after
copy_vma().I am not sure what exact case you want to have. Would you mind giving more detail?
Both please, I don't believe this is curently tested.
It may also be worth testing the 'should never get here' error case.
Quoted 18 lines
Quoted 6 lines
It's time to really start taking advantage of this huge power we have to userland test things! :)
Quoted 2 lines
mm/vma.c +0
-0new_vma =vma_merge_new_range (&vmg);Quoted 7 lines
Quoted 5 lines
mm/vma.c +0
-1if (new_vma) { --2.34.1
Thanks, Lorenzo
--
Wei Yang
Help you, Help me
Quoted 4 lines · Lorenzo Stoakes
Quoted 3 lines · Wei Yang
Quoted 2 lines · Lorenzo Stoakes
Hi Wei,
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
Sure.
Thanks.
Hi, Lorenzo
Is it proper to resend it now?
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 10 lines · Wei Yang
Quoted 9 lines · Lorenzo Stoakes
Quoted 8 lines · Wei Yang
Quoted 6 lines · Lorenzo Stoakes
Hi Wei,
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Sure.
Thanks.
Hi, Lorenzo
Is it proper to resend it now?
Hi Wei,
Would you mind waiting a little longer? Sorry to be a pain but I have a refactoring that I'm going to push through shortly! Otherwise we will clash :)
Cheers, Lorenzo
Quoted 5 lines
--
Wei Yang
Help you, Help me
Quoted 18 lines · Lorenzo Stoakes
Quoted 17 lines · Wei Yang
Quoted 4 lines · Lorenzo Stoakes
Quoted 3 lines · Wei Yang
Quoted 2 lines · Lorenzo Stoakes
Hi Wei,
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
Sure.
Thanks.
Hi, Lorenzo
Quoted 7 lines
Quoted 1 line
Is it proper to resend it now?
Hi Wei,
Would you mind waiting a little longer? Sorry to be a pain but I have a refactoring that I'm going to push through shortly! Otherwise we will clash :)
No problem. Would you mind letting me know when it is ready?
Quoted 8 lines
Cheers, Lorenzo
Quoted 5 lines
--
Wei Yang
Help you, Help me
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 21 lines · Wei Yang
Quoted 20 lines · Lorenzo Stoakes
Quoted 18 lines · Wei Yang
Quoted 4 lines · Lorenzo Stoakes
Quoted 3 lines · Wei Yang
Quoted 2 lines · Lorenzo Stoakes
Hi Wei,
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Thanks for the patch, though I would again ask if you could please stop fiddling around with the VMA stuff until things are a _little_ more settled, perhaps best to leave until the new year?
Sure.
Thanks.
Hi, Lorenzo
Is it proper to resend it now?
Quoted 7 lines
Quoted 5 lines
Hi Wei,
Would you mind waiting a little longer? Sorry to be a pain but I have a refactoring that I'm going to push through shortly! Otherwise we will clash :)
No problem. Would you mind letting me know when it is ready?
Sure will do, once it's taken to unstable then we should be good to revisit. Sorry to be a pain and thank you very much for your understanding!
I am working on this now so shouldn't be long.
Cheers, Lorenzo
Quoted 14 lines
Quoted 9 lines
Cheers, Lorenzo
Quoted 5 lines
--
Wei Yang
Help you, Help me--
Wei Yang
Help you, Help me