It's possible to limit a container to 512MB of RAM and 4GB of swap. However, if that container uses memory frequently that has been swapped out wouldn't it dominate the the IO resources of the storage device(s) containing the swap file(s)? What I want to avoid is one container from pinning the storage device at 100% utilization and starving other containers that have more modest demands for swap. Ideally each container should get their fair share under load, and be able to burst beyond that when the load permits.
Now I know there are blkio limits, and it seems quite straightforward to limit those, but it's technically the kernel that's doing the swapping, so I don't know if it respects those limitations or counts page faults towards those limits.
Does anyone know if this is possible or how to configure it if it is?
edit: OpenVZ has something called vswap, which will throttle a container that's swapping even if actually the system has enough slack that the "swap" pages are in RAM and it's not really going to disk for them. That seems to be what I'm after. Is there any way to do that with "vanilla" Linux containers?