This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Fixed PR13146 by not allowing memory allocations to sleep
- From: Mark Wielaard <mjw at redhat dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: Josh Stone <jistone at redhat dot com>, systemtap at sourceware dot org, dsmith at redhat dot com
- Date: Mon, 31 Oct 2011 11:26:05 +0100
- Subject: Re: Fixed PR13146 by not allowing memory allocations to sleep
- References: <20110901143940.13672.qmail@sourceware.org> <1317135124.3361.22.camel@springer.wildebeest.org> <4E82481E.8060502@redhat.com> <y0m39ehwa02.fsf@fche.csb> <1319545123.3228.24.camel@springer.wildebeest.org>
On Tue, 2011-10-25 at 14:18 +0200, Mark Wielaard wrote:
> I cannot find what precisely triggers/causes the oom-killer to kick in.
> I hoped a GFP_WILLING_TO_WAIT_BUT_DONT_KILL_ANYBODY_JUST_BECAUSE_OF_ME
> flag would exist, but it isn't clear to me which GFP flag/combination
> that actually corresponds to.
Looking at the kernel sources it seems that flag is __GFP_NORETRY.
Though that isn't a guarantee, it depends on the memory backend. Still
it seems to prevent the oom-killer being triggered on my small memory
setup. So I created STP_ALLOC_SLEEP_FLAGS that includes that flag and
use that whenever we do _stp_alloc request from user context. Note that
this isn't a full "solution" to the oom-killer kicking in. There are
places where GFP_KERNEL is used that we don't control.
commit 6022ccd4cab89944ca390c23de13cdc54cf05b1f
Author: Mark Wielaard <mjw@redhat.com>
Date: Mon Oct 31 10:39:10 2011 +0100
Introduce and use STP_ALLOC_SLEEP_FLAGS for use with gfp alloc
functions.
When in a context where we can wait we like to use normal GFP_KERNEL.
But this might trigger the oom-killer, which might kill out own stapio
process. To suppress this use __GFP_NORETRY. All _stp_[kmz]alloc_gfp
functions that are used in user context should use STP_ALLOC_SLEEP_FLAGS
if appropriate.
Note that the kernel itself may still use GFP_KERNEL. For example
__alloc_percpu() will always use GFP_KERNEL.