lkml.org 
[lkml]   [2006]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/2] mm: serialize OOM kill operations
Date
On Wednesday 26 April 2006 20:33, Nick Piggin wrote:
> Dave Peterson wrote:
> >If you prefer the above implementation, I can rework the patch as
> >above.
>
> I think you need a semaphore?

In this particular case, I think a semaphore is unnecessary because
we just want out_of_memory() to return to its caller if an OOM kill
is already in progress (as opposed to waiting in out_of_memory() and
then starting a new OOM kill operation). What I want to avoid is the
the following type of behavior:

1. Two processes (A and B) call out_of_memory() at roughly the
same time and race for oom_kill_lock. Let's say A wins and B
is delayed.

2. Process A shoots some process and releases oom_kill_lock.

3. Process B now acquires oom_kill_lock and shoots another
process. However this isn't really what we want to do if
the OOM kill done by A above freed enough memory to resolve
the OOM condition.

> Either way, drop the trivial wrappers.

Ok, I'll drop the wrappers.

> >>Second, can you arrange it without using the extra field in mm_struct
> >>and operation in the mmput fast path?
> >
> >I'm open to suggestions on other ways of implementing this. However I
> >think the performance impact of the proposed implementation should be
> >miniscule. The code added to mmput() executes only when the referece
> >count has reached 0; not on every decrement of the reference count.
> >Once the reference count has reached 0, the common-case behavior is
> >still only testing a boolean flag followed by a not-taken branch. The
> >use of unlikely() should help the compiler and CPU branch prediction
> >hardware minimize overhead in the typical case where oom_kill_finish()
> >is not called.
>
> Mainly the cost of increasing cacheline footprint. I think someone
> suggested using a flag bit somewhere... that'd be preferable.

Ok, I'll add a ->flags member to mm_struct and just use one bit for
the oom_notify value. Then if other users of mm_struct need flag
bits for other things in the future they can all share ->flags. I'll
rework my patches and repost shortly...

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

\
 
 \ /
  Last update: 2006-04-27 18:59    [W:2.108 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site