Re: [PATCH] fs, pseudo: Do not update atime for pseudo inodes

From: Amir Goldstein
Date: Fri Jun 19 2020 - 09:45:25 EST


On Wed, Jun 17, 2020 at 5:53 PM Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> wrote:
>
> The kernel uses internal mounts created by kern_mount() and populated
> with files with no lookup path by alloc_file_pseudo() for a variety of
> reasons. An relevant example is anonymous pipes because every vfs_write
> also checks if atime needs to be updated even though it is unnecessary.
> Most of the relevant users for alloc_file_pseudo() either have no statfs
> helper or use simple_statfs which does not return st_atime. The closest

st_atime is returned by simple_getattr()

> proxy measure is the proc fd representations of such inodes which do not
> appear to change once they are created. This patch sets the S_NOATIME
> on inode->i_flags for inodes created by new_inode_pseudo() so that atime
> will not be updated.
>

new_inode() calls new_inode_pseudo() ...
You need to factor out a new helper.

Either you can provide callers analysis of all new_inode_pseudo() users
or use a new helper to set S_NOATIME and call it from the relevant users
(pipe, socket).

How about S_NOCMTIME while you are at it?
Doesn't file_update_time() show in profiling?
Is there a valid use case for updating c/mtime of anonymous socket/pipe?

Thanks,
Amir.