Skip to contentSkip to conversation

mm/damon: Simply damon_ctx check in damon_sysfs_before_terminate

PATCH Applied Xin Hao 2 participants 2 messages Sep 7, 2022

Subsystems (2)

v1 of 2 Applied 1/1 Latest is v2 →

lore
Share & tools
lore

Xin Hao

author
#0 lore raw

PATCH 1/1 mm/damon: Simply damon_ctx check in damon_sysfs_before_terminate

In damon_sysfs_before_terminate() func, it need to check whether ctx->ops.id supports 'DAMON_OPS_VADDR' or 'DAMON_OPS_FVADDR', there we can use damon_target_has_pid() instead.

---
 mm/damon/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs.c +1 -1
index 7488e27c87c3..88f208ff235d 100644
@@ -2309,7 +2309,7 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
 {
 	struct damon_target *t, *next;
 
-	if (ctx->ops.id != DAMON_OPS_VADDR && ctx->ops.id != DAMON_OPS_FVADDR)
+	if (!damon_target_has_pid(ctx))
 		return;
 
 	mutex_lock(&ctx->kdamond_lock);
Signature · 1 line
2.31.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Xin,

Nit: I'd suggest to 's/Simply/simplify/' in the subject.

Quoted 5 lines · On Wed, 7 Sep 2022 16:41:16 +0800 Xin Hao <[email protected]> wrote:

In damon_sysfs_before_terminate() func, it need to check whether ctx->ops.id supports 'DAMON_OPS_VADDR' or 'DAMON_OPS_FVADDR', there we can use damon_target_has_pid() instead.

Other than the above trivial nit,

Thanks,
SJ

Quoted 19 lines
---
 mm/damon/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs.c +1 -1
index 7488e27c87c3..88f208ff235d 100644
@@ -2309,7 +2309,7 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
 {
 	struct damon_target *t, *next;
 
-	if (ctx->ops.id != DAMON_OPS_VADDR && ctx->ops.id != DAMON_OPS_FVADDR)
+	if (!damon_target_has_pid(ctx))
 		return;
 
 	mutex_lock(&ctx->kdamond_lock);
Signature · 1 line
2.31.0