traversing vma on nommu

Hajime Tazaki thehajime at gmail.com
Thu Nov 7 04:12:38 PST 2024


On Thu, 07 Nov 2024 14:47:39 +0900,
Hajime Tazaki wrote:

> On Thu, 07 Nov 2024 14:40:41 +0900,
> Hajime Tazaki wrote:
> 
> > > > We have 32b testing in userspace for the maple tree, and it works.
> > > > maple_tree: 139594121 of 139594121 tests passed
> > > > 
> > > > So at least that much is known to work.
> > > > 
> > > > As you are probably finding out, building a nommu test system is a pain
> > > > (or you probably already know and want to stop doing it and use UML..).
> > > > 
> > > > I'll give my m68k build a go against v6.12-rc6.
> > >
> > > I was able to build 6.12.0-rc6 for m68k nommu (m5208).  It boots and
> > > tests the maple tree fine:
> > > 
> > > TEST STARTING
> > > 
> > > maple_tree: 3808238 of 3808238 tests passed
> > > 
> > > # uname -a
> > > uClinux buildroot 6.12.0-rc6 #2 Wed Nov  6 22:14:42 EST 2024 m68k GNU/Linux
> > 
> > thanks.
> > 
> > I have also tested with riscv64 nommu arch with buildroot but wasn't
> > seeing any issues so far (tested with "ip" command, etc).
> > 
> > ~ # uname -a
> > Linux buildroot 6.12.0-rc2 #1 Wed Nov  6 17:09:21 JST 2024 riscv64 GNU/Linux
> > 
> > I'd also like to test with what you've done: how can I test to
> > generate the message below ?
> > 
> > > maple_tree: 3808238 of 3808238 tests passed
> 
> I managed to test it with "CONFIG_TEST_MAPLE_TREE=y" added to the
> config.
> 
> ```
> TEST STARTING
> 
> maple_tree: 172860277 of 172860277 tests passed
> ```
> 
> looks fine for me.

after adding mt_validate() across various places, I found
vma_iter_clear() in nommu.c triggers this issue on nommu UML.

I'm not totally understanding but if I changed the part with
vma_iter_clear_gfp(), the issue (and validation error reports) are
disappeared.

diff --git a/mm/nommu.c b/mm/nommu.c
index 385b0c15add8..b5c11bbd69de 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -581,7 +581,8 @@ static int delete_vma_from_mm(struct vm_area_struct *vma)
 	cleanup_vma_from_mm(vma);
 
 	/* remove from the MM's tree and list */
-	vma_iter_clear(&vmi);
+	vma_iter_clear_gfp(&vmi, vma->vm_start, vma->vm_end, GFP_KERNEL);
+	mt_validate(&current->mm->mm_mt);
 	return 0;
 }

do you think this is an appropriate fix ?

-- Hajime



More information about the maple-tree mailing list