Skip to content

Commit

Permalink
mm/damon/vaddr-test.h: stop using vma_mas_store() for maple tree store
Browse files Browse the repository at this point in the history
Prepare for the removal of the vma_mas_store() function by open coding the
maple tree store in this test code.  Set the range of the maple state and
call the store function directly.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Liam R. Howlett <[email protected]>
Reported-by: kernel test robot <[email protected]>
Reviewed-by: SeongJae Park <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
howlett authored and akpm00 committed Feb 10, 2023
1 parent 9760ebf commit 34403fa
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mm/damon/vaddr-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,26 @@

#include <kunit/test.h>

static void __link_vmas(struct maple_tree *mt, struct vm_area_struct *vmas,
static int __link_vmas(struct maple_tree *mt, struct vm_area_struct *vmas,
ssize_t nr_vmas)
{
int i;
int i, ret = -ENOMEM;
MA_STATE(mas, mt, 0, 0);

if (!nr_vmas)
return;
return 0;

mas_lock(&mas);
for (i = 0; i < nr_vmas; i++)
vma_mas_store(&vmas[i], &mas);
for (i = 0; i < nr_vmas; i++) {
mas_set_range(&mas, vmas[i].vm_start, vmas[i].vm_end - 1);
if (mas_store_gfp(&mas, &vmas[i], GFP_KERNEL))
goto failed;
}

ret = 0;
failed:
mas_unlock(&mas);
return ret;
}

/*
Expand Down Expand Up @@ -71,7 +78,8 @@ static void damon_test_three_regions_in_vmas(struct kunit *test)
};

mt_init_flags(&mm.mm_mt, MM_MT_FLAGS);
__link_vmas(&mm.mm_mt, vmas, ARRAY_SIZE(vmas));
if (__link_vmas(&mm.mm_mt, vmas, ARRAY_SIZE(vmas)))
kunit_skip(test, "Failed to create VMA tree");

__damon_va_three_regions(&mm, regions);

Expand Down

0 comments on commit 34403fa

Please sign in to comment.