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

オープン
#519 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.


主要言語
C
スター
287
フォーク
33
平均マージ
2日 17時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/elfuse のほかの issue

sysprog21/elfuse の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。