From: Joonsoo Kim <js1304@gmail.com>
To: Christoph Lameter <cl@linux.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Jesper Dangaard Brouer <brouer@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>,
Linux Memory Management List <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH v2 16/17] mm/slab: introduce new slab management type, OBJFREELIST_SLAB
Date: Sat, 27 Feb 2016 02:06:21 +0900 [thread overview]
Message-ID: <CAAmzW4Ps9T5f1EW31svFkTnr2ta+hVEmmiO5JdthN09nL3nSWw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1602261017050.24939@east.gentwo.org>
2016-02-27 1:21 GMT+09:00 Christoph Lameter <cl@linux.com>:
> On Fri, 26 Feb 2016, js1304@gmail.com wrote:
>
>> Although this idea can apply to all caches whose size is larger than
>> management array size, it isn't applied to caches which have a
>> constructor. If such cache's object is used for management array,
>> constructor should be called for it before that object is returned to
>> user. I guess that overhead overwhelm benefit in that case so this idea
>> doesn't applied to them at least now.
>
> Caches which have a constructor (or are used with SLAB_RCU_FREE) have a
> defined content even when they are free. Therefore they cannot be used
> for the freelist.
Yes, I know. I already handled it. I attach related hunk.
+static bool set_objfreelist_slab_cache(struct kmem_cache *cachep,
+ size_t size, unsigned long flags)
+{
+ size_t left;
+
+ cachep->num = 0;
+
+ if (cachep->ctor || flags & SLAB_DESTROY_BY_RCU)
+ return false;
So, if there is ctor or RCU slabs, objfreelist will not be used.
>> For summary, from now on, slab management type is determined by
>> following logic.
>>
>> 1) if management array size is smaller than object size and no ctor, it
>> becomes OBJFREELIST_SLAB.
>
> Also do not do this for RCU slabs.
Explained above.
>> 2) if management array size is smaller than leftover, it becomes
>> NORMAL_SLAB which uses leftover as a array.
>>
>> 3) if OFF_SLAB help to save memory than way 4), it becomes OFF_SLAB.
>> It allocate a management array from the other cache so memory waste
>> happens.
>
> Wonder how many of these ugly off slabs are left after what you did here.
See below result.
>> TOTAL = OBJFREELIST + NORMAL(leftover) + NORMAL + OFF
>>
>> /Before/
>> 126 = 0 + 60 + 25 + 41
>>
>> /After/
>> 126 = 97 + 12 + 15 + 2
97 is the number of 1) type caches.
12 is the number of 2) type caches.
and so on...
>> Result shows that number of caches that doesn't waste memory increase
>> from 60 to 109.
>
> Great results.
Thanks. :)
>> v2: fix SLAB_DESTROTY_BY_RCU cache type handling
>
> Ok how are they handled now? Do not see that dealt with in the patch.
Explained above.
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>
next prev parent reply other threads:[~2016-02-26 17:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 6:01 [PATCH v2 00/17] mm/slab: introduce new freed objects management way, OBJFREELIST_SLAB js1304
2016-02-26 6:01 ` [PATCH v2 01/17] mm/slab: fix stale code comment js1304
2016-02-26 6:01 ` [PATCH v2 02/17] mm/slab: remove useless structure define js1304
2016-02-26 6:01 ` [PATCH v2 03/17] mm/slab: remove the checks for slab implementation bug js1304
2016-02-26 16:05 ` Christoph Lameter
2016-02-26 6:01 ` [PATCH v2 04/17] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled js1304
2016-02-26 16:06 ` Christoph Lameter
2016-02-26 6:01 ` [PATCH v2 05/17] mm/slab: use more appropriate condition check for debug_pagealloc js1304
2016-02-26 16:08 ` Christoph Lameter
2016-02-26 6:01 ` [PATCH v2 06/17] mm/slab: clean up DEBUG_PAGEALLOC processing code js1304
2016-02-26 6:01 ` [PATCH v2 07/17] mm/slab: alternative implementation for DEBUG_SLAB_LEAK js1304
2016-02-26 6:01 ` [PATCH v2 08/17] mm/slab: remove object status buffer " js1304
2016-02-26 6:01 ` [PATCH v2 09/17] mm/slab: put the freelist at the end of slab page js1304
2016-02-26 6:01 ` [PATCH v2 10/17] mm/slab: align cache size first before determination of OFF_SLAB candidate js1304
2016-02-26 6:01 ` [PATCH v2 11/17] mm/slab: clean up cache type determination js1304
2016-02-26 6:01 ` [PATCH v2 12/17] mm/slab: do not change cache size if debug pagealloc isn't possible js1304
2016-02-26 16:13 ` Christoph Lameter
2016-02-26 17:02 ` Joonsoo Kim
2016-02-26 6:01 ` [PATCH v2 13/17] mm/slab: make criteria for off slab determination robust and simple js1304
2016-02-26 6:01 ` [PATCH v2 14/17] mm/slab: factor out slab list fixup code js1304
2016-02-26 6:01 ` [PATCH v2 15/17] mm/slab: factor out debugging initialization in cache_init_objs() js1304
2016-02-26 6:01 ` [PATCH v2 16/17] mm/slab: introduce new slab management type, OBJFREELIST_SLAB js1304
2016-02-26 16:21 ` Christoph Lameter
2016-02-26 17:06 ` Joonsoo Kim [this message]
2016-02-26 6:01 ` [PATCH v2 17/17] mm/slab: avoid returning values by reference js1304
2016-02-26 16:22 ` Christoph Lameter
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=CAAmzW4Ps9T5f1EW31svFkTnr2ta+hVEmmiO5JdthN09nL3nSWw@mail.gmail.com \
--to=js1304@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=brouer@redhat.com \
--cc=cl@linux.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=vbabka@suse.cz \
/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