Enable transcendent memory (TMEM)

Update: TMEM has been removed. The latest uptream version containing it seems to be 5.2, namely revision v5.2.21.

Tested with XEN version 4.11.0 and domU versions 4.18.16 & 5.2.14.

DomU kernel preparation

make defconfig
make xenconfig

eventually disable DOM0 and enable

CONFIG_XEN_SELFBALLOONING=y
CONFIG_XEN_TMEM=m

deliver the modules into the guest’s /lib/modules/$version/ and once booted, load

modprobe tmem
echo tmem >> /etc/modules

gives

[   37.471390] xen:tmem: frontswap enabled, RAM provided by Xen Transcendent Memory
[   37.471410] xen:tmem: cleancache enabled, RAM provided by Xen Transcendent Memory
[   37.471423] xen_selfballoon: Initializing Xen selfballooning driver
[   37.471425] xen_selfballoon: Initializing frontswap selfshrinking driver

Results

we end-up with ilding guests eating very few memory (after a few minutes of progressive shrinking)

slack       871-873
stretch     903-906
bionic      104

values taken from free -m e.g.

              total        used        free      shared  buff/cache   available
Mem:            104          80           5           0          18          12
Swap:             0           0           0

Bugs/Issues

While stress-testing RAM with DD against TMPFS

    [ 1934.161197] Out of memory: Killed process 1413 ((sd-pam)) total-vm:108836kB, anon-rss:1840kB, file-rss:0kB, shmem-rss:0kB
    [ 1934.166271] Out of memory: Killed process 1430 (dd) total-vm:7352kB, anon-rss:1124kB, file-rss:0kB, shmem-rss:0kB
    Killed
    [ 1935.132381] Out of memory: Killed process 1412 (systemd) total-vm:76520kB, anon-rss:912kB, file-rss:0kB, shmem-rss:0kB

Same with the stress tool

    [ 2053.102772] Out of memory: Killed process 1482 (stress) total-vm:270384kB, anon-rss:23552kB, file-rss:0kB, shmem-rss:0kB
    [ 2053.148917] Out of memory: Killed process 1483 (stress) total-vm:270384kB, anon-rss:30588kB, file-rss:0kB, shmem-rss:0kB

Dom0

TMEM does not seem to work on dom0

xen:tmem: frontswap enabled, RAM provided by Xen Transcendent Memory
xen:tmem: cleancache enabled, RAM provided by Xen Transcendent Memory
xen_selfballoon: Xen selfballooning driver disabled for domain0

Resources

Enabling Transcendent Memory https://wiki.xenproject.org/wiki/TMEM

Help! Linux ate my RAM! https://www.linuxatemyram.com/

Stress Test CPU and Memory (VM) On a Linux / Unix With Stress-ng https://www.cyberciti.biz/faq/stress-test-linux-unix-server-with-stress-ng/

alternatives

Kernel same-page merging https://en.wikipedia.org/wiki/Kernel_same-page_merging


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun