lkml.org 
[lkml]   [2009]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: upcoming kerneloops.org item: get_page_from_freelist
On Tue, 30 Jun 2009, Mel Gorman wrote:

> > This will panic the machine if current is the only user thread running or
> > eligible for oom kill (all others could have mm's with OOM_DISABLE set).
> > Currently, such tasks can exit or kthreads can free memory so that the oom
> > is recoverable.
> >
>
> Good point, would the following be ok instead?
>
> + if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
> + if (p == current) {
> + chosen = ERR_PTR(-1UL);
> + continue;
> + } else
> + return ERR_PTR(-1UL);
>

Yes, if you wanted to allow multiple threads to have TIF_MEMDIE set.

> > The problem with this approach is that it increases the liklihood that
> > memory reserves will be totally depleted when several threads are
> > competing for them.
> >
>
> How so?
>

We automatically oom kill current if it's PF_EXITING to give it TIF_MEMDIE
because we know it's on the exit path, this avoids allowing them to
allocate below the min watermark for the allocation that triggered the
oom, which could be significant.

If several threads are ooming at the same time, which happens quite often
for non-cpuset and non-memcg constrained ooms (and those not restricted to
lowmem), we could now potentially have nr_cpus threads with TIF_MEMDIE set
simultaneously, which increases the liklihood that memory reserves will be
fully depleted after each allocation that triggered the oom killer now
succeeds because of ALLOC_NO_WATERMARKS. This is somewhat mitigated by
the oom killer serialization done on the zonelist, but nothing guarantees
that reserves aren't empty before one of the threads has detached its
->mm.

oom_kill_task() SIGKILLs threads sharing ->mm with different tgid's
instead of giving them access to memory reserves specifically to avoid
this.


\
 
 \ /
  Last update: 2009-06-30 22:53    [W:0.143 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site