From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Christopher Lameter <cl@linux.com>,
Suleiman Souhlal <suleiman@google.com>,
Greg Thelen <gthelen@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Linux MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] slab, slub: remove size disparity on debug kernel
Date: Wed, 14 Mar 2018 11:43:29 +0300 [thread overview]
Message-ID: <20180314084329.y7735ecw2is5i5pd@esperanza> (raw)
In-Reply-To: <CALvZod4qa39QJqCr3n6UqzdD6pfLAQ3Rix6zm9_1pQkfQCDa7Q@mail.gmail.com>
On Tue, Mar 13, 2018 at 10:36:52AM -0700, Shakeel Butt wrote:
> On Tue, Mar 13, 2018 at 10:19 AM, Christopher Lameter <cl@linux.com> wrote:
> > On Tue, 13 Mar 2018, Shakeel Butt wrote:
> >
> >> However for SLUB in debug kernel, the sizes were same. On further
> >> inspection it is found that SLUB always use kmem_cache.object_size to
> >> measure the kmem_cache.size while SLAB use the given kmem_cache.size. In
> >> the debug kernel the slab's size can be larger than its object_size.
> >> Thus in the creation of non-root slab, the SLAB uses the root's size as
> >> base to calculate the non-root slab's size and thus non-root slab's size
> >> can be larger than the root slab's size. For SLUB, the non-root slab's
> >> size is measured based on the root's object_size and thus the size will
> >> remain same for root and non-root slab.
> >
> > Note that the object_size and size may differ for SLUB based on kernel
> > parameters and slab configuration. For SLAB these are compilation options.
> >
>
> Thanks for the explanation.
>
> >> @@ -379,7 +379,7 @@ struct kmem_cache *find_mergeable(unsigned int size, unsigned int align,
> >> }
> >>
> >> static struct kmem_cache *create_cache(const char *name,
> >> - unsigned int object_size, unsigned int size, unsigned int align,
> >> + unsigned int object_size, unsigned int align,
> >> slab_flags_t flags, unsigned int useroffset,
> >
> > Why was both the size and object_size passed during cache creation in the
> > first place? From the flags etc the slab logic should be able to compute
> > the actual bytes required for each object and its metadata.
> >
>
> +Vladimir
>
> I think it was introduced by 794b1248be4e7 ("memcg, slab: separate
> memcg vs root cache creation paths") but I could not find out the
> reason.
This was a mistake - I missed that __kmem_cache_create() overwrites
kmem_cache->size. Thanks for fixing this.
next prev parent reply other threads:[~2018-03-14 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 16:54 Shakeel Butt
2018-03-13 17:19 ` Christopher Lameter
2018-03-13 17:36 ` Shakeel Butt
2018-03-14 8:43 ` Vladimir Davydov [this message]
2018-03-14 17:02 ` Shakeel Butt
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=20180314084329.y7735ecw2is5i5pd@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=gthelen@google.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=shakeelb@google.com \
--cc=suleiman@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox