[PATCH RESEND v2 05/23] proc: keep the open files of an entry in an open node

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Nov 5 11:35:22 PST 2026


> procfs remembers the open files of an entry that has a ->proc_release(),
> so that it can call the release hook when the entry is removed while
> files are still open. The list head for that and the lock that protects
> it sit in every struct proc_dir_entry, for the few entries that need
> them, and the next patches want to keep more there, the vm_operations
> of an entry's mappings for a start.
> 
> Move the list into a struct pde_open_node that only those entries get.
> It is allocated when the entry is registered, whether an entry needs
> one follows from its proc_ops, and freed with the entry. So ->open is
> constant for the life of an entry, nothing has to look it up or pin it,
> and the removal path stays what it is. kernfs allocates its
> kernfs_open_node on the first open instead, but there every attribute
> can be polled and so every one of them would need one. In procfs the
> entries that need the node are the exception. Permanent entries don't
> get one, they are never removed, so their release hook only ever runs
> when a file is closed.
> 
> The spinlock stays in the entry and now protects what hangs off ->open.
> Moving it behind the gid fills a hole, so struct proc_dir_entry shrinks
> from 160 to 144 bytes on x86_64 here, and it ends up at 160 bytes at
> the end of this series instead of the 184 it would have grown to with
> the read and write limits and the vm_operations of its mappings in it.
> That keeps 32 bytes of inline name instead of 8. 34 of the 68 /proc/net
> names a network namespace gets are longer than 7 characters.
> 
> No functional changes.
> 
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261104-work-procfs-core-v2-0-76ace653a773@kernel.org?part=5




More information about the kexec mailing list