From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>, azurIt <azurit@pobox.sk>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org,
Christian Casteyde <casteyde.christian@free.fr>,
Pekka Enberg <penberg@kernel.org>,
Christoph Lameter <cl@linux.com>
Subject: Re: [patch 2/2] fs: buffer: move allocation failure loop into the allocator
Date: Wed, 4 Dec 2013 11:42:03 +0900 [thread overview]
Message-ID: <20131204024203.GB19709@lge.com> (raw)
In-Reply-To: <20131203180717.94c013d1.akpm@linux-foundation.org>
On Tue, Dec 03, 2013 at 06:07:17PM -0800, Andrew Morton wrote:
> On Wed, 4 Dec 2013 10:52:18 +0900 Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
>
> > SLUB already try to allocate high order page with clearing __GFP_NOFAIL.
> > But, when allocating shadow page for kmemcheck, it missed clearing
> > the flag. This trigger WARN_ON_ONCE() reported by Christian Casteyde.
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=65991
> >
> > This patch fix this situation by using same allocation flag as original
> > allocation.
> >
> > Reported-by: Christian Casteyde <casteyde.christian@free.fr>
> > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> >
> > diff --git a/mm/slub.c b/mm/slub.c
> > index 545a170..3dd28b1 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -1335,11 +1335,12 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> > page = alloc_slab_page(alloc_gfp, node, oo);
> > if (unlikely(!page)) {
> > oo = s->min;
>
> What is the value of s->min? Please tell me it's zero.
s->min is calculated by get_order(object size).
So if object size is less or equal than PAGE_SIZE, it would return zero.
>
> > + alloc_gfp = flags;
> > /*
> > * Allocation may have failed due to fragmentation.
> > * Try a lower order alloc if possible
> > */
> > - page = alloc_slab_page(flags, node, oo);
> > + page = alloc_slab_page(alloc_gfp, node, oo);
> >
> > if (page)
> > stat(s, ORDER_FALLBACK);
>
> This change doesn't actually do anything.
It set alloc_gfp to flags and we use alloc_gfp later.
It means that we try to allocate same order and flag as original allocation.
>
> > @@ -1349,7 +1350,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> > && !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
> > int pages = 1 << oo_order(oo);
> >
> > - kmemcheck_alloc_shadow(page, oo_order(oo), flags, node);
> > + kmemcheck_alloc_shadow(page, oo_order(oo), alloc_gfp, node);
>
> That seems reasonable, assuming kmemcheck can handle the allocation
> failure.
Yes, I looked at kmemcheck_alloc_shadow() at a glance, it can handle failure.
>
> Still I dislike this practice of using unnecessarily large allocations.
> What does it gain us? Slightly improved object packing density.
> Anything else?
There is no my likes and dislikes here.
Perhaps, Christoph would answer it.
Thanks.
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>, azurIt <azurit@pobox.sk>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org,
Christian Casteyde <casteyde.christian@free.fr>,
Pekka Enberg <penberg@kernel.org>,
Christoph Lameter <cl@linux.com>
Subject: Re: [patch 2/2] fs: buffer: move allocation failure loop into the allocator
Date: Wed, 4 Dec 2013 11:42:03 +0900 [thread overview]
Message-ID: <20131204024203.GB19709@lge.com> (raw)
In-Reply-To: <20131203180717.94c013d1.akpm@linux-foundation.org>
On Tue, Dec 03, 2013 at 06:07:17PM -0800, Andrew Morton wrote:
> On Wed, 4 Dec 2013 10:52:18 +0900 Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
>
> > SLUB already try to allocate high order page with clearing __GFP_NOFAIL.
> > But, when allocating shadow page for kmemcheck, it missed clearing
> > the flag. This trigger WARN_ON_ONCE() reported by Christian Casteyde.
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=65991
> >
> > This patch fix this situation by using same allocation flag as original
> > allocation.
> >
> > Reported-by: Christian Casteyde <casteyde.christian@free.fr>
> > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> >
> > diff --git a/mm/slub.c b/mm/slub.c
> > index 545a170..3dd28b1 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -1335,11 +1335,12 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> > page = alloc_slab_page(alloc_gfp, node, oo);
> > if (unlikely(!page)) {
> > oo = s->min;
>
> What is the value of s->min? Please tell me it's zero.
s->min is calculated by get_order(object size).
So if object size is less or equal than PAGE_SIZE, it would return zero.
>
> > + alloc_gfp = flags;
> > /*
> > * Allocation may have failed due to fragmentation.
> > * Try a lower order alloc if possible
> > */
> > - page = alloc_slab_page(flags, node, oo);
> > + page = alloc_slab_page(alloc_gfp, node, oo);
> >
> > if (page)
> > stat(s, ORDER_FALLBACK);
>
> This change doesn't actually do anything.
It set alloc_gfp to flags and we use alloc_gfp later.
It means that we try to allocate same order and flag as original allocation.
>
> > @@ -1349,7 +1350,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> > && !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
> > int pages = 1 << oo_order(oo);
> >
> > - kmemcheck_alloc_shadow(page, oo_order(oo), flags, node);
> > + kmemcheck_alloc_shadow(page, oo_order(oo), alloc_gfp, node);
>
> That seems reasonable, assuming kmemcheck can handle the allocation
> failure.
Yes, I looked at kmemcheck_alloc_shadow() at a glance, it can handle failure.
>
> Still I dislike this practice of using unnecessarily large allocations.
> What does it gain us? Slightly improved object packing density.
> Anything else?
There is no my likes and dislikes here.
Perhaps, Christoph would answer it.
Thanks.
next prev parent reply other threads:[~2013-12-04 2:42 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 20:58 [patch 1/2] mm: memcg: handle non-error OOM situations more gracefully Johannes Weiner
2013-10-08 20:58 ` Johannes Weiner
2013-10-08 20:58 ` Johannes Weiner
[not found] ` <1381265890-11333-1-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2013-10-08 20:58 ` [patch 2/2] fs: buffer: move allocation failure loop into the allocator Johannes Weiner
2013-10-08 20:58 ` Johannes Weiner
2013-10-08 20:58 ` Johannes Weiner
2013-10-11 20:51 ` Andrew Morton
2013-10-11 20:51 ` Andrew Morton
2013-12-04 0:59 ` Andrew Morton
2013-12-04 0:59 ` Andrew Morton
[not found] ` <20131203165910.54d6b4724a1f3e329af52ac6-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2013-12-04 1:52 ` Joonsoo Kim
2013-12-04 1:52 ` Joonsoo Kim
2013-12-04 1:52 ` Joonsoo Kim
[not found] ` <20131204015218.GA19709-Hm3cg6mZ9cc@public.gmane.org>
2013-12-04 2:07 ` Andrew Morton
2013-12-04 2:07 ` Andrew Morton
2013-12-04 2:07 ` Andrew Morton
2013-12-04 2:42 ` Joonsoo Kim [this message]
2013-12-04 2:42 ` Joonsoo Kim
[not found] ` <20131203180717.94c013d1.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2013-12-04 15:17 ` Christoph Lameter
2013-12-04 15:17 ` Christoph Lameter
2013-12-04 15:17 ` Christoph Lameter
2013-12-04 16:02 ` Joonsoo Kim
2013-12-04 16:02 ` Joonsoo Kim
2013-12-04 16:33 ` Christoph Lameter
2013-12-04 16:33 ` Christoph Lameter
2013-12-05 8:44 ` Joonsoo Kim
2013-12-05 8:44 ` Joonsoo Kim
2013-12-05 18:50 ` Christoph Lameter
2013-12-05 18:50 ` Christoph Lameter
2013-12-06 8:57 ` Joonsoo Kim
2013-12-06 8:57 ` Joonsoo Kim
2013-12-13 6:58 ` Joonsoo Kim
2013-12-13 6:58 ` Joonsoo Kim
2013-12-13 6:58 ` Joonsoo Kim
2013-12-13 16:40 ` Christoph Lameter
2013-12-13 16:40 ` Christoph Lameter
[not found] ` <00000142ecd51cc6-b987e565-7b4f-4945-89ba-731f1d1376fb-000000-p/GC64/jrecnJqMo6gzdpkEOCMrvLtNR@public.gmane.org>
2013-12-16 8:22 ` Joonsoo Kim
2013-12-16 8:22 ` Joonsoo Kim
2013-12-16 8:22 ` Joonsoo Kim
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=20131204024203.GB19709@lge.com \
--to=iamjoonsoo.kim@lge.com \
--cc=akpm@linux-foundation.org \
--cc=azurit@pobox.sk \
--cc=casteyde.christian@free.fr \
--cc=cgroups@vger.kernel.org \
--cc=cl@linux.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=penberg@kernel.org \
/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.