Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
Alexandre Teles edited this page Dec 27, 2021 · 3 revisions

Welcome!

In this wiki you'll find relevant information about our build. The homepage will be dedicated to listing current non-standard optimizations and alterations made to upstream for this build and what they change/add here downstream.

Benchmarks

  1. hackbench

Using: time -p bash -c "for (( i=0; i<100; i++ )); do hackbench -pTl 4000; done;"

Results:

Default Kernel Our Kernel
real 409.62
user 270.90
sys 2654.53
real 385.36
user 263.94
sys 2482.09

Difference: 5.92%

Compiler (Clang/LLVM)

Flag Description
-O3 Specify which optimization level to use (currently O3)
-mllvm Additional arguments to forward to LLVM's option processing
-polly Enables polyhedral optimizations for LLVM
-polly-run-inliner Run an early LLVM inlining pass before running Polly
-polly-opt-fusion=max Optimization fusion strategy (default min)
-polly-omp-backend=LLVM Switches Polly’s OpenMP-backend (default GNU)
-polly-scheduling=dynamic Set the OpenMP scheduling type (default runtime)
-polly-scheduling-chunksize=1 Set the chunksize (for the selected scheduling type, default 1)
-polly-opt-maximize-bands=yes Maximizes Polly's band depth
-polly-ast-detect-parallel Detect OpenMP parallelism
-polly-ast-use-context Pass context around loops to the optimizer so that it can make better decisions
-polly-opt-simplify-deps=no Do not simplify dependences
-polly-rtc-max-arrays-per-group=40 Maximal number of arrays to compare in each alias group (default 20)
-polly-parallel -lgomp Automatically generate OpenMP code for detected loops
-polly-vectorizer=polly Generate vector code automatically

P.S.: As some of the Polly flags aren't properly documented just yet, we decided to include a brief description for all of them.

You can check all CFLAGS passed to the compiler on .github/workflows.

Additionally, the following steps are taken to enable Thin LTO support:

scripts/config -e LTO_CLANG_THIN

Linux 5.10.x doesn't support full LTO and we don't think those changes will be backported from 5.14.x, but as soon as Microsoft releases a newer version based on a newer kernel codebase that supports full LTO optimizations we'll enable it.

Notes

  1. Right now it is NOT SAFE to compile the kernel with -O3 optimizations on GCC, but perfectly fine to do so on Clang/LLVM

Kernel

Right now not many changes are included in our kernel, but all flags not present upstream are listed bellow:

  1. For AppArmor/Snaps support:
CONFIG_SECURITY_APPARMOR=y
CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE=1
CONFIG_SECURITY_APPARMOR_HASH=y
CONFIG_SECURITY_APPARMOR_HASH_DEFAULT=y
CONFIG_DEFAULT_SECURITY="apparmor"

Please note that running Snaps require systemd. There are plenty of solutions to run systemd on WSL2 without breaking Micrososft's init system, we like genie.

  1. We are currently privately working out the changes required to include full LXC/LXD support, but right now the required changes result in strange bugs in our kernel. It's important to note that LXC/LXD will run in this kernel as it stands, but as the network stack for WSL2 is super messy and the kerel doesn't includes all the required changes for LXD to properly configure the network (ex.: CONFIG_NFT_MASQ), it's possible that it'll break somewhere. If you want to keep going and test its usefulness, you can follow this tutorial: https://wsl.dev/wsl2-lxd-funtoo/

  2. USBIP related changes used to be included in our private builds, but with the release of usbipd-win and the inclusion of the necessary changes upstream they aren't required anymore, except for cases where special drivers should be included. All changes in that regard have been backtracked, but if you require any drivers to be included in our build feel free to open an issue with us.

  3. Changes made to support socketCAN, vCAN and CAN used to be included as well because one of us, with too much time in hand, enjoyed working with cars in their spare time. They work great if you have time to do some tinkering with socketCAN tunnelling solutions like Cannelloni or socketcand, but for the sake of our own sanity those changes got backtracked for the public release. If you would like to have them back, please open an issue. That or check https://github.com/microsoft/WSL/issues/5533 and do your own thing in a fork.

Clone this wiki locally