Hello, Jose Luis Alarcon Sanchez, le ven. 17 juil. 2026 13:31:49 +0200, a ecrit: > Since the v1 patch left a TODO about how to derive the initial > size_cur_limit/size_max_limit from swap size, I ran a small experiment > varying RAM and swap to see how ulimit -v responds: > > RAM 3 GB, swap 128 MB -> ulimit -v ~= 3,145,728 KB (~3 GiB) > RAM 4 GB, swap 6 GiB -> ulimit -v = 4,194,104 KB > RAM 4 GB, swap 20 GiB -> ulimit -v = 4,194,104 KB (identical, swap increase > had zero effect) > > The swap was added as a second QEMU virtual disk (wd1), with a proper Linux > swap signature written via mkswap on the host image before swapon inside the > guest. I also fully rebooted the guest with the 20 GiB swap already present > from boot, to rule out the limit being computed once at boot from a smaller > swap snapshot — result was unchanged. > > This looks consistent with: limit = min(available RAM+swap, ~4 GiB fixed > ceiling).
This is consistent, but this does not check what is actually true :) Try with 3G RAM and 1GB swap, and that will give you only 3GB ulimit -v. The formula commited to the kernel is way simpler: it's simply the available RAM. That is because there is currently no way for the pager to tell the kernel how much swap space there is. > Given that JSC needs a full 4 GiB (4,194,304 KB) contiguous reservation for > structureIDMask, Eh? Why does it need such a large thing? How can it run on a Linux system which has less than 4GB or ram+swap? > and the observed ceiling sits 200 KB short of that, this would explain why > surf/luakit fail on any system that ends up at or above that ceiling — no > amount of extra swap/RAM will help once you're past it. More than 4GB RAM should help with it. > 1. Is ~4 GiB a deliberate hardcoded default ceiling (rather than something > meant to scale with RAM+swap beyond that point)? As mentioned above, there is no such hardcoded ceiling. It's just RAM limit. > 2. Is there already a userspace way to invoke vm_set_size_limit to raise the > limit for a specific task (or system-wide), ulimit -v is the way. Note that it is privileged, though, so you have to call it as root and then switch to the user you can to run as. Or you can use sudo and add e.g. Defaults rlimit_as=5000000000 in the sudoers file. Samuel
