Microsoft implemented it in WSL2 (Windows Subsystem for Linux) returning memory to the system

Microsoft company announced about expanding the capabilities of the WSL2 layer (Windows Subsystem for Linux), which ensures the launch of executable files Linux Π² WindowsIn experimental assemblies Windows Insider (build 19013) WSL2 now supports Memory Reclamation, which is a method for returning memory freed by processes running in a kernel-based environment. Linux.

Previously, if memory consumption by applications or the kernel increased, the memory was allocated to the WSL2 virtual machine, but then remained pinned and was not returned to the system, even after the resource-intensive process terminated and the allocated memory was no longer needed. The Memory Reclamation mechanism allows freed memory to be returned to the host OS and automatically reduces the virtual machine's memory size. This reclaims not only memory freed by user processes, but also memory used for kernel caching. LinuxFor example, with high disk activity, the page cache, which stores file contents while the file system is running, increases in size. After executing "echo 1 > /proc/sys/vm/drop_caches," the cache can be cleared and the memory returned to the main OS.

The implementation of Memory Reclamation is based on
patch, proposed by Intel engineers for inclusion in the main core Linux To expand the capabilities of the virtio-balloon driver and memory management system. This patch is designed for use in any guest system to return unused memory pages to the host system and can be applied with various hypervisors. For WSL2, the patch is adapted to return memory to the Hyper-V hypervisor.

Recall that the second edition of WSL is different delivery of a full-fledged kernel Linux instead of an emulator that translates system calls on the fly Linux into system calls Windows. Shipped in WSL2 core Linux based on release 4.19, which runs in the environment Windows using a virtual machine already in use in Azure. Kernel updates Linux delivered through the mechanism Windows Update and are being tested in Microsoft's continuous integration infrastructure. WSL2-specific patches applied to the kernel include optimizations to reduce kernel startup time, reduce memory consumption, and maintain the minimum necessary set of drivers and subsystems in the kernel.

Source: opennet.ru

Buy reliable hosting for sites with DDoS protection, VPS VDS servers πŸ”₯ Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster