From: "T.J. Mercier" <tjmercier@google.com>
To: gregkh@linuxfoundation.org, tj@kernel.org,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org
Cc: "T.J. Mercier" <tjmercier@google.com>
Subject: [PATCH 0/3] kernfs: Add inotify IN_DELETE_SELF, IN_IGNORED support for files
Date: Mon, 9 Feb 2026 16:37:58 -0800 [thread overview]
Message-ID: <20260210003801.2834976-1-tjmercier@google.com> (raw)
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
next reply other threads:[~2026-02-10 0:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 0:37 T.J. Mercier [this message]
2026-02-10 0:37 ` [PATCH 1/3] kernfs: allow passing fsnotify event types T.J. Mercier
2026-02-10 0:38 ` [PATCH 2/3] kernfs: send IN_DELETE_SELF and IN_IGNORED on file deletion T.J. Mercier
2026-02-10 22:42 ` Tejun Heo
2026-02-10 22:48 ` T.J. Mercier
2026-02-10 0:38 ` [PATCH 3/3] selftests: memcg: Add tests IN_DELETE_SELF and IN_IGNORED on memory.events T.J. Mercier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260210003801.2834976-1-tjmercier@google.com \
--to=tjmercier@google.com \
--cc=cgroups@vger.kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox