Re: [patch -mm v2] mm: introduce oom_adj_child

From: KAMEZAWA Hiroyuki
Date: Thu Jul 30 2009 - 06:04:13 EST


On Thu, 30 Jul 2009 02:31:04 -0700 (PDT)
David Rientjes <rientjes@xxxxxxxxxx> wrote:

> On Thu, 30 Jul 2009, KAMEZAWA Hiroyuki wrote:
>
> > 1. IIUC, the name is strange.
> >
> > At job scheduler, which does this.
> >
> > if (vfork() == 0) {
> > /* do some job */
> > execve(.....)
> > }
> >
> > Then, when oom_adj_child can be effective is after execve().
> > IIUC, the _child_ means a process created by vfork().
> >
>
> It's certainly a difficult thing to name and I don't claim that "child" is
> completely accurate since, as you said, vfork'd tasks are also children
> of the parent yet they share the same oom_adj value since it's an
> attribute of the shared mm.
>
> If you have suggestions for a better name, I'd happily ack it.
>

Simply, reset_oom_adj_at_new_mm_context or some.

> > 2. More simple plan is like this, IIUC.
> >
> > fix oom-killer's select_bad_process() not to be in deadlock.
> >
>
> Alternate ideas?
>
At brief thiking.

1. move oom_adj from mm_struct to signal struct. or somewhere.
(see copy_signal())
Then,
- all threads in a process will have the same oom_adj.
- vfork()'ed thread will inherit its parent's oom_adj.
- vfork()'ed thread can override oom_adj of its own.

In other words, oom_adj is shared when CLONE_PARENT is not set.

2. rename mm_struct's oom_adj as shadow_oom_adj.

update this shadow_oom_adj as the highest oom_adj among
the values all threads share this mm_struct have.
This update is done when
- mm_init()
- oom_adj is written.

User's
# echo XXXX > /proc/<x>/oom_adj
is not necessary to be very very fast.

I don't think a process which calls vfork() is multi-threaded.

3. use shadow_oom_adj in select_bad_process().



> > rather than this new stupid interface.
> >
>
> Well, thank you. Regardless of whether you think it's stupid or not, it
> doesn't allow you to livelock the kernel in a very trivial way when the
> oom killer gets invoked prior to execve() and the parent is OOM_DISABLE.
>


just plz consider more.

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/