Skip to content

FUSE sessions reserve ~158 KiB of fixed tables each, mostly unused #519

Open

Description

@Max042004

Each fuse_session_t in src/syscall/fuse.c carries four fixed arrays:

Field Size
requests[FUSE_MAX_PENDING] (128) 14,336 B
node_refs[FUSE_MAX_NODE_REFS] (4096) 98,304 B
node_ref_hash[8192] 32,768 B
node_ref_free[4096] 16,384 B

One session is 162,016 bytes, and fuse_sessions[8] is 1.24 MiB of static storage. fuse_proc_open memsets the whole slot and fills both index tables, so every open("/dev/fuse") makes about 158 KiB resident. The slot stays resident until the /dev/fuse fd and every FUSE file fd are closed, which is usually the daemon's whole lifetime.

Linux keeps the same information but allocates it on demand (torvalds/linux master, fs/fuse):

  • Requests are allocated per request: fuse_request_alloc → kmem_cache_zalloc(fuse_req_cachep, ...) (dev.c). Only background requests are capped, at FUSE_DEFAULT_MAX_BACKGROUND (12).
  • The lookup count is a field of the inode, u64 nlookup in struct fuse_inode (fuse_i.h). It is incremented in fuse_iget, and FORGET is sent from fuse_evict_inode, so there is no per-connection nodeid table.

The node-ref tables are also far larger than elfuse can fill. fuse_walk_path_locked drops each component's lookup as soon as it steps past it. Only fuse_open_path (an open file) and fuse_materialize_path (an exec copy) keep the final lookup. The live count is therefore bounded by FUSE_MAX_OPEN_FILES (128, shared by all sessions) plus the walks in flight, against 4096 entries per session. The comment that sizes the table for ls -R style walks no longer matches the walk.

Possible directions:

  • Size node_refs from FUSE_MAX_OPEN_FILES instead of 4096.
  • Or allocate the node-ref tables and request slots on demand, as Linux does.

Either change also makes it cheaper to raise FUSE_MAX_SESSIONS above 8.


Activity

  1. added
    enhancement
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions