* Virtual Swap Sync
@ 2026-11-05 21:06 Nhat Pham
2026-11-06 12:55 ` David Hildenbrand (Arm)
2026-11-22 15:31 ` Nhat Pham
0 siblings, 2 replies; 9+ messages in thread
From: Nhat Pham @ 2026-11-05 21:06 UTC (permalink / raw)
To: David Hildenbrand (Arm),
Johannes Weiner, Chris Li, Baoquan He, Kairui Song, Michal Hocko,
Roman Gushchin, Shakeel Butt, Muchun Song, Kemeng Shi,
Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
Hi folks,
Sorry for the delay in scheduling. I also figured it was not a good
time with all the merge activity + the big list of issues that needs
urgent attention :)
Since no one responded to the last email, I took the liberty to do
some timezone math and create the meeting myself :) How does this
sound?
Thursday Nov 12, 2026 ⋅ 5pm - 6pm (Pacific Time (Canada))
which translates to:
Vancouver: Thursday November 12, 5PM PT
US west coast: Thursday November 12 4:00pm PST
US east coast: Thursday November 12 7:00pm EST
Europe: 1:00am Friday November 13 CET
Beijing: 8:00am Friday November 13 CST
Folks, can you double check the invitation, and please let me know if
I missed you in the invite :)
Best,
Nhat
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-05 21:06 Virtual Swap Sync Nhat Pham
@ 2026-11-06 12:55 ` David Hildenbrand (Arm)
2026-11-22 15:31 ` Nhat Pham
1 sibling, 0 replies; 9+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-06 12:55 UTC (permalink / raw)
To: Nhat Pham, Johannes Weiner, Chris Li, Baoquan He, Kairui Song,
Michal Hocko, Roman Gushchin, Shakeel Butt, Muchun Song,
Kemeng Shi, Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On 11/5/26 22:06, Nhat Pham wrote:
> Hi folks,
>
Hi,
> Sorry for the delay in scheduling. I also figured it was not a good
> time with all the merge activity + the big list of issues that needs
> urgent attention :)
yeah ... thanks for taking care of this.
>
> Since no one responded to the last email, I took the liberty to do
> some timezone math and create the meeting myself :) How does this
> sound?
I'll try to be there, no promises lol
--
Cheers,
David
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-05 21:06 Virtual Swap Sync Nhat Pham
2026-11-06 12:55 ` David Hildenbrand (Arm)
@ 2026-11-22 15:31 ` Nhat Pham
2026-11-26 6:03 ` Baoquan He
2026-11-29 16:40 ` Kairui Song
1 sibling, 2 replies; 9+ messages in thread
From: Nhat Pham @ 2026-11-22 15:31 UTC (permalink / raw)
To: David Hildenbrand (Arm),
Johannes Weiner, Chris Li, Baoquan He, Kairui Song, Michal Hocko,
Roman Gushchin, Shakeel Butt, Muchun Song, Kemeng Shi,
Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On Thu, Nov 5, 2026 at 2:06 PM Nhat Pham <nphamcs@gmail.com> wrote:
>
> Hi folks,
>
Hi folks - thanks everyone for attending. :)
I summarized the points we discussed below - please let me know if I
missed anything or misunderstood a point.
* Control interface: Google is interested in a knob to cease zswapping
(which already exists and will still work in vswap world). Kairui has
a use case for remapping all swapped-out pages.
Vswap currently bypassed when zswap is off; per-cgroup selection could
be added as concrete use case arises (for e.g migration/compaction).
David objected that a virtual swap abstraction should not carry a
swapoff interface per se. Folks also asked whether making vswap a
mandatory layer would make the implementation cleaner (Nhat will
explore this direction and follow up on this).
* Virtual space sizing: We discussed using vm.overcommit_ratio and
vm.overcommit_memory to limit the host's logical memory footprint. The
exact sizing formula is still unclear - Nhat will follow up with
Kairui on whether it is acceptable.
(Kairui, if possible, can you respond here for your exact use case? Do
you want to limit physical memory usage, or virtual? My understanding
is you want to gate physical + swap, which would be closer to the
latter).
* Priority and multiple swapfiles: should not be added for now.
No good use case for swap priority was identified.
Multiple swapfiles were used in the past to work around swapfile
lock contention, but it is unclear whether they are still needed with
Kairui's new cluster-based allocator. If contention remains a problem,
we should fix it in the kernel before putting that burden on
userspace.
* Proposed phase split and charging (from Nhat):
- Phase 1 - initial foundation:
- Decoupled zswap: Let zswap operate without reserving disk swap
for every virtual entry.
- Physical backing and writeback: Keep disk swap available as a
backend, including when zswap cannot store a page or an entry needs
writeback.
- Charging: Retain memsw charging for virtual entries; keep
virtual-slot usage out of memory.swap.max. Actual physical swap usage
keeps its resource charging.
- Usage counter: Expose vswap usage so users can monitor
virtual-space consumption separately from physical swap usage.
Essentially this gives you a method to estimate the logical footprint
(memory.current - swapcached + vswap).
- Subsequent phase(s) - further support and controls:
- VM_SPARSE: Add VM_SPARSE as an optimization after the
first-phase foundation.
- Runtime controls (added as use cases arise):
- Host-wide runtime disablement knob (and remapping of swapped out data).
- Per-cgroup vswap control (for e.g, if some cgroups want
migrations/physical swapfile compaction).
- Orthogonal use cases and concerns:
- Cgroup-level logical memory limits in cgroupv2 (memsw?) - swap
developers will follow up with memcg maintainers.
- Static sizing: Define the host-sizing formula and decide whether
another interface is needed.
- Swap tiering for cgroups: Explore backend selection when a
concrete workload needs it.
Folks, please comment on the summary and proposal.
Let us keep the communication line open and coordinate on the next
steps. I will schedule something again.
Also taking a step back - once we reach a consensus on vswap, maybe we
can repurpose this series of meeting for general swap alignment? There
are other swap/compressed swap developments right now (looking at the
orthogonal use cases list above for e.g), so maybe we can do this once
or twice a month. My experience in the past year or so has shown that
we clearly need better alignment :)
I will reach out to set up another round of meeting. I'm hoping we can
do it one more time in December, but I understand that holiday season
is coming :)
For folks in the U.S, I wish you all a merry and festive Thanksgiving.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-22 15:31 ` Nhat Pham
@ 2026-11-26 6:03 ` Baoquan He
2026-11-26 17:30 ` Nhat Pham
2026-11-29 16:40 ` Kairui Song
1 sibling, 1 reply; 9+ messages in thread
From: Baoquan He @ 2026-11-26 6:03 UTC (permalink / raw)
To: Nhat Pham
Cc: David Hildenbrand (Arm),
Johannes Weiner, Chris Li, Kairui Song, Michal Hocko,
Roman Gushchin, Shakeel Butt, Muchun Song, Kemeng Shi,
Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On 11/22/26 at 08:31am, Nhat Pham wrote:
> On Thu, Nov 5, 2026 at 2:06 PM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> > Hi folks,
> >
>
> Hi folks - thanks everyone for attending. :)
>
> I summarized the points we discussed below - please let me know if I
> missed anything or misunderstood a point.
>
> * Control interface: Google is interested in a knob to cease zswapping
> (which already exists and will still work in vswap world). Kairui has
> a use case for remapping all swapped-out pages.
>
> Vswap currently bypassed when zswap is off; per-cgroup selection could
> be added as concrete use case arises (for e.g migration/compaction).
>
> David objected that a virtual swap abstraction should not carry a
> swapoff interface per se. Folks also asked whether making vswap a
> mandatory layer would make the implementation cleaner (Nhat will
> explore this direction and follow up on this).
>
> * Virtual space sizing: We discussed using vm.overcommit_ratio and
> vm.overcommit_memory to limit the host's logical memory footprint. The
> exact sizing formula is still unclear - Nhat will follow up with
> Kairui on whether it is acceptable.
>
> (Kairui, if possible, can you respond here for your exact use case? Do
> you want to limit physical memory usage, or virtual? My understanding
> is you want to gate physical + swap, which would be closer to the
> latter).
>
> * Priority and multiple swapfiles: should not be added for now.
> No good use case for swap priority was identified.
> Multiple swapfiles were used in the past to work around swapfile
> lock contention, but it is unclear whether they are still needed with
> Kairui's new cluster-based allocator. If contention remains a problem,
> we should fix it in the kernel before putting that burden on
> userspace.
>
> * Proposed phase split and charging (from Nhat):
>
> - Phase 1 - initial foundation:
> - Decoupled zswap: Let zswap operate without reserving disk swap
> for every virtual entry.
> - Physical backing and writeback: Keep disk swap available as a
> backend, including when zswap cannot store a page or an entry needs
> writeback.
> - Charging: Retain memsw charging for virtual entries; keep
> virtual-slot usage out of memory.swap.max. Actual physical swap usage
> keeps its resource charging.
> - Usage counter: Expose vswap usage so users can monitor
> virtual-space consumption separately from physical swap usage.
> Essentially this gives you a method to estimate the logical footprint
> (memory.current - swapcached + vswap).
>
> - Subsequent phase(s) - further support and controls:
> - VM_SPARSE: Add VM_SPARSE as an optimization after the
> first-phase foundation.
> - Runtime controls (added as use cases arise):
> - Host-wide runtime disablement knob (and remapping of swapped out data).
> - Per-cgroup vswap control (for e.g, if some cgroups want
> migrations/physical swapfile compaction).
>
> - Orthogonal use cases and concerns:
> - Cgroup-level logical memory limits in cgroupv2 (memsw?) - swap
> developers will follow up with memcg maintainers.
> - Static sizing: Define the host-sizing formula and decide whether
> another interface is needed.
> - Swap tiering for cgroups: Explore backend selection when a
> concrete workload needs it.
Youngjun's swap tier comes from concrete use case of his company, it's
been v11, he presented this in LSF and LPC.
[RFC PATCH v11 0/4] mm/swap: priority-based swap tiers with per-cgroup selection
https://lore.kernel.org/all/20260916183437.2946306-1-youngjun.park@lge.com/T/#u
This is xswap road map I shared with you when we discussed about working
together. I also mentioned swap tier in road map because Swap tier is a
very important feature we swap developers plan to add.
https://lore.kernel.org/all/al8ohWshSSZ64AtT@MiWiFi-R3L-srv/
I thought you had read them.
I don't know why I couldn't join meeting last time, I tried at 8:05am at
my side, kept waiting for people to approve me until 8:30am I was
added. Not sure if you guys also talked about this.
Thanks
Baoquan
>
> Folks, please comment on the summary and proposal.
>
> Let us keep the communication line open and coordinate on the next
> steps. I will schedule something again.
>
> Also taking a step back - once we reach a consensus on vswap, maybe we
> can repurpose this series of meeting for general swap alignment? There
> are other swap/compressed swap developments right now (looking at the
> orthogonal use cases list above for e.g), so maybe we can do this once
> or twice a month. My experience in the past year or so has shown that
> we clearly need better alignment :)
>
> I will reach out to set up another round of meeting. I'm hoping we can
> do it one more time in December, but I understand that holiday season
> is coming :)
>
> For folks in the U.S, I wish you all a merry and festive Thanksgiving.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-26 6:03 ` Baoquan He
@ 2026-11-26 17:30 ` Nhat Pham
2026-11-29 17:25 ` Kairui Song
0 siblings, 1 reply; 9+ messages in thread
From: Nhat Pham @ 2026-11-26 17:30 UTC (permalink / raw)
To: Baoquan He
Cc: David Hildenbrand (Arm),
Johannes Weiner, Chris Li, Kairui Song, Michal Hocko,
Roman Gushchin, Shakeel Butt, Muchun Song, Kemeng Shi,
Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On Wed, Nov 25, 2026 at 11:03 PM Baoquan He <baoquan.he@linux.dev> wrote:
>
> On 11/22/26 at 08:31am, Nhat Pham wrote:
> > On Thu, Nov 5, 2026 at 2:06 PM Nhat Pham <nphamcs@gmail.com> wrote:
> > >
> > > Hi folks,
> > >
> >
> > Hi folks - thanks everyone for attending. :)
> >
> > I summarized the points we discussed below - please let me know if I
> > missed anything or misunderstood a point.
> >
> > * Control interface: Google is interested in a knob to cease zswapping
> > (which already exists and will still work in vswap world). Kairui has
> > a use case for remapping all swapped-out pages.
> >
> > Vswap currently bypassed when zswap is off; per-cgroup selection could
> > be added as concrete use case arises (for e.g migration/compaction).
> >
> > David objected that a virtual swap abstraction should not carry a
> > swapoff interface per se. Folks also asked whether making vswap a
> > mandatory layer would make the implementation cleaner (Nhat will
> > explore this direction and follow up on this).
> >
> > * Virtual space sizing: We discussed using vm.overcommit_ratio and
> > vm.overcommit_memory to limit the host's logical memory footprint. The
> > exact sizing formula is still unclear - Nhat will follow up with
> > Kairui on whether it is acceptable.
> >
> > (Kairui, if possible, can you respond here for your exact use case? Do
> > you want to limit physical memory usage, or virtual? My understanding
> > is you want to gate physical + swap, which would be closer to the
> > latter).
> >
> > * Priority and multiple swapfiles: should not be added for now.
> > No good use case for swap priority was identified.
> > Multiple swapfiles were used in the past to work around swapfile
> > lock contention, but it is unclear whether they are still needed with
> > Kairui's new cluster-based allocator. If contention remains a problem,
> > we should fix it in the kernel before putting that burden on
> > userspace.
> >
> > * Proposed phase split and charging (from Nhat):
> >
> > - Phase 1 - initial foundation:
> > - Decoupled zswap: Let zswap operate without reserving disk swap
> > for every virtual entry.
> > - Physical backing and writeback: Keep disk swap available as a
> > backend, including when zswap cannot store a page or an entry needs
> > writeback.
> > - Charging: Retain memsw charging for virtual entries; keep
> > virtual-slot usage out of memory.swap.max. Actual physical swap usage
> > keeps its resource charging.
> > - Usage counter: Expose vswap usage so users can monitor
> > virtual-space consumption separately from physical swap usage.
> > Essentially this gives you a method to estimate the logical footprint
> > (memory.current - swapcached + vswap).
> >
> > - Subsequent phase(s) - further support and controls:
> > - VM_SPARSE: Add VM_SPARSE as an optimization after the
> > first-phase foundation.
> > - Runtime controls (added as use cases arise):
> > - Host-wide runtime disablement knob (and remapping of swapped out data).
> > - Per-cgroup vswap control (for e.g, if some cgroups want
> > migrations/physical swapfile compaction).
> >
> > - Orthogonal use cases and concerns:
> > - Cgroup-level logical memory limits in cgroupv2 (memsw?) - swap
> > developers will follow up with memcg maintainers.
> > - Static sizing: Define the host-sizing formula and decide whether
> > another interface is needed.
> > - Swap tiering for cgroups: Explore backend selection when a
> > concrete workload needs it.
>
> Youngjun's swap tier comes from concrete use case of his company, it's
> been v11, he presented this in LSF and LPC.
>
> [RFC PATCH v11 0/4] mm/swap: priority-based swap tiers with per-cgroup selection
> https://lore.kernel.org/all/20260916183437.2946306-1-youngjun.park@lge.com/T/#u
>
> This is xswap road map I shared with you when we discussed about working
> together. I also mentioned swap tier in road map because Swap tier is a
> very important feature we swap developers plan to add.
>
> https://lore.kernel.org/all/al8ohWshSSZ64AtT@MiWiFi-R3L-srv/
>
> I thought you had read them.
I put this as "orthogonal" because I don't think swap tiering should
block virtual swap development. It's probably the other way around -
swap tiering makes a lot less sense without a virtual swap layer.
If you want my opinions on swap tiering, you could search on lore :)
https://lore.kernel.org/linux-mm/CAKEwX=O-_OZ8x0UC96a_k+0eZfAE+mWMWDdn68uy1LHRq=JC0w@mail.gmail.com/
https://lore.kernel.org/linux-mm/CAKEwX=N2XcMHN1jatppOk6wnmz-Shab5XMtTtzgYOzRvU_6YFw@mail.gmail.com/
https://lore.kernel.org/all/CAKEwX=NfSy0XiD_UMsDOHGCwpE7sYmBmhV4Y9vk_cbnnr6J6PQ@mail.gmail.com/
https://lore.kernel.org/all/CAKEwX=NfSy0XiD_UMsDOHGCwpE7sYmBmhV4Y9vk_cbnnr6J6PQ@mail.gmail.com/
I did review Youngjun's code, pointing out some deficiencies we needed
to fix eventually, but I did not nack anything.
The problem with that series is that the memcg maintainers are not
satisfied with the proposed interface, and the lack of writeback
support (i.e data transfer between tier).
I also raised a similar concern in one of those comments. And it's not
just a nice-to-have either. We can get into LRU inversion scenario
because of it.
FWIW, virtual swap IS a step to resolve that problem. It provides an
indirection layer that allow you to change the backend without having
to do PT walk to update the backend, or repeating the logic at every
backend level. The "V" in VFS, so to speak.
Similar with the other items on the list - memsw for e.g. I made a
best effort attempt at least to make vswap work with memsw, but memsw
in cgroupv2 is its own conversation.
>
> I don't know why I couldn't join meeting last time, I tried at 8:05am at
> my side, kept waiting for people to approve me until 8:30am I was
> added. Not sure if you guys also talked about this.
Hmm maybe I missed that notifications? Apologies if that's the case -
I do remember letting you in but I wasn't sure at which time. But you
were eventually in right? I remember you commenting on some
overcommiting stuff.
Feel free to comment on this summary if you disagree with any points
:) And how do you feel about the proposal?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-22 15:31 ` Nhat Pham
2026-11-26 6:03 ` Baoquan He
@ 2026-11-29 16:40 ` Kairui Song
2026-11-30 2:40 ` Rik van Riel
1 sibling, 1 reply; 9+ messages in thread
From: Kairui Song @ 2026-11-29 16:40 UTC (permalink / raw)
To: Nhat Pham
Cc: David Hildenbrand (Arm),
Johannes Weiner, Chris Li, Baoquan He, Michal Hocko,
Roman Gushchin, Shakeel Butt, Muchun Song, Kemeng Shi,
Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On Sun, Nov 22, 2026 at 11:32 PM Nhat Pham <nphamcs@gmail.com> wrote:
>
> On Thu, Nov 5, 2026 at 2:06 PM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> > Hi folks,
> >
>
> Hi folks - thanks everyone for attending. :)
>
> I summarized the points we discussed below - please let me know if I
> missed anything or misunderstood a point.
>
> * Control interface: Google is interested in a knob to cease zswapping
> (which already exists and will still work in vswap world). Kairui has
> a use case for remapping all swapped-out pages.
>
> Vswap currently bypassed when zswap is off; per-cgroup selection could
> be added as concrete use case arises (for e.g migration/compaction).
>
> David objected that a virtual swap abstraction should not carry a
> swapoff interface per se. Folks also asked whether making vswap a
> mandatory layer would make the implementation cleaner (Nhat will
> explore this direction and follow up on this).
>
> * Virtual space sizing: We discussed using vm.overcommit_ratio and
> vm.overcommit_memory to limit the host's logical memory footprint. The
> exact sizing formula is still unclear - Nhat will follow up with
> Kairui on whether it is acceptable.
>
> (Kairui, if possible, can you respond here for your exact use case? Do
> you want to limit physical memory usage, or virtual? My understanding
> is you want to gate physical + swap, which would be closer to the
> latter).
Hi, Sorry for the a bit late response, got too busy with many other
things recently...
For this part, it's a bit tricky, it's the logical / virtual part,
basically like memsw but without cgroups. We need one host-global size
for the logical footprint, enforced by the OOM killer, I think it will
be easier to understand with the usage described below:
Lightweight VMs are very common and we have a similar situation, and
nowadays they are increasingly even more popular for AI agent
sandboxes. Basically, these VMs run without components like user
space oom killer or cgroup layouts inside.
In one of our use cases, we give the workload a fixed logical
footprint, e.g. on a 2G VM with 2G zram, so memset(region, 0xff, 4G)
will work, memset(region, 0xff, 4G + 2M) will OOM (NOTE, it's not
about same filled pages, just to demonstrate the usage, non same
filled pages with high compression rate are also very common. And yeah
it can't actually hold 4G that way but you know what I mean ;-) ).
The underlying memory can be compressed or swapped. That's fine.
However, letting the app use a much larger logical memory size would
cause unexpected CPU time overcommitment or hangs. And leaking apps
(especially nowadays with AI agents :P) are very common too. We do
want to kill them.
With cgroup v1 we have memsw. With lightweight VMs + zram, we set the
zram size + RAM size to a reasonable size to limit logical usage.
memory.swap.max stops being a logical limit anyway since vswap entries
aren't counted there. Alternative solutions like, reclaiming memory on
the host side, is not always doable, e.g., some hypervisors force
hugetlb, or we simply have no control on that side for some platform.
Problem with overcommit_ratio is that it is limiting the mmap size,
not memset size. xswap provided a size option here.
I really want to know more about the Android case here too, does
Android set a limited zram size for a similar reason?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-26 17:30 ` Nhat Pham
@ 2026-11-29 17:25 ` Kairui Song
2026-11-29 22:12 ` Chris Li
0 siblings, 1 reply; 9+ messages in thread
From: Kairui Song @ 2026-11-29 17:25 UTC (permalink / raw)
To: Nhat Pham, Luka Bai, Chris Li, Baoquan He
Cc: David Hildenbrand (Arm),
Johannes Weiner, Michal Hocko, Roman Gushchin, Shakeel Butt,
Muchun Song, Kemeng Shi, Barry Song, YoungJun Park,
Chengming Zhou, Lorenzo Stoakes (Oracle),
Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On Fri, Nov 27, 2026 at 1:30 AM Nhat Pham <nphamcs@gmail.com> wrote:
>
> On Wed, Nov 25, 2026 at 11:03 PM Baoquan He <baoquan.he@linux.dev> wrote:
> >
> > On 11/22/26 at 08:31am, Nhat Pham wrote:
> > > - Orthogonal use cases and concerns:
> > > - Cgroup-level logical memory limits in cgroupv2 (memsw?) - swap
> > > developers will follow up with memcg maintainers.
> > > - Static sizing: Define the host-sizing formula and decide whether
> > > another interface is needed.
> > > - Swap tiering for cgroups: Explore backend selection when a
> > > concrete workload needs it.
> >
> > Youngjun's swap tier comes from concrete use case of his company, it's
> > been v11, he presented this in LSF and LPC.
> >
> > [RFC PATCH v11 0/4] mm/swap: priority-based swap tiers with per-cgroup selection
> > https://lore.kernel.org/all/20260916183437.2946306-1-youngjun.park@lge.com/T/#u
> >
> > This is xswap road map I shared with you when we discussed about working
> > together. I also mentioned swap tier in road map because Swap tier is a
> > very important feature we swap developers plan to add.
> >
> > https://lore.kernel.org/all/al8ohWshSSZ64AtT@MiWiFi-R3L-srv/
> >
> > I thought you had read them.
>
> I put this as "orthogonal" because I don't think swap tiering should
> block virtual swap development. It's probably the other way around -
> swap tiering makes a lot less sense without a virtual swap layer.
>
> If you want my opinions on swap tiering, you could search on lore :)
>
> https://lore.kernel.org/linux-mm/CAKEwX=O-_OZ8x0UC96a_k+0eZfAE+mWMWDdn68uy1LHRq=JC0w@mail.gmail.com/
> https://lore.kernel.org/linux-mm/CAKEwX=N2XcMHN1jatppOk6wnmz-Shab5XMtTtzgYOzRvU_6YFw@mail.gmail.com/
> https://lore.kernel.org/all/CAKEwX=NfSy0XiD_UMsDOHGCwpE7sYmBmhV4Y9vk_cbnnr6J6PQ@mail.gmail.com/
> https://lore.kernel.org/all/CAKEwX=NfSy0XiD_UMsDOHGCwpE7sYmBmhV4Y9vk_cbnnr6J6PQ@mail.gmail.com/
>
> I did review Youngjun's code, pointing out some deficiencies we needed
> to fix eventually, but I did not nack anything.
>
> The problem with that series is that the memcg maintainers are not
> satisfied with the proposed interface, and the lack of writeback
> support (i.e data transfer between tier).
>
> I also raised a similar concern in one of those comments. And it's not
> just a nice-to-have either. We can get into LRU inversion scenario
> because of it.
>
> FWIW, virtual swap IS a step to resolve that problem. It provides an
> indirection layer that allow you to change the backend without having
> to do PT walk to update the backend, or repeating the logic at every
> backend level. The "V" in VFS, so to speak.
>
> Similar with the other items on the list - memsw for e.g. I made a
> best effort attempt at least to make vswap work with memsw, but memsw
> in cgroupv2 is its own conversation.
>
> >
> > I don't know why I couldn't join meeting last time, I tried at 8:05am at
> > my side, kept waiting for people to approve me until 8:30am I was
> > added. Not sure if you guys also talked about this.
>
> Hmm maybe I missed that notifications? Apologies if that's the case -
> I do remember letting you in but I wasn't sure at which time. But you
> were eventually in right? I remember you commenting on some
> overcommiting stuff.
TBH It's unfortunate that Baoquan missed about half of the meeting :(
, a lot of shared context was lost there. We can have another sync to
get everyone back on the same page.
On the tiering topic, we've recently seen an increasing growing demand
for swap tiering, due to LLM sandboxes. This is fairly new to me too,
I mean the underlying tech stack itself is nothing new, but the
requirements are quite different, and tiering fits really well there.
I do hope we can collaborate better on this.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-29 17:25 ` Kairui Song
@ 2026-11-29 22:12 ` Chris Li
0 siblings, 0 replies; 9+ messages in thread
From: Chris Li @ 2026-11-29 22:12 UTC (permalink / raw)
To: Kairui Song
Cc: Nhat Pham, Luka Bai, Baoquan He, David Hildenbrand (Arm),
Johannes Weiner, Michal Hocko, Roman Gushchin, Shakeel Butt,
Muchun Song, Kemeng Shi, Barry Song, YoungJun Park,
Chengming Zhou, Lorenzo Stoakes (Oracle),
Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Rik van Riel, Wei Xu, Yosry Ahmed
On Sun, Nov 29, 2026 at 9:25 AM Kairui Song <ryncsn@gmail.com> wrote:
>
> On Fri, Nov 27, 2026 at 1:30 AM Nhat Pham <nphamcs@gmail.com> wrote:
> > Hmm maybe I missed that notifications? Apologies if that's the case -
> > I do remember letting you in but I wasn't sure at which time. But you
> > were eventually in right? I remember you commenting on some
> > overcommiting stuff.
He was admitted to the meeting late, and the same thing happened with
his rejoining attempt from the waiting room.
> TBH It's unfortunate that Baoquan missed about half of the meeting :(
> , a lot of shared context was lost there. We can have another sync to
> get everyone back on the same page.
I took the liberty of sending an invite for this coming Thursday
Pacific time. Let's put some discussion there. I would also like to
discuss some other swap-related topics there as well. Sorry for the
repeated event spam. I will set an end date properly next time.
> On the tiering topic, we've recently seen an increasing growing demand
> for swap tiering, due to LLM sandboxes. This is fairly new to me too,
> I mean the underlying tech stack itself is nothing new, but the
> requirements are quite different, and tiering fits really well there.
>
> I do hope we can collaborate better on this.
Yes, the VM usage and the LLM sandboxes are something I am very
interested in supporting as well. Let's see some proposals.
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Virtual Swap Sync
2026-11-29 16:40 ` Kairui Song
@ 2026-11-30 2:40 ` Rik van Riel
0 siblings, 0 replies; 9+ messages in thread
From: Rik van Riel @ 2026-11-30 2:40 UTC (permalink / raw)
To: Kairui Song, Nhat Pham
Cc: David Hildenbrand (Arm),
Johannes Weiner, Chris Li, Baoquan He, Michal Hocko,
Roman Gushchin, Shakeel Butt, Muchun Song, Kemeng Shi,
Barry Song, YoungJun Park, Chengming Zhou,
Lorenzo Stoakes (Oracle), Liam R. Howlett, Vlastimil Babka (SUSE),
Mike Rapoport, Suren Baghdasaryan,
Qi Zheng, Axel Rasmussen, Yuanchu Xie, Gregory Price,
Wenchao Hao, Jonathan Corbet, Hugh Dickins, Baolin Wang,
Tejun Heo, Michal Koutný,
Shuah Khan, Kunwu Chan, Meta kernel team,
Linux Memory Management List, Linux Kernel Mailing List,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
Andrew Morton, Joshua Hahn, Wei Xu, Yosry Ahmed
On Mon, 2026-11-30 at 00:40 +0800, Kairui Song wrote:
>
> For this part, it's a bit tricky, it's the logical / virtual part,
> basically like memsw but without cgroups. We need one host-global
> size
> for the logical footprint, enforced by the OOM killer,
Wait, how is a host size limit ...
> In one of our use cases, we give the workload a fixed logical
> footprint, e.g. on a 2G VM with 2G zram, so memset(region, 0xff, 4G)
> will work, memset(region, 0xff, 4G + 2M) will OOM (NOTE, it's not
>
... supposed to solve a use case of multiple
lightweight VMs, that should each have their
own limit?
I don't really understand how those two fit
together.
I'm all for making your use case work, but it
feels like this policy should be a different
layer of the system than the swap subsystem.
What am I missing?
--
All Rights Reversed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-30 2:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 21:06 Virtual Swap Sync Nhat Pham
2026-11-06 12:55 ` David Hildenbrand (Arm)
2026-11-22 15:31 ` Nhat Pham
2026-11-26 6:03 ` Baoquan He
2026-11-26 17:30 ` Nhat Pham
2026-11-29 17:25 ` Kairui Song
2026-11-29 22:12 ` Chris Li
2026-11-29 16:40 ` Kairui Song
2026-11-30 2:40 ` Rik van Riel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®