mm-damon-remove-the-target-id-concept.patch removed from -mm tree
The patch titled
Subject: mm/damon: remove the target id concept
has been removed from the -mm tree. Its filename was
mm-damon-remove-the-target-id-concept.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon: remove the target id concept
DAMON asks each monitoring target ('struct damon_target') to have one 'unsigned long' integer called 'id', which should be unique among the targets of same monitoring context. Meaning of it is, however, totally up to the monitoring primitives that registered to the monitoring context. For example, the virtual address spaces monitoring primitives treats the id as a 'struct pid' pointer.
This makes the code flexible, but ugly, not well-documented, and type-unsafe[1]. Also, identification of each target can be done via its index. For the reason, this commit removes the concept and uses clear type definition. For now, only 'struct pid' pointer is used for the virtual address spaces monitoring. If DAMON is extended in future so that we need to put another identifier field in the struct, we will use a union for such primitives-dependent fields and document which primitives are using which type.
[1] https://lore.kernel.org/linux-mm/[email protected]/
---
include/linux/damon.h | 11 +- mm/damon/core-test.h | 18 ++-- mm/damon/core.c | 4 - mm/damon/dbgfs-test.h | 63 +++++----------- mm/damon/dbgfs.c | 152 +++++++++++++++++++++++----------------- mm/damon/reclaim.c | 3 mm/damon/vaddr-test.h | 6 - mm/damon/vaddr.c | 4 - 8 files changed, 133 insertions(+), 128 deletions(-)
include/linux/damon.h renamed from include/linux/damon.h~mm-damon-remove-the-target-id-concept +5 -6
@@ -60,19 +60,18 @@ struct damon_region {/** * struct damon_target - Represents a monitoring target. -* @id: Unique identifier for this target. +* @pid: The PID of the virtual address space to monitor. * @nr_regions: Number of monitoring target regions of this target. * @regions_list: Head of the monitoring target regions of this target. * @list: List head for siblings. * * Each monitoring context could have multiple targets. For example, a context * for virtual memory address spaces could have multiple target processes. The -* @id of each target should be unique among the targets of the context. For -* example, in the virtual address monitoring context, it could be a pidfd or -* an address of an mm_struct. +* @pid should be set for appropriate address space monitoring primitives +* including the virtual address spaces monitoring primitives. */ struct damon_target { -unsigned long id; +struct pid *pid;unsigned int nr_regions;struct list_head regions_list;struct list_head list;
@@ -475,7 +474,7 @@ struct damos *damon_new_scheme(void damon_add_scheme (struct damon_ctx *ctx,struct damos *s);void damon_destroy_scheme (struct damos *s); -struct damon_target *damon_new_target (unsigned long id); +struct damon_target *damon_new_target (void );void damon_add_target (struct damon_ctx *ctx,struct damon_target *t);bool damon_targets_empty (struct damon_ctx *ctx);void damon_free_target (struct damon_target *t);
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-remove-the-target-id-concept +2 -2
@@ -144,7 +144,7 @@ void damon_destroy_scheme(struct damos ** * Returns the pointer to the new struct if success, or NULL otherwise */ -struct damon_target *damon_new_target (unsigned long id) +struct damon_target *damon_new_target (void ) {struct damon_target *t;
@@ -152,7 +152,7 @@ struct damon_target *damon_new_target(unif (!t)return NULL ; - t->id = id; + t->pid =NULL ; t->nr_regions =0 ;INIT_LIST_HEAD (&t->regions_list);
mm/damon/core-test.h renamed from mm/damon/core-test.h~mm-damon-remove-the-target-id-concept +8 -10
@@ -24,7 +24,7 @@ static void damon_test_regions(struct kuKUNIT_EXPECT_EQ (test,2ul , r->ar.end);KUNIT_EXPECT_EQ (test,0u , r->nr_accesses); - t =damon_new_target (42 ); + t =damon_new_target ();KUNIT_EXPECT_EQ (test,0u ,damon_nr_regions (t));damon_add_region (r, t);
@@ -52,8 +52,7 @@ static void damon_test_target(struct kunstruct damon_ctx *c =damon_new_ctx ();struct damon_target *t; - t =damon_new_target (42 ); -KUNIT_EXPECT_EQ (test,42ul , t->id); + t =damon_new_target ();KUNIT_EXPECT_EQ (test,0u ,nr_damon_targets (c));damon_add_target (c, t);
@@ -78,7 +77,6 @@ static void damon_test_target(struct kunstatic void damon_test_aggregate (struct kunit *test) {struct damon_ctx *ctx =damon_new_ctx (); -unsigned long target_ids[] = {1 ,2 ,3 };unsigned long saddr[][3 ] = {{10 ,20 ,30 }, {5 ,42 ,49 }, {13 ,33 ,55 } };unsigned long eaddr[][3 ] = {{15 ,27 ,40 }, {31 ,45 ,55 }, {23 ,44 ,66 } };unsigned long accesses[][3 ] = {{42 ,95 ,84 }, {10 ,20 ,30 }, {0 ,1 ,2 } };
@@ -87,7 +85,7 @@ static void damon_test_aggregate(structint it, ir;for (it =0 ; it <3 ; it++) { - t =damon_new_target (target_ids[it]); + t =damon_new_target ();damon_add_target (ctx, t); }
@@ -125,7 +123,7 @@ static void damon_test_split_at(struct kstruct damon_target *t;struct damon_region *r; - t =damon_new_target (42 ); + t =damon_new_target (); r =damon_new_region (0 ,100 );damon_add_region (r, t);damon_split_region_at (c, t, r,25 );
@@ -146,7 +144,7 @@ static void damon_test_merge_two(structstruct damon_region *r, *r2, *r3;int i; - t =damon_new_target (42 ); + t =damon_new_target (); r =damon_new_region (0 ,100 ); r->nr_accesses =10 ;damon_add_region (r, t);
@@ -194,7 +192,7 @@ static void damon_test_merge_regions_of(unsigned long eaddrs[] = {112 ,130 ,156 ,170 ,230 };int i; - t =damon_new_target (42 ); + t =damon_new_target ();for (i =0 ; i <ARRAY_SIZE (sa); i++) { r =damon_new_region (sa[i], ea[i]); r->nr_accesses = nrs[i];
@@ -218,14 +216,14 @@ static void damon_test_split_regions_of(struct damon_target *t;struct damon_region *r; - t =damon_new_target (42 ); + t =damon_new_target (); r =damon_new_region (0 ,22 );damon_add_region (r, t);damon_split_regions_of (c, t,2 );KUNIT_EXPECT_LE (test,damon_nr_regions (t),2u );damon_free_target (t); - t =damon_new_target (42 ); + t =damon_new_target (); r =damon_new_region (0 ,220 );damon_add_region (r, t);damon_split_regions_of (c, t,4 );
mm/damon/dbgfs.c renamed from mm/damon/dbgfs.c~mm-damon-remove-the-target-id-concept +90 -62
263 lines not on this page · raw message
mm/damon/dbgfs-test.h renamed from mm/damon/dbgfs-test.h~mm-damon-remove-the-target-id-concept +22 -41
144 lines not on this page · raw message
mm/damon/reclaim.c renamed from mm/damon/reclaim.c~mm-damon-remove-the-target-id-concept +1 -2
@@ -387,8 +387,7 @@ static int __init damon_reclaim_init(voidamon_pa_set_primitives (ctx); ctx->callback.after_aggregation = damon_reclaim_after_aggregation; -/* 4242 means nothing but fun */ - target =damon_new_target (4242 ); + target =damon_new_target ();if (!target) {damon_destroy_ctx (ctx);return -ENOMEM ;
mm/damon/vaddr.c renamed from mm/damon/vaddr.c~mm-damon-remove-the-target-id-concept +2 -2
@@ -23,12 +23,12 @@#endif /* -* 't->id' should be the pointer to the relevant 'struct pid' having reference +* 't->pid' should be the pointer to the relevant 'struct pid' having reference * count. Caller must put the returned task, unless it is NULL. */ static inline struct task_struct *damon_get_task_struct (struct damon_target *t) { -return get_pid_task ((struct pid *)t->id,PIDTYPE_PID ); +return get_pid_task (t->pid,PIDTYPE_PID ); }/*
mm/damon/vaddr-test.h renamed from mm/damon/vaddr-test.h~mm-damon-remove-the-target-id-concept +3 -3
@@ -139,7 +139,7 @@ static void damon_do_test_apply_three_restruct damon_region *r;int i; - t =damon_new_target (42 ); + t =damon_new_target ();for (i =0 ; i < nr_regions /2 ; i++) { r =damon_new_region (regions[i *2 ], regions[i *2 +1 ]);damon_add_region (r, t);
@@ -251,7 +251,7 @@ static void damon_test_apply_three_regiostatic void damon_test_split_evenly_fail (struct kunit *test,unsigned long start,unsigned long end,unsigned int nr_pieces) { -struct damon_target *t =damon_new_target (42 ); +struct damon_target *t =damon_new_target ();struct damon_region *r =damon_new_region (start, end);damon_add_region (r, t);
@@ -270,7 +270,7 @@ static void damon_test_split_evenly_failstatic void damon_test_split_evenly_succ (struct kunit *test,unsigned long start,unsigned long end,unsigned int nr_pieces) { -struct damon_target *t =damon_new_target (42 ); +struct damon_target *t =damon_new_target ();struct damon_region *r =damon_new_region (start, end);unsigned long expected_width = (end - start) / nr_pieces;unsigned long i =0 ;
_
Patches currently in -mm which might be from [email protected] are