On Sat, Feb 6, 2021 at 8:12 AM Pavel Raiskup <praiskup(a)redhat.com> wrote:
I'm trying to overcommit storage space on one our hypervisors (and reclaim
space if possible after memory peak times) and it seems like kernel in
Fedora 33 isn't doing automatic discard on swap partitions?
You might ask about it on linux-mm(a)kvack.org
$ swapon --discard /dev/sda
--discard without options enables both available options, so you get
an initial discard and then an async discard when pages are freed.
Quite a lot of applications don't seem to free their dirty pages until
they quit, which might also be worth asking about.
The 'fstrim -av' isn't propagated to SWAP mount points
(expected
probably).
It's not a file system so that doesn't work.
But otherwise, freeing the guest memory manually, minimizing the swap
usage,
etc. (experiments with tmpfs) doesn't result in freeing the allocated storage
blocks on host.
I think it's up to the application to free the pages, if they aren't
freed somehow then the kernel can't know what blocks to issue discards
for.
--
Chris Murphy