Re: Virtual Swap Sync

From: Nhat Pham

Date: Mon Nov 30 2026 - 07:34:47 EST


On Mon, Nov 30, 2026 at 5:26 AM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
>
> I think swap sizing is still the wrong interface for this. IMHO, it's
> a crude emulation, with some downsides:

I read that again, and it seems like I'm using limit a bit too
liberally. Let me clarify a bit:

>
> Say the desired logical memory limit is 4GB. We have 2GB of physical
> memory limit, so we emulate that by setting swap size to 2GB. Now say
> I have a hot file cache of 1GB, and 3GB of cold anon. That should be
> allowed, but you'd thrash prematurely or OOM because you can only
> offload 2GB of anon, and compressed anon + 1GB of uncompressed anon +
> 1GB of file cache does not fit in that 2GB limit. If we can just

limit here being physical memory capacity of the VM.

> compressed a bit more all would be good, but this requires knowing
> apriori compression ratio to properly set this limit right.

limit here being the swapfile size.