virtiofs: Use aggregate share feature in WSLC - #41151
Merged
Daman Mulye (damanm24) merged 6 commits intoJul 24, 2026
Merged
Conversation
added 2 commits
July 22, 2026 13:25
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends WSLCâs virtiofs integration to use an aggregate virtiofs device with per-share children, reducing virtiofs device proliferation and enabling safe add/remove of Windows-folder shares without hitting the previous per-device aperture/limit behaviors.
Changes:
- Update WSLC mount IPC to optionally carry a virtiofs child name, allowing the guest to mount an aggregate child via
MountVirtioFsChild(tag, childName, ...). - Switch the WSLC service-side share plumbing to lazily create a single aggregate virtiofs device and add/remove shares as children.
- Refresh WSLC tests to validate independent children, child removal, and mounting many shares; remove the legacy âmax sharesâ limit logic and update DeviceHost dependency.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WSLCTests.cpp | Updates/extends WSLC virtiofs tests for aggregate-child semantics (independent children, removal, many mounts, RO enforcement). |
| src/windows/wslcsession/WSLCVirtualMachine.h | Extends internal mount helper signature to support an optional virtiofs child name. |
| src/windows/wslcsession/WSLCVirtualMachine.cpp | Removes share-reuse cache/limit logic; passes aggregate tag + child name for virtiofs mounts; always removes shares on unmount/failure. |
| src/windows/service/exe/HcsVirtualMachine.h | Tracks a single aggregate virtiofs device instance for WSLC shares. |
| src/windows/service/exe/HcsVirtualMachine.cpp | Creates a single aggregate virtiofs device and adds/removes per-share children via GuestDeviceManager. |
| src/windows/common/GuestDeviceManager.h | Adds RemoveVirtiofsChild API. |
| src/windows/common/GuestDeviceManager.cpp | Implements RemoveVirtiofsChild with locking consistent with other device-host calls. |
| src/windows/common/DeviceHostProxy.h | Adds RemoveVirtiofsChild forwarding API. |
| src/windows/common/DeviceHostProxy.cpp | Implements RemoveVirtiofsChild by calling the virtiofs deviceâs RemoveChild. |
| src/shared/inc/lxinitshared.h | Extends WSLC_MOUNT message with ChildNameIndex for the new IPC field. |
| src/shared/inc/defs.h | Removes the legacy c_maxVirtioFsShares limit constant. |
| src/linux/init/WSLCInit.cpp | Teaches WSLC init to mount either a normal filesystem mount or a virtiofs aggregate child mount depending on ChildNameIndex. |
| src/linux/init/drvfs.h | Declares MountVirtioFsChild for use by WSLC init. |
| src/linux/init/drvfs.cpp | Adjusts MountVirtioFsChild definition signature to match the header (defaults live in the header). |
| packages.config | Bumps Microsoft.WSL.DeviceHost dependency version. |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/linux/init/WSLCInit.cpp:20
- WSLCInit.cpp now uses std::is_same_v, but the file doesnât explicitly include <type_traits>. This can cause build breaks depending on transitive include order; add <type_traits> here so the dependency is explicit.
#include "drvfs.h"
#include "SocketChannel.h"
#include "message.h"
#include "localhost.h"
#include "common.h"
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/linux/init/WSLCInit.cpp:21
- WSLCInit.cpp now uses
std::is_same_vinHandleMountMessage, but the file does not include<type_traits>. This relies on transitive includes and can break the build if headers change.
#include "util.h"
#include "drvfs.h"
#include "SocketChannel.h"
#include "message.h"
#include "localhost.h"
#include "common.h"
#include <utmp.h>
Ben Hillis (benhillis)
approved these changes
Jul 24, 2026
Member
|
Looks good to me! |
Ben Hillis (benhillis)
pushed a commit
that referenced
this pull request
Jul 24, 2026
Now that DrvFs shares are carried by a single aggregate virtiofs device (#41129 / #41151), only a small, fixed number of virtiofs devices exist per VM. That leaves enough memory-aperture headroom to give each aggregate multiple request queues, which significantly improves concurrent DrvFs throughput. Non-aggregate (per-share file-backed) and section-backed devices stay at a single queue: many of them can exist, and raising their queue count would reintroduce the aperture exhaustion that the one-queue default was added to avoid. fio on /mnt/c (16 parallel jobs, psync), 4 queues vs 1: randread 4k +56% IOPS (-36% latency) randwrite 4k +622% IOPS (-85% latency) smallfile randrw +48% IOPS (-33% latency) seqread 1M +15% IOPS seqwrite 1M -10% IOPS (single-stream, bandwidth-bound; within noise) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ab64eb9-4271-4241-b838-3da58ec39305
Ben Hillis (benhillis)
added a commit
that referenced
this pull request
Jul 24, 2026
Now that DrvFs shares are carried by a single aggregate virtiofs device (#41129 / #41151), only a small, fixed number of virtiofs devices exist per VM. That leaves enough memory-aperture headroom to give each aggregate multiple request queues, which significantly improves concurrent DrvFs throughput. Non-aggregate (per-share file-backed) and section-backed devices stay at a single queue: many of them can exist, and raising their queue count would reintroduce the aperture exhaustion that the one-queue default was added to avoid. fio on /mnt/c (16 parallel jobs, psync), 4 queues vs 1: randread 4k +56% IOPS (-36% latency) randwrite 4k +622% IOPS (-85% latency) smallfile randrw +48% IOPS (-33% latency) seqread 1M +15% IOPS seqwrite 1M -10% IOPS (single-stream, bandwidth-bound; within noise) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ab64eb9-4271-4241-b838-3da58ec39305
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to PR: #41129 which removes the need to limit the amount of virtiofs shares in WSLC. It does so by mounting all virtiofs shares under a single, unified root share which limits the memory footprint of virtio devices. See the original PR for more details.