public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <linux_oss@crudebyte.com>
To: v9fs@lists.linux.dev, Remi Pommarel <repk@triplefau.lt>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dominique Martinet <asmadeus@codewreck.org>,
	Remi Pommarel <repk@triplefau.lt>
Subject: Re: [PATCH v3 1/4] 9p: Cache negative dentries for lookup performance
Date: Wed, 04 Mar 2026 13:50:40 +0100	[thread overview]
Message-ID: <5156132.0VBMTVartN@weasel> (raw)
In-Reply-To: <c2b00b0230b49561915d416a2183691ed82f4923.1772178819.git.repk@triplefau.lt>

On Friday, 27 February 2026 08:56:52 CET Remi Pommarel wrote:
> Not caching negative dentries can result in poor performance for
> workloads that repeatedly look up non-existent paths. Each such
> lookup triggers a full 9P transaction with the server, adding
> unnecessary overhead.
> 
> A typical example is source compilation, where multiple cc1 processes
> are spawned and repeatedly search for the same missing header files
> over and over again.
> 
> This change enables caching of negative dentries, so that lookups for
> known non-existent paths do not require a full 9P transaction. The
> cached negative dentries are retained for a configurable duration
> (expressed in milliseconds), as specified by the ndentry_timeout
> field in struct v9fs_session_info. If set to -1, negative dentries
> are cached indefinitely.
> 
> This optimization reduces lookup overhead and improves performance for
> workloads involving frequent access to non-existent paths.
> 
> Signed-off-by: Remi Pommarel <repk@triplefau.lt>
> ---
>  fs/9p/fid.c             |  11 +++--
>  fs/9p/v9fs.c            |   1 +
>  fs/9p/v9fs.h            |   5 ++
>  fs/9p/v9fs_vfs.h        |  15 ++++++
>  fs/9p/vfs_dentry.c      | 105 ++++++++++++++++++++++++++++++++++------
>  fs/9p/vfs_inode.c       |  12 +++--
>  fs/9p/vfs_super.c       |   1 +
>  include/net/9p/client.h |   2 +
>  8 files changed, 128 insertions(+), 24 deletions(-)
[...]
> diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
> index 6a12445d3858..8410f7883109 100644
> --- a/fs/9p/v9fs.h
> +++ b/fs/9p/v9fs.h
> @@ -91,6 +91,7 @@ enum p9_cache_bits {
>   * @debug: debug level
>   * @afid: authentication handle
>   * @cache: cache mode of type &p9_cache_bits
> + * @ndentry_timeout: Negative dentry lookup cache retention time in ms
>   * @cachetag: the tag of the cache associated with this session
>   * @fscache: session cookie associated with FS-Cache
>   * @uname: string user name to mount hierarchy as
> @@ -101,6 +102,7 @@ enum p9_cache_bits {
>   * @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the
> hierarchy * @clnt: reference to 9P network client instantiated for this
> session * @slist: reference to list of registered 9p sessions
> + * @ndentry_timeout_ms: Negative dentry caching retention time
>   *
>   * This structure holds state for each session instance established during
>   * a sys_mount() .
> @@ -116,6 +118,7 @@ struct v9fs_session_info {
>  	unsigned short debug;
>  	unsigned int afid;
>  	unsigned int cache;
> +	unsigned int ndentry_timeout_ms;
>  #ifdef CONFIG_9P_FSCACHE
>  	char *cachetag;
>  	struct fscache_volume *fscache;
> @@ -133,6 +136,8 @@ struct v9fs_session_info {
>  	long session_lock_timeout; /* retry interval for blocking locks */
>  };
[...]
> diff --git a/include/net/9p/client.h b/include/net/9p/client.h
> index 838a94218b59..55c6cb54bd25 100644
> --- a/include/net/9p/client.h
> +++ b/include/net/9p/client.h
> @@ -192,6 +192,7 @@ struct p9_rdma_opts {
>   * @dfltgid: default numeric groupid to mount hierarchy as
>   * @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the
> hierarchy * @session_lock_timeout: retry interval for blocking locks
> + * @ndentry_timeout_ms: Negative dentry lookup cache retention time in ms
>   *
>   * This strucure holds options which are parsed and will be transferred
>   * to the v9fs_session_info structure when mounted, and therefore largely
> @@ -203,6 +204,7 @@ struct p9_session_opts {
>  	unsigned short debug;
>  	unsigned int afid;
>  	unsigned int cache;
> +	unsigned int ndentry_timeout_ms;
>  #ifdef CONFIG_9P_FSCACHE
>  	char *cachetag;
>  #endif

Depending on what turns out to be chosen for the mount option eventually,
these types could be increased in size. But in general, LGTM:

Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>



  reply	other threads:[~2026-03-04 12:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27  7:56 [PATCH v3 0/4] 9p: Performance improvements for build workloads Remi Pommarel
2026-02-27  7:56 ` [PATCH v3 1/4] 9p: Cache negative dentries for lookup performance Remi Pommarel
2026-03-04 12:50   ` Christian Schoenebeck [this message]
2026-02-27  7:56 ` [PATCH v3 2/4] 9p: Add mount option for negative dentry cache retention Remi Pommarel
2026-03-03 14:53   ` Christian Schoenebeck
2026-03-03 21:45     ` Dominique Martinet
2026-03-04  8:25       ` Remi Pommarel
2026-03-04  9:01         ` Christian Schoenebeck
2026-03-04  9:16           ` Dominique Martinet
2026-03-04 12:45   ` Christian Schoenebeck
2026-02-27  7:56 ` [PATCH v3 3/4] 9p: Set default negative dentry retention time for cache=loose Remi Pommarel
2026-03-04 12:54   ` Christian Schoenebeck
2026-02-27  7:56 ` [PATCH v3 4/4] 9p: Enable symlink caching in page cache Remi Pommarel
2026-03-04 13:01   ` Christian Schoenebeck

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=5156132.0VBMTVartN@weasel \
    --to=linux_oss@crudebyte.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=repk@triplefau.lt \
    --cc=v9fs@lists.linux.dev \
    /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