From: Dave Peterson <dsp@llnl.gov>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
riel@surriel.com, akpm@osdl.org
Subject: Re: [PATCH 1/2] mm: serialize OOM kill operations
Date: Thu, 27 Apr 2006 09:56:15 -0700 [thread overview]
Message-ID: <200604270956.15658.dsp@llnl.gov> (raw)
In-Reply-To: <44503BA2.7000405@yahoo.com.au>
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
WARNING: multiple messages have this Message-ID (diff)
From: Dave Peterson <dsp@llnl.gov>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
riel@surriel.com, akpm@osdl.org
Subject: Re: [PATCH 1/2] mm: serialize OOM kill operations
Date: Thu, 27 Apr 2006 09:56:15 -0700 [thread overview]
Message-ID: <200604270956.15658.dsp@llnl.gov> (raw)
In-Reply-To: <44503BA2.7000405@yahoo.com.au>
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, 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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-04-27 16:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-26 0:01 [PATCH 1/2] mm: serialize OOM kill operations Dave Peterson
2006-04-26 0:01 ` Dave Peterson
2006-04-26 4:10 ` Nick Piggin
2006-04-26 4:10 ` Nick Piggin
2006-04-26 17:14 ` Dave Peterson
2006-04-26 17:14 ` Dave Peterson
2006-04-27 3:33 ` Nick Piggin
2006-04-27 3:33 ` Nick Piggin
2006-04-27 16:56 ` Dave Peterson [this message]
2006-04-27 16:56 ` Dave Peterson
2006-04-28 5:00 ` Nick Piggin
2006-04-28 5:00 ` Nick Piggin
2006-04-28 5:05 ` Nick Piggin
2006-04-28 5:05 ` Nick Piggin
2006-04-26 4:46 ` Andi Kleen
2006-04-26 17:15 ` Dave Peterson
2006-04-26 18:05 ` Andi Kleen
2006-04-26 18:29 ` Dave Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604270956.15658.dsp@llnl.gov \
--to=dsp@llnl.gov \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
--cc=riel@surriel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.