Skip to contentSkip to conversation

mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 3, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/sysfs: avoid call damon_target_has_pid() repeatedly
has been removed from the -mm tree. Its filename was
mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Xin Hao <[email protected]>
Subject: mm/damon/sysfs: avoid call damon_target_has_pid() repeatedly
Date: Thu, 15 Sep 2022 22:22:36 +0800

In damon_sysfs_destroy_targets(), we call damon_target_has_pid() to check whether the 'ctx' include a valid pid, but there no need to call damon_target_has_pid() to check repeatedly, just need call it once.

---

 mm/damon/sysfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/damon/sysfs.c renamed from mm/damon/sysfs.c~mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly +2 -1
@@ -2143,9 +2143,10 @@ static int damon_sysfs_set_attrs(struct
 static void damon_sysfs_destroy_targets(struct damon_ctx *ctx)
 {
 	struct damon_target *t, *next;
+	bool has_pid = damon_target_has_pid(ctx);
 
 	damon_for_each_target_safe(t, next, ctx) {
-		if (damon_target_has_pid(ctx))
+		if (has_pid)
 			put_pid(t->pid);
 		damon_destroy_target(t);
 	}

_

Patches currently in -mm which might be from [email protected] are

mm-damon-move-sz_damon_region-to-damon_sz_region.patch mm-damon-use-damon_sz_region-in-appropriate-place.patch