Re: [RESEND PATCH v7 1/1] PCI/sysfs: Expose PCIe device serial number

From: Thomas Weißschuh
Date: Wed Sep 17 2025 - 04:53:08 EST


On Wed, Sep 17, 2025 at 05:34:22PM +0900, Krzysztof Wilczyński wrote:

(...)

> > It's a waste of resources to provide a handle just to say the capability
> > doesn't exist when the handle could just not exist instead.
>
> I haven't checked how the kernfs side looks like, admittedly, but I think
> whether an attribute is visible or not, it does not unload and/or de-allocate
> any space for the accompanying kernfs object... So, the resources saving
> here might not be in any way significant.

If I read the sysfs code correctly (create_files() in fs/sysfs/group.c),
the kernfs node should not even be allocated for invisible files.


Thomas