Skip to content

mm/damon/sysfs: free setup failures generated zombie sub-sub dirs

SeongJae Park damon linux-mm lkml stable 1 version Applied

Status from this message: [merged mm-hotfixes-stable] mm-damon-sysfs-scheme-cleanup-access_pattern-subdirs-on-scheme-dir-setup-failure.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesApplied 4/4

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4mm/damon/sysfs: cleanup intervals subdirs on attrs dir setup failuremm/damon/sysfs.c+3 -10 repliesApplied
2/4mm/damon/sysfs: cleanup attrs subdirs on context dir setup failuremm/damon/sysfs.c+3 -20 repliesApplied
3/4mm/damon/sysfs-scheme: cleanup quotas subdirs on scheme dir setup failuremm/damon/sysfs-schemes.c+3 -20 repliesApplied
4/4mm/damon/sysfs-scheme: cleanup access_pattern subdirs on scheme dir setup failuremm/damon/sysfs-schemes.c+3 -20 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] mm/damon/sysfs: free setup failures generated zombie sub-sub dirs

Some DAMON sysfs directory setup functions generates its sub and sub-sub directories. For example, 'monitoring_attrs/' directory setup creates 'intervals/' and 'intervals/intervals_goal/' directories under 'monitoring_attrs/' directory. When such sub-sub directories are successfully made but followup setup is failed, the setup function should recursively clean up the subdirectories.

However, such setup functions are only dereferencing sub directory reference counters. As a result, under certain setup failures, the
sub-sub directories keep having non-zero reference counters. It means
the directories cannot be removed like zombies, and the memory for the directories cannot be freed.

The user impact of this issue is limited due to the following reasons.

When the issue happens, the zombie directories are still taking the path. Hence attempts to generate the directories again will fail, without additional memory leak. This means the upper bound memory leak is limited. Nonetheless this also implies controlling DAMON with a feature that requires the setup-failed sysfs files will be impossible until the system reboots.

Also, the setup operations are quite simple. The certain failures would hence only rarely happen, and are difficult to artificially trigger.

SeongJae Park (4):
mm/damon/sysfs: cleanup intervals subdirs on attrs dir setup failure mm/damon/sysfs: cleanup attrs subdirs on context dir setup failure mm/damon/sysfs-scheme: cleanup quotas subdirs on scheme dir setup
failure
mm/damon/sysfs-scheme: cleanup access_pattern subdirs on scheme dir
setup failure

 mm/damon/sysfs-schemes.c | 10 ++++++----
 mm/damon/sysfs.c         |  9 ++++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

base-commit: 6d039da6a260dd7919bebc70ebb65d250bb9c24e

Signature · 1 line
2.47.3