From: David Rientjes <rientjes@google.com>
To: Karol Lewandowski <karol.k.lewandowski@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Kernel Testers List <kernel-testers@vger.kernel.org>,
Mel Gorman <mel@csn.ul.ie>, Frans Pop <elendil@planet.nl>,
Pekka Enberg <penberg@cs.helsinki.fi>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Mohamed Abbas <mohamed.abbas@intel.com>,
"John W. Linville" <linville@tuxdriver.com>,
linux-mm@kvack.org, jens.axboe@oracle.com,
Tobias Oetiker <tobi@oetiker.ch>
Subject: Re: [PATCH] SLUB: Don't drop __GFP_NOFAIL completely from allocate_slab() (was: Re: [Bug #14265] ifconfig: page allocation failure. order:5,ode:0x8020 w/ e100)
Date: Wed, 21 Oct 2009 14:06:41 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.00.0910211400140.20010@chino.kir.corp.google.com> (raw)
In-Reply-To: <20091021200442.GA2987@bizet.domek.prywatny>
On Wed, 21 Oct 2009, Karol Lewandowski wrote:
> commit d6849591e042bceb66f1b4513a1df6740d2ad762
> Author: Karol Lewandowski <karol.k.lewandowski@gmail.com>
> Date: Wed Oct 21 21:01:20 2009 +0200
>
> SLUB: Don't drop __GFP_NOFAIL completely from allocate_slab()
>
> Commit ba52270d18fb17ce2cf176b35419dab1e43fe4a3 unconditionally
> cleared __GFP_NOFAIL flag on all allocations.
>
No, it clears __GFP_NOFAIL from the first allocation of oo_order(s->oo).
If that fails (and it's easy to fail, it has __GFP_NORETRY), another
allocation is attempted with oo_order(s->min), for which __GFP_NOFAIL
would be preserved if that's the slab cache's allocflags.
> Preserve this flag on second attempt to allocate page (with possibly
> decreased order).
>
> This should help with bugs #14265, #14141 and similar.
>
> Signed-off-by: Karol Lewandowski <karol.k.lewandowski@gmail.com>
>
> diff --git a/mm/slub.c b/mm/slub.c
> index b627675..ac5db65 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1084,7 +1084,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> {
> struct page *page;
> struct kmem_cache_order_objects oo = s->oo;
> - gfp_t alloc_gfp;
> + gfp_t alloc_gfp, nofail;
>
> flags |= s->allocflags;
>
> @@ -1092,6 +1092,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> * Let the initial higher-order allocation fail under memory pressure
> * so we fall-back to the minimum order allocation.
> */
> + nofail = flags & __GFP_NOFAIL;
> alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_NOFAIL;
>
> page = alloc_slab_page(alloc_gfp, node, oo);
> @@ -1100,8 +1101,10 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> /*
> * Allocation may have failed due to fragmentation.
> * Try a lower order alloc if possible
> + *
> + * Preserve __GFP_NOFAIL flag if previous allocation failed.
> */
> - page = alloc_slab_page(flags, node, oo);
> + page = alloc_slab_page(flags | nofail, node, oo);
> if (!page)
> return NULL;
>
>
This does nothing. You may have missed that the lower order allocation is
passing 'flags' (which is a union of the gfp flags passed to
allocate_slab() based on the allocation context and the cache's
allocflags), and not alloc_gfp where __GFP_NOFAIL is masked.
Nack.
Note: slub isn't going to be a culprit in order 5 allocation failures
since they have kmalloc passthrough to the page allocator.
--
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:[~2009-10-21 21:06 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3onW63eFtRF.A.xXH.oMTxKB@chimera>
[not found] ` <COE24pZSBH.A.k2B.ZNTxKB@chimera>
[not found] ` <200910021111.55749.elendil@planet.nl>
2009-10-05 5:13 ` [Bug #14141] order 2 page allocation failures in iwlagn Frans Pop
2009-10-05 6:50 ` Frans Pop
2009-10-05 8:54 ` Frans Pop
2009-10-05 8:57 ` Mel Gorman
2009-10-05 21:34 ` Frans Pop
2009-10-06 0:04 ` David Rientjes
2009-10-06 1:25 ` KOSAKI Motohiro
2009-10-06 8:53 ` Mel Gorman
2009-10-06 9:14 ` David Rientjes
2009-10-06 9:22 ` Mel Gorman
2009-10-06 10:23 ` Frans Pop
2009-10-11 23:10 ` Frans Pop
2009-10-11 23:36 ` Frans Pop
2009-10-12 13:43 ` Mel Gorman
2009-10-12 17:32 ` Frans Pop
2009-10-12 18:43 ` Mel Gorman
2009-10-13 20:38 ` Frans Pop
2009-10-14 10:30 ` Mel Gorman
2009-10-14 13:10 ` Frans Pop
2009-10-14 15:40 ` Mel Gorman
2009-10-14 16:13 ` Frans Pop
2009-10-14 18:34 ` Frans Pop
2009-10-14 23:56 ` Mel Gorman
2009-10-15 20:15 ` Frans Pop
2009-10-16 9:39 ` Mel Gorman
2009-10-14 16:30 ` reinette chatre
2009-10-18 23:33 ` Frans Pop
2009-10-19 0:36 ` Pekka Enberg
2009-10-19 2:44 ` Frans Pop
2009-10-19 9:49 ` [Bug #14141] order 2 page allocation failures (generic) Tobi Oetiker
2009-10-19 9:54 ` Pekka Enberg
2009-10-19 14:01 ` Karol Lewandowski
2009-10-19 14:06 ` Mel Gorman
2009-10-19 17:09 ` Karol Lewandowski
2009-10-20 1:47 ` Karol Lewandowski
2009-10-19 13:31 ` Mel Gorman
2009-10-19 13:40 ` Tobias Oetiker
2009-10-19 14:09 ` Mel Gorman
2009-10-19 14:16 ` Tobias Oetiker
2009-10-19 14:59 ` Mel Gorman
2009-10-19 20:12 ` Tobias Oetiker
2009-10-19 20:17 ` Tobias Oetiker
2009-10-20 10:57 ` Mel Gorman
2009-10-20 11:44 ` Tobias Oetiker
2009-10-20 12:51 ` Mel Gorman
2009-10-20 12:58 ` Tobias Oetiker
2009-10-20 13:39 ` Mel Gorman
2009-10-20 13:50 ` Tobias Oetiker
2009-10-20 14:14 ` Mel Gorman
2009-10-20 14:20 ` Tobias Oetiker
2009-10-22 10:27 ` Tobias Oetiker
2009-10-19 2:52 ` [Bug #14141] order 2 page allocation failures in iwlagn Jens Axboe
2009-10-19 14:01 ` Mel Gorman
2009-10-19 16:18 ` Chris Mason
2009-10-19 17:01 ` Christoph Hellwig
2009-10-19 21:57 ` Chris Mason
2009-10-19 17:01 ` Christoph Hellwig
2009-10-20 10:48 ` Mel Gorman
2009-10-20 10:48 ` Mel Gorman
2009-10-26 21:06 ` Frans Pop
2009-10-27 14:54 ` Mel Gorman
2009-10-27 15:16 ` KOSAKI Motohiro
2009-10-27 15:21 ` Mel Gorman
2009-10-27 15:52 ` Mel Gorman
2009-10-27 16:03 ` Chris Mason
2009-10-27 17:21 ` Frans Pop
2009-10-27 17:21 ` Frans Pop
2009-11-05 20:14 ` Frans Pop
2009-11-06 9:51 ` Frans Pop
2009-11-09 19:00 ` Mel Gorman
2009-10-25 18:54 ` Frans Pop
2009-10-14 16:28 ` reinette chatre
2009-10-14 16:50 ` Mel Gorman
2009-10-14 20:41 ` reinette chatre
2009-10-14 21:33 ` Frans Pop
2009-10-14 21:55 ` reinette chatre
2009-10-15 2:02 ` Frans Pop
2009-10-15 15:29 ` reinette chatre
2009-10-15 19:41 ` Frans Pop
2009-10-16 17:21 ` reinette chatre
2009-10-17 5:42 ` reinette chatre
2009-10-27 11:10 ` Frans Pop
2009-10-27 16:15 ` reinette chatre
[not found] ` <COE24pZSBH.A.rP.2MTxKB@chimera>
2009-10-21 20:04 ` [PATCH] SLUB: Don't drop __GFP_NOFAIL completely from allocate_slab() (was: Re: [Bug #14265] ifconfig: page allocation failure. order:5,ode:0x8020 w/ e100) Karol Lewandowski
2009-10-21 21:06 ` David Rientjes [this message]
2009-10-21 21:20 ` Karol Lewandowski
2009-10-22 10:20 ` Mel Gorman
2009-10-22 21:33 ` Karol Lewandowski
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=alpine.DEB.2.00.0910211400140.20010@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=bzolnier@gmail.com \
--cc=elendil@planet.nl \
--cc=jens.axboe@oracle.com \
--cc=karol.k.lewandowski@gmail.com \
--cc=kernel-testers@vger.kernel.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linville@tuxdriver.com \
--cc=mel@csn.ul.ie \
--cc=mohamed.abbas@intel.com \
--cc=penberg@cs.helsinki.fi \
--cc=reinette.chatre@intel.com \
--cc=rjw@sisk.pl \
--cc=tobi@oetiker.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox