* [PATCH v4 30/49] mm/damon/vaddr-test.h: Stop using vma_mas_store() for maple tree store
[not found] <20230120162650.984577-1-Liam.Howlett@oracle.com>
@ 2023-01-20 16:26 ` Liam R. Howlett
2023-01-20 17:32 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Liam R. Howlett @ 2023-01-20 16:26 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, maple-tree
Cc: Liam R. Howlett, SeongJae Park, damon, kernel test robot
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.
Cc: SeongJae Park <sj@kernel.org>
Cc: damon@lists.linux.dev
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
mm/damon/vaddr-test.h | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/mm/damon/vaddr-test.h b/mm/damon/vaddr-test.h
index bce37c487540..c4b455b5ee30 100644
--- a/mm/damon/vaddr-test.h
+++ b/mm/damon/vaddr-test.h
@@ -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;
}
/*
@@ -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);
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4 30/49] mm/damon/vaddr-test.h: Stop using vma_mas_store() for maple tree store
2023-01-20 16:26 ` [PATCH v4 30/49] mm/damon/vaddr-test.h: Stop using vma_mas_store() for maple tree store Liam R. Howlett
@ 2023-01-20 17:32 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2023-01-20 17:32 UTC (permalink / raw)
To: Liam R. Howlett
Cc: linux-mm, linux-kernel, Andrew Morton, maple-tree, SeongJae Park,
damon, kernel test robot
Hello Liam,
On Fri, 20 Jan 2023 11:26:31 -0500 "Liam R. Howlett" <Liam.Howlett@oracle.com> wrote:
> 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.
>
> Cc: SeongJae Park <sj@kernel.org>
> Cc: damon@lists.linux.dev
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> mm/damon/vaddr-test.h | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/mm/damon/vaddr-test.h b/mm/damon/vaddr-test.h
> index bce37c487540..c4b455b5ee30 100644
> --- a/mm/damon/vaddr-test.h
> +++ b/mm/damon/vaddr-test.h
> @@ -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;
> }
>
> /*
> @@ -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);
>
> --
> 2.35.1
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-20 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230120162650.984577-1-Liam.Howlett@oracle.com>
2023-01-20 16:26 ` [PATCH v4 30/49] mm/damon/vaddr-test.h: Stop using vma_mas_store() for maple tree store Liam R. Howlett
2023-01-20 17:32 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).