On Thu, Jan 13, 2011 at 6:04 AM, Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote: > * nishimura@xxxxxxxxxxxxxxxxx <nishimura@xxxxxxxxxxxxxxxxx> [2011-01-13 10:57:41]: > >> Hi. >> >> On Wed, 12 Jan 2011 18:40:37 +0300 >> Evgeniy Ivanov <lolkaantimat@xxxxxxxxx> wrote: >> >> > Hello, >> > >> > When I forbid memory overcommiting, malloc() returns 0 if can't >> > reserve memory, but in a cgroup it will always succeed, when it can >> > succeed when not in the group. >> > E.g. I've set 2 to overcommit_memory, limit is 10M: I can ask malloc >> > 100M and it will not return any error (kernel is 2.6.32). >> > Is it expected behavior? >> > >> Yes. Because memory cgroup can be used for limiting the memory(and swap) size >> which is physically used, not the malloc'ed size. Yeah, I see. But it doesn't seem complicated/expensive to check (already_charged + malloc_requested) and charge new pages if overcommit disabled. man 5 proc says about vm/overcommit_memory "2: always check, never overcommit". So there should be either a note or malloc within cgroup should be consistent with other part of the system. > I had rlimit based cgroup to limit virtual memory size, but the > patches were never merged due to lack of use cases :( > > See http://lwn.net/Articles/283287/ > > I did advocate as use case the ability to prevent overcommit. I > suspect another way of solving this problem is to have overcommit > control. The problem today is that OOM is our backup to overcommit, > not a very comfortable feeling. I fully agree with you. -- Evgeniy Ivanov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>