[Some people who received this message don't often get email from lorenzo.stoakes@xxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]Ok, I will update it in next version patch.
On Sun, Aug 25, 2024 at 01:06:40PM GMT, zhiguojiang wrote:
Sorry nack to that idea unless you can provide actual _data_ to demonstrate
在 2024/8/25 0:26, Lorenzo Stoakes 写道:
[Some people who received this message don't often get email from lorenzo.stoakes@xxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]Hi Lorenzo Stoakes,
On Fri, Aug 23, 2024 at 11:02:06PM GMT, Zhiguo Jiang wrote:
After CoWed by do_wp_page, the vma established a new mapping relationshipNACK (until fixed). This is broken (see below).
with the CoWed folio instead of the non-CoWed folio. However, regarding
the situation where vma->anon_vma and the non-CoWed folio's anon_vma are
not same, the avc binding relationship between them will no longer be
needed, so it is issue for the avc binding relationship still existing
between them.
This patch will remove the avc binding relationship between vma and the
non-CoWed folio's anon_vma, which each has their own independent
anon_vma. It can also alleviates rmap overhead simultaneously.
Signed-off-by: Zhiguo Jiang <justinjiang@xxxxxxxx>
Thank you for your comments.
I'm not seeing any numbers to back anything up here as to why we want toI added a debug trace log (as follows) in wp_page_copy() and observed
make changes to this incredibly sensitive code?
that a large number of these orphan avc-objects still exist. I believe
this will have a certain redundant overhead impact on anonymous folios'
rmap avcs, so I want to remove it, which is also the most essential
value of this patch.
an overhead.
And even if you did, given the original patch was so completely broken, and
in such a sensitive area, I'm going to need to be VERY confident you didn't
break anything, so we're going to need tests.
-- the vital part of debug trace patch:Thanks for providing! Will snip for sake of making it easier to reply.
[snip]
Thanks for the explanation, but I was suggesting you have to put this inAlso anon_vma logic is very complicated and confusing, this commit messageIn anon_vma_fork() --> anon_vma_clone(), child vma is bound with parent
feels about 3 paragraphs too light.
Under what circumstances will vma->anon_vma be different from
folio_anon_vma(non_cowed_folio)? etc.
vma's anon_vma firstly.
/*
* First, attach the new VMA to the parent VMA's anon_vmas,
* so rmap can find non-COWed pages in child processes.
*/
error = anon_vma_clone(vma, pvma);
When child vma->anon_vma is NULL in anon_vma_fork(),
/* An existing anon_vma has been reused, all done then. */
if (vma->anon_vma)
return 0;
/* Then add our own anon_vma. */
anon_vma = anon_vma_alloc();
new anon_vma will be alloced and filled in this child vma->anon_vma.
Then during CoWed in do_wp_page() --> wp_page_copy(), this child vma's
new anon_vma will be different from folio_anon_vma(non_cowed_folio).
the commit message rather than in repy to me :)
Ok, I will try to test and update it in next version patch.
[snip]Confusing topics strongly require explanations that help (somewhat)
compensate. This is one of them.
This is again nowhere near detailed enough, and again I'm asking you toI think this will have a certain redundant overhead impact on anonymousindex 93c0c25433d0..4c89cb1cb73eWhat overhead? Worth spelling out for instance if it's unnecessary to
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3428,6 +3428,14 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
* old page will be flushed before it can be reused.
*/
folio_remove_rmap_pte(old_folio, vmf->page, vma);
+
+ /*
+ * If the new_folio's anon_vma is different from the
+ * old_folio's anon_vma, the avc binding relationship
+ * between vma and the old_folio's anon_vma is removed,
+ * avoiding rmap redundant overhead.
traverse avc's.
folios rmap traverse avcs process.
write this _IN THE COMMENT_ not in review.
Yes, I have seen the attachment you provided and thank you very much for
I already understand what you're trying to do (I think the fact I provided
a _working_ version of your patch as an attachment in this thread should
give a clue ;), this is for the benefit of people coming to read this code.
[snip]
Please see the attachment in thread for an example of a working version ofAgain I question the value of this change. Are we REALLY seeing a bigThank you for helping to identify mang issues with this patch. However,
problem due to unneeded avc's hanging around? This is very sensitive,
fiddly, confusing code, do we REALLY want to be playing with it?
I think this will have a certain benefits for anonymous folio rmap
traverse avc overhead.
It'd be good to get some tests though unless you move this to vma.c withThis patch belongs to anon_vma rmap's content, and it seems more
its userland testing (probably a good idea actually as Andrew suggested)
this might be tricky.
appropriate in mm/rmap.c?
NACK until the issues are fixed and the approach at least seems moreThanks
correct.
Zhiguo
this, this is sadly fundamentally broken.
But you're going to really need to sell this a lot better, provide someOk, I will try to do some tests.
numbers, and provide extensive testing and a much, much better test for
this to stand any chance.
You are right, anon_vma code is indeed complex and sensitive.
I appreciate what you're trying to do here, and it's not totally crazy, but
we have to be so, so careful around this code.
anon_vma code is horrendously subtle and confusing (I actually had to
reference my unpublished book to remind myself how this stuff works :)), so
we have to tread very carefully.
I definitely think we need ASCII diagrams if we were to go ahead with a newOk.
version of this. But then again I'm a bit of a fan of ASCII diagrams...
Please cc- me on future revisions of this series, thanks :)