Limit private memory usage per user

view story

http://serverfault.com – I'm using cgroups with the memory controller to set a memory limit for each user (using the memory.limit_in_bytes setting). The problem is that this setting also accounts cache usage. Therefore, if the limit is 1GB, and the user merely downloads or copies a 1GB file, their processes get killed. What's worse, the cached pages remain in memory, so the user's "memory usage" remains close to 1GB even when they have zero processes running. Naturally, this makes no sense. I only want to limit total private (non-anonymous) memory usage per user. How can I achieve that? Alternatively, get the OOM k (HowTos)