* cgroups and overcommit question
@ 2011-01-12 15:40 Evgeniy Ivanov
2011-01-13 1:57 ` Daisuke Nishimura
0 siblings, 1 reply; 4+ messages in thread
From: Evgeniy Ivanov @ 2011-01-12 15:40 UTC (permalink / raw)
To: linux-mm
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?
--
Evgeniy Ivanov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. 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@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cgroups and overcommit question
2011-01-12 15:40 cgroups and overcommit question Evgeniy Ivanov
@ 2011-01-13 1:57 ` Daisuke Nishimura
2011-01-13 3:04 ` Balbir Singh
0 siblings, 1 reply; 4+ messages in thread
From: Daisuke Nishimura @ 2011-01-13 1:57 UTC (permalink / raw)
To: Evgeniy Ivanov
Cc: linux-mm, Balbir Singh, KAMEZAWA Hiroyuki, Daisuke Nishimura
Hi.
On Wed, 12 Jan 2011 18:40:37 +0300
Evgeniy Ivanov <lolkaantimat@gmail.com> 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.
Thanks,
Daisuke Nishimura.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. 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@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cgroups and overcommit question
2011-01-13 1:57 ` Daisuke Nishimura
@ 2011-01-13 3:04 ` Balbir Singh
2011-01-13 12:24 ` Evgeniy Ivanov
0 siblings, 1 reply; 4+ messages in thread
From: Balbir Singh @ 2011-01-13 3:04 UTC (permalink / raw)
To: Daisuke Nishimura; +Cc: Evgeniy Ivanov, linux-mm, KAMEZAWA Hiroyuki
* nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2011-01-13 10:57:41]:
> Hi.
>
> On Wed, 12 Jan 2011 18:40:37 +0300
> Evgeniy Ivanov <lolkaantimat@gmail.com> 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.
>
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.
--
Three Cheers,
Balbir
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. 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@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cgroups and overcommit question
2011-01-13 3:04 ` Balbir Singh
@ 2011-01-13 12:24 ` Evgeniy Ivanov
0 siblings, 0 replies; 4+ messages in thread
From: Evgeniy Ivanov @ 2011-01-13 12:24 UTC (permalink / raw)
To: balbir; +Cc: Daisuke Nishimura, linux-mm, KAMEZAWA Hiroyuki
On Thu, Jan 13, 2011 at 6:04 AM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> * nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2011-01-13 10:57:41]:
>
>> Hi.
>>
>> On Wed, 12 Jan 2011 18:40:37 +0300
>> Evgeniy Ivanov <lolkaantimat@gmail.com> 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@kvack.org. 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@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-13 12:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 15:40 cgroups and overcommit question Evgeniy Ivanov
2011-01-13 1:57 ` Daisuke Nishimura
2011-01-13 3:04 ` Balbir Singh
2011-01-13 12:24 ` Evgeniy Ivanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).