[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260210003801.2834976-1-tjmercier@google.com>
Date: Mon, 9 Feb 2026 16:37:58 -0800
From: "T.J. Mercier" <tjmercier@...gle.com>
To: gregkh@...uxfoundation.org, tj@...nel.org, driver-core@...ts.linux.dev,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org, shuah@...nel.org,
linux-kselftest@...r.kernel.org
Cc: "T.J. Mercier" <tjmercier@...gle.com>
Subject: [PATCH 0/3] kernfs: Add inotify IN_DELETE_SELF, IN_IGNORED support
for files
This series adds support for IN_DELETE_SELF and IN_IGNORED inotify
events to kernfs files.
Currently, kernfs (used by cgroup and others) supports IN_MODIFY events
but fails to notify watchers when the file is removed (e.g. during
cgroup destruction). This forces userspace monitors to maintain resource
intensive side-channels like pidfds, procfs polling, or redundant
directory watches to detect when a cgroup dies and a watched file is
removed.
By generating IN_DELETE_SELF events on destruction, we allow watchers to
rely on a single watch descriptor for the entire lifecycle of the
monitored file, reducing resource usage (file descriptors, CPU cycles)
and complexity in userspace.
The series is structured as follows:
Patch 1 refactors kernfs_elem_attr to support arbitrary event types.
Patch 2 implements the logic to generate DELETE_SELF and IGNORED events
on file removal.
Patch 3 adds selftests to verify the new behavior.
T.J. Mercier (3):
kernfs: allow passing fsnotify event types
kernfs: send IN_DELETE_SELF and IN_IGNORED on file deletion
selftests: memcg: Add tests IN_DELETE_SELF and IN_IGNORED on
memory.events
fs/kernfs/dir.c | 21 +++
fs/kernfs/file.c | 35 ++++-
fs/kernfs/kernfs-internal.h | 3 +
include/linux/kernfs.h | 1 +
.../selftests/cgroup/test_memcontrol.c | 126 ++++++++++++++++++
5 files changed, 179 insertions(+), 7 deletions(-)
base-commit: ba268514ea14b44570030e8ed2aef92a38679e85
--
2.53.0.rc2.204.g2597b5adb4-goog
Powered by blists - more mailing lists