Score:0

How to config cgroup v2 to limit only the ram memory and let swap unlimited?

cn flag

Because Ubuntu 21.10 ship with Cgroup V2 and my project seems to need memory limitations I decided to use it, but I have some problems. I need a lot of RAM to test an idea, so because my processor can't accept more than 128G ram I decided to get some RAM from another server as SWAP.
So I mounted a partition from 512G RAM on second server, and used NFS-server to let my first server to access it as a client. Those two servers have a 40Gbps connection between them so is enough speed for me to make the test. On the first server I mounted the NFS partition from the second server and made a swap file on it and I was ready to go with 128G ram and 512G swap.
After I started the test and past over the 128G ram, my server freeze because running utilities have no room to work in ram and I decided to limit the usage of memory with cgroup.

The problem: When I set MemoryHigh limit is working nice, after the limit, is going and fill the swap but is stops at the same limit as RAM. Somehow cgroup limit the use of SWAP at exactly same capacity as RAM memory. So if I set MemoryHigh=110G, I can go 110G on ram and 110G on swap, anyone knows how to config cgroup to let the swap unlimited ?
paint description image

heynnema avatar
ru flag
My gut feeling is that if your project uses 110G RAM and 110G Swap, your project has a real problem... or has a memory leak. Are you manipulating large datasets in RAM? Or using a miner app?
cn flag
No, is intend to use 450G ram. Is nothing wrong with it. At this moment i try to figure out how to unlimit swap memory from cgroup and I downgraded to ubuntu 20.04 to use older version of cgroup, maybe i have luck with it.
ATLief avatar
us flag
@sniper Did you ever find a solution?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.