Skip to content

virtiofs: negotiate FUSE_MAX_PAGES for larger I/O requests#3447

Open
benhillis wants to merge 1 commit intomicrosoft:mainfrom
benhillis:virtiofs-fuse-max-pages
Open

virtiofs: negotiate FUSE_MAX_PAGES for larger I/O requests#3447
benhillis wants to merge 1 commit intomicrosoft:mainfrom
benhillis:virtiofs-fuse-max-pages

Conversation

@benhillis
Copy link
Copy Markdown
Member

Add FUSE_MAX_PAGES to DEFAULT_FLAGS so the FUSE server advertises support for larger request sizes during FUSE_INIT negotiation.

Background

Without this flag, the Linux kernel uses FUSE_DEFAULT_MAX_PAGES_PER_REQ (32 pages = 128 KiB) as the maximum request size. With the flag, the kernel uses min(fuse_max_pages_limit, virtqueue_size - 4) which is typically 252 pages (~1008 KiB) — an ~8x increase in max request size.

This significantly reduces per-request overhead (virtio descriptor setup, FUSE header parsing, context switches) for sequential I/O.

Benchmark results

burette virtio-fs, 3 iterations, vs baseline (no FUSE_MAX_PAGES):

Metric Baseline With flag Delta
Sequential read 144 MiB/s 329 MiB/s +129%
Sequential write 149 MiB/s 284 MiB/s +91%
Random read IOPS 2323 2390 ~noise
Random write IOPS 2954 3134 ~noise

Notes

DEFAULT_MAX_PAGES (256) is intentionally left unchanged. The kernel clamps max_pages to min(fuse_max_pages_limit=256, virtqueue_size-4), so larger values have no effect. The gain comes entirely from negotiating the flag, which moves the kernel from 32 → 252 pages per request.

Add FUSE_MAX_PAGES to DEFAULT_FLAGS so the FUSE server advertises
support for larger request sizes during FUSE_INIT negotiation.

Without this flag, the Linux kernel uses FUSE_DEFAULT_MAX_PAGES_PER_REQ
(32 pages = 128 KiB) as the maximum request size. With the flag, the
kernel uses min(fuse_max_pages_limit, virtqueue_size - 4) which is
typically 252 pages (~1008 KiB) — an ~8x increase in max request size.

This significantly reduces per-request overhead (virtio descriptor
setup, FUSE header parsing, context switches) for sequential I/O.

Benchmark results (burette virtio-fs, 3 iterations, vs baseline):
  Sequential read:  144 → 329 MiB/s  (+129%)
  Sequential write: 149 → 284 MiB/s  (+91%)
  Random read IOPS: 2323 → 2390      (within noise)
  Random write IOPS: 2954 → 3134     (within noise)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 8, 2026 21:45
@benhillis benhillis requested a review from a team as a code owner May 8, 2026 21:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the FUSE session’s default init negotiation flags so virtio-fs can negotiate larger per-request I/O sizes with Linux guests by advertising FUSE_MAX_PAGES during FUSE_INIT.

Changes:

  • Add FUSE_MAX_PAGES to the DEFAULT_FLAGS bitmask used for FUSE init negotiation.

Comment thread vm/devices/support/fs/fuse/src/session.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants