Re: [PATCH 5/6] kernfs: update a directory's times without kernfs_iattr_rwsem
From: Tejun Heo
Date: Thu Dec 03 2026 - 11:56:22 EST
Hello, Jori.
On Thu, Dec 03, 2026 at 03:29:27PM +0100, Jori Koolstra wrote:
> I know this is not a change in behavior, but what is the reason we start
> to care about the a/c/mtime only after we have done a setattr. I understand
> that kernfs wants to be very stingy on memory use, but why not leave it out
> all together then? Is there anything that needs those times only when the
> attrs are not default?
I think it's historic. sysfs started out with a full inode for each node
and then got whittled down to sysfs_dirent, now kernfs_node, which is a lot
smaller. The separate iattrs allocation was a way to keep the behavior
unchanged as much as possible.
I don't know what the ramifications would be if we dropped the times and
showed e.g. the current time. Probably not much and maybe we should
experiment and find out, but these things can become subtle. If it isn't too
much trouble, carrying the behavior forward might be less friction.
Thanks.
--
tejun