Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/sysfs: remove damon_sysfs_destroy_targets()

The function was introduced for putting pids and deallocating unnecessary
targets. Hence it is called before damon_destroy_ctx(). Now vaddr puts
pid for each target destruction (cleanup_target()). damon_destroy_ctx()
deallocates the targets anyway. So damon_sysfs_destroy_targets() has no
reason to exist. Remove it.

Link: https://lkml.kernel.org/r/20250712195016.151108-12-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
f59ae147 ff01aba6

+3 -20
+3 -20
mm/damon/sysfs.c
··· 1295 1295 return damon_set_attrs(ctx, &attrs); 1296 1296 } 1297 1297 1298 - static void damon_sysfs_destroy_targets(struct damon_ctx *ctx) 1299 - { 1300 - struct damon_target *t, *next; 1301 - 1302 - damon_for_each_target_safe(t, next, ctx) 1303 - damon_destroy_target(t, ctx); 1304 - } 1305 - 1306 1298 static int damon_sysfs_set_regions(struct damon_target *t, 1307 1299 struct damon_sysfs_regions *sysfs_regions) 1308 1300 { ··· 1329 1337 struct damon_ctx *ctx) 1330 1338 { 1331 1339 struct damon_target *t = damon_new_target(); 1332 - int err = -EINVAL; 1333 1340 1334 1341 if (!t) 1335 1342 return -ENOMEM; ··· 1336 1345 if (damon_target_has_pid(ctx)) { 1337 1346 t->pid = find_get_pid(sys_target->pid); 1338 1347 if (!t->pid) 1339 - goto destroy_targets_out; 1348 + /* caller will destroy targets */ 1349 + return -EINVAL; 1340 1350 } 1341 - err = damon_sysfs_set_regions(t, sys_target->regions); 1342 - if (err) 1343 - goto destroy_targets_out; 1344 - return 0; 1345 - 1346 - destroy_targets_out: 1347 - damon_sysfs_destroy_targets(ctx); 1348 - return err; 1351 + return damon_sysfs_set_regions(t, sys_target->regions); 1349 1352 } 1350 1353 1351 1354 static int damon_sysfs_add_targets(struct damon_ctx *ctx, ··· 1443 1458 test_ctx = damon_new_ctx(); 1444 1459 err = damon_commit_ctx(test_ctx, param_ctx); 1445 1460 if (err) { 1446 - damon_sysfs_destroy_targets(test_ctx); 1447 1461 damon_destroy_ctx(test_ctx); 1448 1462 goto out; 1449 1463 } 1450 1464 err = damon_commit_ctx(kdamond->damon_ctx, param_ctx); 1451 1465 out: 1452 - damon_sysfs_destroy_targets(param_ctx); 1453 1466 damon_destroy_ctx(param_ctx); 1454 1467 return err; 1455 1468 }