Re: [PATCH v2] fs: cache the string generated by reading /proc/filesystems
From: Christian Brauner
Date: Thu Apr 23 2026 - 09:37:27 EST
On Wed, Apr 22, 2026 at 08:17:11PM +0200, Mateusz Guzik wrote:
> It is being read surprisingly often (e.g., by mkdir, ls and even sed!).
>
> This is lock-protected pointer chasing over a linked list to pay for
> sprintf for every fs (32 on my boxen).
>
> Instead cache the result.
>
> open+read+close cycle single-threaded (ops/s):
> before: 442732
> after: 1063462 (+140%)
>
> Here the main bottleneck is memcg.
>
> Scalability-wise problems are avoidable lockref trip on open and ref
> management for the file on procfs side.
>
> The file looks like a sterotypical C from the 90s, right down to an
> open-coded and slightly obfuscated linked list. I intentionally did not
> clean up any of it -- I think the file will be best served by a Rust
> rewrite when the time comes.
>
> Signed-off-by: Mateusz Guzik <mjguzik@xxxxxxxxx>
> ---
Ugh, can't we at least also get rid of the rwlock stuff?
Something like the appended two (completely untested) patches.