You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Kernel Mitigations in WSL2 leading to 30-50% worse wall time, 80% worse syscall time #14526
Kernel side-channel mitigations seem to affect WSL2 performance more heavily than a normal linux kernel. A normal kernel with mitigations=on will see 5-10% performance impact. With wsl2, mitigations cause 84% syscall impact, and 47% compile time (wall time) impact for a moderate golang compile.
Repro Steps
Steps to Reproduce
Run perf bench sched pipe -l 100000
Run go clean -cache && go build ./...
Add kernelCommandLine=quiet loglevel=0 audit=0 mitigations=off vsyscall=none to %UserProfile%.wslconfig.
wsl --shutdown & re-run the tests
Expected Behavior
5-10% performance difference between mitigations=on and mitigations=off
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
If you choose to email these logs instead of attaching them to the bug, please send them to wsl-gh-logs@microsoft.com with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
.wslconfig found
Custom kernel command line found: 'quiet loglevel=0 audit=0 mitigations=off vsyscall=none'
Detected appx version: 2.6.3.0
Found evidence of linux crash: !usr!bin!zsh (dump: C:\Users\tonymet\AppData\Local\temp\wsl-crashes\wsl-crash-1774454831-20871-_usr_bin_zsh-11.dmp)
I think it's useful to know that "perf bench sched pipe -l 100000" speeds up by a factor of 20 if you add "chrt -i 0" before it (which enables idle scheduling) on WSL2.
perf bench sched pipe -l 100000
# Running 'sched/pipe' benchmark:
# Executed 100000 pipe operations between two processes
Total time: 5.549 [sec]
55.499880 usecs/op
18018 ops/sec
chrt -i 0 perf bench sched pipe -l 100000
# Running 'sched/pipe' benchmark:
# Executed 100000 pipe operations between two processes
Total time: 0.214 [sec]
2.143640 usecs/op
466496 ops/sec
It has also improved some non-benchmark applications by a factor of 2 to 3 for me.
I think it's useful to know that "perf bench sched pipe -l 100000" speeds up by a factor of 20 if you add "chrt -i 0" before it (which enables idle scheduling) on WSL2.
great find. do you think this is a configuration issue with the WSL kernel build? i'm hoping they can correct both performance issues. My builds are way faster now with these minor config changes.
This report benchmarks the performance impact of CPU speculative execution mitigations (mitigations=on vs mitigations=off) in WSL v3.0.2 (Linux kernel 6.18.40.1-microsoft-standard-WSL2, 16 vCPUs).
Tests were executed using the in-memory, side-effect-free test suite located at scripts/wsl-mitigations-testing/.
Environment & Configuration
OS / Platform: Windows 11 / WSL v3.0.2 (Hyper-V VM)
xychart-beta
title "Throughput Comparison: Mitigations ON vs OFF (ops/sec in Thousands)"
x-axis ["Syscall Basic (x10k)", "Sched Pipe (k)"]
y-axis "Operations / sec" 0 --> 1600
bar [535, 123]
bar [1480, 218]
Metric: 10,000,000 repeated getppid() system calls.
Result:
ON: 5,353,135 ops/s (0.1868 µs/op)
OFF: 14,798,678 ops/s (0.0676 µs/op)
Insight: Raw syscall transitions show a +176.45% throughput gain (nearly 3x throughput). Speculative execution barriers (KPTI page table flipping, entry/exit speculation barriers) represent the single largest overhead tax inside WSL.
2. Sched Pipe IPC (perf bench sched pipe)
Metric: 100,000 ping-pong pipe data transfers between two processes.
Result:
ON: 123,159 ops/s (8.12 µs/op)
OFF: 217,736 ops/s (4.59 µs/op)
Insight: Pipe IPC throughput jumps by +76.79%. This reflects the combined cost of context switching, indirect branch speculation barriers (IBPB/STIBP), and pipe buffer read/write syscalls.
Metric: 20 groups of 20 sender/receiver pairs (400 processes total) exchanging 1,000 messages.
Result:
ON: 1.682 seconds total time
OFF: 0.997 seconds total time
Insight: Multi-process scheduling contention drops by 40.73% in total wall-clock runtime, demonstrating that realistic multi-process workloads (such as build systems, Node.js worker pools, and test runners) benefit heavily from disabling mitigations.
CPU Vulnerability Status Diffs
Disabling mitigations altered the guest kernel's security posture as follows:
Vulnerability
Mitigations ON
Mitigations OFF
spectre_v1
Mitigation: usercopy/swapgs barriers and __user pointer sanitization
Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
spectre_v2
Mitigation: Retpolines; IBPB: conditional; IBRS_FW; STIBP: always-on; RSB filling; PBRSB-eIBRS: Not affected; BHI: Not affected
Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BHI: Not affected
spec_store_bypass
Mitigation: Speculative Store Bypass disabled via prctl
Activity
github-actions commentedon Mar 25, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to wsl-gh-logs@microsoft.com with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
tonymet commentedon Mar 25, 2026
WslLogs-2026-03-25_09-06-43.zip
github-actions commentedon Mar 25, 2026
Diagnostic information
tonymet commentedon Mar 25, 2026
control test of other kernel options .
Result : mitigations=off is 11% faster
A: mitigations=on
kernelCommandLine=quiet loglevel=0 audit=0 mitigations=ON vsyscall=noneB: mitigations=off
kernelCommandLine=quiet loglevel=0 audit=0 mitigations=off vsyscall=nonethisismypassport commentedon Jun 25, 2026
I think it's useful to know that "perf bench sched pipe -l 100000" speeds up by a factor of 20 if you add "chrt -i 0" before it (which enables idle scheduling) on WSL2.
It has also improved some non-benchmark applications by a factor of 2 to 3 for me.
tonymet commentedon Jun 30, 2026
great find. do you think this is a configuration issue with the WSL kernel build? i'm hoping they can correct both performance issues. My builds are way faster now with these minor config changes.
tonymet commentedon Oct 6, 2026
new testing on WSL v3.0.2 -- mitigations=off is a 85% pipe operations improvement
Findings
mitigations = off = 85% improvement
.wslconfig:
kernelCommandLine=quiet loglevel=0 audit=0 mitigations=off vsyscall=nonemitigations=ON
tonymet commentedon Oct 6, 2026
WSL Kernel Mitigations Performance Benchmark Report
Overview
This report benchmarks the performance impact of CPU speculative execution mitigations (
mitigations=onvsmitigations=off) in WSL v3.0.2 (Linux kernel6.18.40.1-microsoft-standard-WSL2, 16 vCPUs).Tests were executed using the in-memory, side-effect-free test suite located at
scripts/wsl-mitigations-testing/.Environment & Configuration
6.18.40.1-microsoft-standard-WSL2Kernel Command Lines
Benchmark Commands
The tests were executed using native
perf benchtools:Executive Summary of Results
hackbench)xychart-beta title "Throughput Comparison: Mitigations ON vs OFF (ops/sec in Thousands)" x-axis ["Syscall Basic (x10k)", "Sched Pipe (k)"] y-axis "Operations / sec" 0 --> 1600 bar [535, 123] bar [1480, 218](Blue = Mitigations ON, Orange = Mitigations OFF)
Detailed Benchmark Breakdown
1. Basic Syscall Entry/Exit (
perf bench syscall basic)getppid()system calls.2. Sched Pipe IPC (
perf bench sched pipe)3. Sched Messaging / Hackbench (
perf bench sched messaging -g 20 -l 1000)CPU Vulnerability Status Diffs
Disabling mitigations altered the guest kernel's security posture as follows:
spectre_v1spectre_v2spec_store_bypassspec_rstack_overflowtsatonymet commentedon Nov 24, 2026
Still affecting WSL v 3.0.5 . see #41827 for more test results
tonymet commentedon Nov 24, 2026
Hayden Barnes (@sirredbeard) since this has been repro'ed in #41827 can we see about escalating