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

Abierto
#519 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c

Línea de trabajo

Start with src/syscall/fuse.c, especially fuse_session_t, fuse_proc_open, and the node-ref path functions named in the issue; trace how requests and node references are allocated and released. Compare the two proposed approaches and check existing limits such as FUSE_MAX_OPEN_FILES and FUSE_MAX_SESSIONS. Done means reducing per-session storage and initialization cost while preserving FUSE request and node-reference behavior; the issue names no tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

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.


Lenguaje dominante
C
Estrellas
287
Forks
33
Merge medio
2 d 17 h
PR fusionados (30 d)
18

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sysprog21/elfuse

Todos los issues de sysprog21/elfuse

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.