Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320287 > unrolled thread

Re: [PATCH 16/16] mm/slab: introduce new slab management type, OBJFREELIST_SLAB

Started byJoonsoo Kim <iamjoonsoo.kim@lge.com>
First post2016-01-28 06:00 +0100
Last post2016-01-29 16:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 16/16] mm/slab: introduce new slab management type,  OBJFREELIST_SLAB Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-01-28 06:00 +0100
    Re: [PATCH 16/16] mm/slab: introduce new slab management type,  OBJFREELIST_SLAB Vlastimil Babka <vbabka@suse.cz> - 2016-01-29 16:30 +0100

#1320287 — Re: [PATCH 16/16] mm/slab: introduce new slab management type, OBJFREELIST_SLAB

FromJoonsoo Kim <iamjoonsoo.kim@lge.com>
Date2016-01-28 06:00 +0100
SubjectRe: [PATCH 16/16] mm/slab: introduce new slab management type, OBJFREELIST_SLAB
Message-ID<qVMQz-6q1-11@gated-at.bofh.it>
On Wed, Jan 27, 2016 at 02:35:04PM +0100, Vlastimil Babka wrote:
> On 01/14/2016 06:24 AM, Joonsoo Kim wrote:
> > In fact, I tested another idea implementing OBJFREELIST_SLAB with
> > extendable linked array through another freed object. It can remove
> > memory waste completely but it causes more computational overhead
> > in critical lock path and it seems that overhead outweigh benefit.
> > So, this patch doesn't include it.
> 
> Can you elaborate? Do we actually need an extendable linked array? Why not just
> store the pointer to the next free object into the object, NULL for the last
> one? I.e. a singly-linked list. We should never need to actually traverse it?

As Christoph explained, it's the way SLUB manages freed objects. In SLAB
case, it doesn't want to touch object itself. It's one of main difference
between SLAB and SLUB. These objects are cache-cold now so touching object itself
could cause more cache footprint.

> 
> freeing object obj:
> *obj = page->freelist;
> page->freelist = obj;
> 
> allocating object:
> obj = page->freelist;
> page->freelist = *obj;
> *obj = NULL;
> 
> That means two writes, but if we omit managing page->active, it's not an

It's not just matter of number of instructions as explained above. Touching
more cache line should also be avoided.

Thanks.

[toc] | [next] | [standalone]


#1321835

FromVlastimil Babka <vbabka@suse.cz>
Date2016-01-29 16:30 +0100
Message-ID<qWj9N-553-47@gated-at.bofh.it>
In reply to#1320287
On 01/28/2016 05:51 AM, Joonsoo Kim wrote:
> On Wed, Jan 27, 2016 at 02:35:04PM +0100, Vlastimil Babka wrote:
>> On 01/14/2016 06:24 AM, Joonsoo Kim wrote:
>> > In fact, I tested another idea implementing OBJFREELIST_SLAB with
>> > extendable linked array through another freed object. It can remove
>> > memory waste completely but it causes more computational overhead
>> > in critical lock path and it seems that overhead outweigh benefit.
>> > So, this patch doesn't include it.
>> 
>> Can you elaborate? Do we actually need an extendable linked array? Why not just
>> store the pointer to the next free object into the object, NULL for the last
>> one? I.e. a singly-linked list. We should never need to actually traverse it?
> 
> As Christoph explained, it's the way SLUB manages freed objects. In SLAB
> case, it doesn't want to touch object itself. It's one of main difference
> between SLAB and SLUB. These objects are cache-cold now so touching object itself
> could cause more cache footprint.

Hm I see. Although I wouldn't bet on whether the now-freed object is more or
less cold than the freelist array itself (regardless of its placement) :)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web