2011-04-26 02:43:44

by Dave Young

[permalink] [raw]
Subject: [PATCH] use oom_killer_disabled in all oom pathes

oom_killer_disable should be a global switch, also fit for oom paths
other than __alloc_pages_slowpath

Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.

Signed-off-by: Dave Young <[email protected]>
---
mm/memcontrol.c | 2 +-
mm/oom_kill.c | 3 +++

2 files changed, 4 insertions(+), 1 deletion(-)
--- linux-2.6.orig/mm/memcontrol.c 2011-04-20 15:49:10.336660690 +0800
+++ linux-2.6/mm/memcontrol.c 2011-04-26 10:41:04.746459757 +0800
@@ -1610,7 +1610,7 @@ bool mem_cgroup_handle_oom(struct mem_cg
* under OOM is always welcomed, use TASK_KILLABLE here.
*/
prepare_to_wait(&memcg_oom_waitq, &owait.wait, TASK_KILLABLE);
- if (!locked || mem->oom_kill_disable)
+ if (!locked || mem->oom_kill_disable || oom_killer_disabled)
need_to_kill = false;
if (locked)
mem_cgroup_oom_notify(mem);
--- linux-2.6.orig/mm/oom_kill.c 2011-04-20 15:49:10.353327356 +0800
+++ linux-2.6/mm/oom_kill.c 2011-04-26 10:41:04.753126423 +0800
@@ -747,6 +747,9 @@ out:
*/
void pagefault_out_of_memory(void)
{
+ if (oom_killer_disabled)
+ return;
+
if (try_set_system_oom()) {
out_of_memory(NULL, 0, 0, NULL);
clear_system_oom();


2011-04-26 02:57:17

by KOSAKI Motohiro

[permalink] [raw]
Subject: Re: [PATCH] use oom_killer_disabled in all oom pathes

> oom_killer_disable should be a global switch, also fit for oom paths
> other than __alloc_pages_slowpath
>
> Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.

Can you please explain more? Why should? Now oom_killer_disabled is used
only hibernation path. so, Why pagefault and memcg allocation will be happen?



2011-04-26 03:05:22

by Dave Young

[permalink] [raw]
Subject: Re: [PATCH] use oom_killer_disabled in all oom pathes

On Tue, Apr 26, 2011 at 10:57 AM, KOSAKI Motohiro
<[email protected]> wrote:
>> oom_killer_disable should be a global switch, also fit for oom paths
>> other than __alloc_pages_slowpath
>>
>> Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.
>
> Can you please explain more? Why should? Now oom_killer_disabled is used
> only hibernation path. so, Why pagefault and memcg allocation will be happen?

Indeed I'm using it in virtio balloon test, oom killer triggered when
memory pressure is high.

literally oom_killer_disabled scope should be global, isn't it?

--
Regards
dave

2011-04-26 03:14:08

by KOSAKI Motohiro

[permalink] [raw]
Subject: Re: [PATCH] use oom_killer_disabled in all oom pathes

> On Tue, Apr 26, 2011 at 10:57 AM, KOSAKI Motohiro
> <[email protected]> wrote:
> >> oom_killer_disable should be a global switch, also fit for oom paths
> >> other than __alloc_pages_slowpath
> >>
> >> Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.
> >
> > Can you please explain more? Why should? Now oom_killer_disabled is used
> > only hibernation path. so, Why pagefault and memcg allocation will be happen?
>
> Indeed I'm using it in virtio balloon test, oom killer triggered when
> memory pressure is high.
>
> literally oom_killer_disabled scope should be global, isn't it?

ok. virtio baloon seems fair usage. if you add new usage of oom_killer_disabled
into the patch description, I'll ack this one.

thanks.

2011-04-26 03:19:24

by Dave Young

[permalink] [raw]
Subject: Re: [PATCH] use oom_killer_disabled in all oom pathes

On Tue, Apr 26, 2011 at 11:14 AM, KOSAKI Motohiro
<[email protected]> wrote:
>> On Tue, Apr 26, 2011 at 10:57 AM, KOSAKI Motohiro
>> <[email protected]> wrote:
>> >> oom_killer_disable should be a global switch, also fit for oom paths
>> >> other than __alloc_pages_slowpath
>> >>
>> >> Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.
>> >
>> > Can you please explain more? Why should? Now oom_killer_disabled is used
>> > only hibernation path. so, Why pagefault and memcg allocation will be happen?
>>
>> Indeed I'm using it in virtio balloon test, oom killer triggered when
>> memory pressure is high.
>>
>> literally oom_killer_disabled scope should be global, isn't it?
>
> ok. virtio baloon seems fair usage. if you add new usage of oom_killer_disabled
> into the patch description, I'll ack this one.

Thanks, then I will resend the virtio balloon patch along with this.

--
Regards
dave

2011-04-26 03:23:56

by Kamezawa Hiroyuki

[permalink] [raw]
Subject: Re: [PATCH] use oom_killer_disabled in all oom pathes

On Tue, 26 Apr 2011 11:19:22 +0800
Dave Young <[email protected]> wrote:

> On Tue, Apr 26, 2011 at 11:14 AM, KOSAKI Motohiro
> <[email protected]> wrote:
> >> On Tue, Apr 26, 2011 at 10:57 AM, KOSAKI Motohiro
> >> <[email protected]> wrote:
> >> >> oom_killer_disable should be a global switch, also fit for oom paths
> >> >> other than __alloc_pages_slowpath
> >> >>
> >> >> Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.
> >> >
> >> > Can you please explain more? Why should? Now oom_killer_disabled is used
> >> > only hibernation path. so, Why pagefault and memcg allocation will be happen?
> >>
> >> Indeed I'm using it in virtio balloon test, oom killer triggered when
> >> memory pressure is high.
> >>
> >> literally oom_killer_disabled scope should be global, isn't it?
> >
> > ok. virtio baloon seems fair usage. if you add new usage of oom_killer_disabled
> > into the patch description, I'll ack this one.
>
> Thanks, then I will resend the virtio balloon patch along with this.
>

Amount of free memory doesn't affect memory cgroup's OOM because it just works
against the limit. So, the code for memcg isn't necessary.


Thanks,
-Kame

2011-04-26 03:26:23

by Dave Young

[permalink] [raw]
Subject: Re: [PATCH] use oom_killer_disabled in all oom pathes

On Tue, Apr 26, 2011 at 11:17 AM, KAMEZAWA Hiroyuki
<[email protected]> wrote:
> On Tue, 26 Apr 2011 11:19:22 +0800
> Dave Young <[email protected]> wrote:
>
>> On Tue, Apr 26, 2011 at 11:14 AM, KOSAKI Motohiro
>> <[email protected]> wrote:
>> >> On Tue, Apr 26, 2011 at 10:57 AM, KOSAKI Motohiro
>> >> <[email protected]> wrote:
>> >> >> oom_killer_disable should be a global switch, also fit for oom paths
>> >> >> other than __alloc_pages_slowpath
>> >> >>
>> >> >> Here add it to mem_cgroup_handle_oom and pagefault_out_of_memory as well.
>> >> >
>> >> > Can you please explain more? Why should? Now oom_killer_disabled is used
>> >> > only hibernation path. so, Why pagefault and memcg allocation will be happen?
>> >>
>> >> Indeed I'm using it in virtio balloon test, oom killer triggered when
>> >> memory pressure is high.
>> >>
>> >> literally oom_killer_disabled scope should be global, isn't it?
>> >
>> > ok. virtio baloon seems fair usage. if you add new usage of oom_killer_disabled
>> > into the patch description, I'll ack this one.
>>
>> Thanks, then I will resend the virtio balloon patch along with this.
>>
>
> Amount of free memory doesn't affect memory cgroup's OOM because it just works
> against the limit. So, the code for memcg isn't necessary.

Right, thanks for pointing out this, will remove the memcg part
>
>
> Thanks,
> -Kame
>
>



--
Regards
dave