All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Mikulas Patocka <mpatocka@redhat.com>,
	Christopher Lameter <cl@linux.com>
Cc: Mike Snitzer <snitzer@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Pekka Enberg <penberg@kernel.org>,
	linux-mm@kvack.org, dm-devel@redhat.com,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: slab: introduce the flag SLAB_MINIMIZE_WASTE
Date: Mon, 16 Apr 2018 21:53:04 +0200	[thread overview]
Message-ID: <b0e6ccf6-06ce-e50b-840e-c8d3072382fd@suse.cz> (raw)
In-Reply-To: <alpine.LRH.2.02.1804161532480.19492@file01.intranet.prod.int.rdu2.redhat.com>

On 04/16/2018 09:36 PM, Mikulas Patocka wrote:
> 
> 
> On Mon, 16 Apr 2018, Christopher Lameter wrote:
> 
>> On Mon, 16 Apr 2018, Mikulas Patocka wrote:
>>
>>>>
>>>> Or an increase in slab_max_order
>>>
>>> But that will increase it for all slabs (often senselessly - i.e.
>>> kmalloc-4096 would have order 4MB).
>>
>> 4MB? Nope.... That is a power of two slab so no wasted space even with
>> order 0.
> 
> See this email:
> https://www.redhat.com/archives/dm-devel/2018-March/msg00387.html
> 
> If you boot with slub_max_order=10, the kmalloc-8192 cache has 64 pages. 
> So yes, it increases the order of all slab caches (although not up to 
> 4MB).
> 
>> Its not a senseless increase. The more objects you fit into a slab page
>> the higher the performance of the allocator.

It's not universally without a cost. It might increase internal
fragmentation of the slabs, if you end up with lots of 4MB pages
containing just few objects. Thus, waste of memory. You also consume
high-order pages that could be used elsewhere. If you fail to allocate
4MB, then what's the fallback, order-0? I doubt it's "the highest
available order". Thus, a more conservative choice e.g. order-3 will
might succeed more in allocating order-3, while a choice of 4MB will
have many order-0 fallbacks.

>>> I need to increase it just for dm-bufio slabs.
>>
>> If you do this then others will want the same...
> 
> If others need it, they can turn on the flag SLAB_MINIMIZE_WASTE too.

I think it should be possible without a new flag. The slub allocator
could just balance priorities (performance vs memory efficiency) better.
Currently I get the impression that "slub_max_order" is a performance
tunable. Let's add another criteria for selecting an order, that would
try to pick an order to minimize wasted space below e.g. 10% with some
different kind of max order. Pick good defaults, add tunables if you must.

I mean, anyone who's creating a cache for 640KB objects most likely
doesn't want to waste another 384KB by each such object. They shouldn't
have to add a flag to let the slub allocator figure out that using 2MB
pages is the right thing to do here.

Vlastimil

> Mikulas
> 

  reply	other threads:[~2018-04-16 19:55 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 17:25 [PATCH] slab: introduce the flag SLAB_MINIMIZE_WASTE Mikulas Patocka
2018-03-20 17:35 ` Matthew Wilcox
2018-03-20 17:35   ` Matthew Wilcox
2018-03-20 17:54   ` Christopher Lameter
2018-03-20 17:54     ` Christopher Lameter
2018-03-20 19:22     ` Mikulas Patocka
2018-03-20 19:22       ` Mikulas Patocka
2018-03-20 20:42       ` Christopher Lameter
2018-03-20 20:42         ` Christopher Lameter
2018-03-20 22:02         ` Mikulas Patocka
2018-03-20 22:02           ` Mikulas Patocka
2018-03-21 15:35           ` Christopher Lameter
2018-03-21 15:35             ` Christopher Lameter
2018-03-21 16:25             ` Mikulas Patocka
2018-03-21 16:25               ` Mikulas Patocka
2018-03-21 17:10               ` Matthew Wilcox
2018-03-21 17:10                 ` Matthew Wilcox
2018-03-21 17:30               ` Christopher Lameter
2018-03-21 17:30                 ` Christopher Lameter
2018-03-21 17:39                 ` Christopher Lameter
2018-03-21 17:39                   ` Christopher Lameter
2018-03-21 17:49                   ` Matthew Wilcox
2018-03-21 17:49                     ` Matthew Wilcox
2018-03-21 18:01                     ` Christopher Lameter
2018-03-21 18:01                       ` Christopher Lameter
2018-03-21 18:23                     ` Mikulas Patocka
2018-03-21 18:23                       ` Mikulas Patocka
2018-03-21 18:40                       ` Christopher Lameter
2018-03-21 18:40                         ` Christopher Lameter
2018-03-21 18:55                         ` Mikulas Patocka
2018-03-21 18:55                           ` Mikulas Patocka
2018-03-21 18:55                         ` Matthew Wilcox
2018-03-21 18:55                           ` Matthew Wilcox
2018-03-21 18:58                           ` Christopher Lameter
2018-03-21 18:58                             ` Christopher Lameter
2018-03-21 19:25                   ` Mikulas Patocka
2018-03-21 19:25                     ` Mikulas Patocka
2018-03-21 18:36                 ` Mikulas Patocka
2018-03-21 18:36                   ` Mikulas Patocka
2018-03-21 18:57                   ` Christopher Lameter
2018-03-21 18:57                     ` Christopher Lameter
2018-03-21 19:19                     ` Mikulas Patocka
2018-03-21 19:19                       ` Mikulas Patocka
2018-03-21 20:09                       ` Christopher Lameter
2018-03-21 20:09                         ` Christopher Lameter
2018-03-21 20:37                         ` Mikulas Patocka
2018-03-21 20:37                           ` Mikulas Patocka
2018-03-23 15:10                           ` Christopher Lameter
2018-03-23 15:10                             ` Christopher Lameter
2018-03-23 15:31                             ` Mikulas Patocka
2018-03-23 15:31                               ` Mikulas Patocka
2018-03-23 15:48                               ` Christopher Lameter
2018-03-23 15:48                                 ` Christopher Lameter
2018-04-13  9:22                   ` Vlastimil Babka
2018-04-13  9:22                     ` Vlastimil Babka
2018-04-13 15:10                     ` Mike Snitzer
2018-04-13 15:10                       ` Mike Snitzer
2018-04-16 12:38                       ` Vlastimil Babka
2018-04-16 12:38                         ` Vlastimil Babka
2018-04-16 14:27                         ` Mike Snitzer
2018-04-16 14:27                           ` Mike Snitzer
2018-04-16 14:37                           ` Mikulas Patocka
2018-04-16 14:37                             ` Mikulas Patocka
2018-04-16 14:46                             ` Mike Snitzer
2018-04-16 14:46                               ` Mike Snitzer
2018-04-16 14:57                               ` Mikulas Patocka
2018-04-16 14:57                                 ` Mikulas Patocka
2018-04-16 15:18                                 ` Christopher Lameter
2018-04-16 15:18                                   ` Christopher Lameter
2018-04-16 15:25                                   ` Mikulas Patocka
2018-04-16 15:25                                     ` Mikulas Patocka
2018-04-16 15:45                                     ` Christopher Lameter
2018-04-16 15:45                                       ` Christopher Lameter
2018-04-16 19:36                                       ` Mikulas Patocka
2018-04-16 19:36                                         ` Mikulas Patocka
2018-04-16 19:53                                         ` Vlastimil Babka [this message]
2018-04-16 21:01                                           ` Mikulas Patocka
2018-04-17 14:40                                             ` Christopher Lameter
2018-04-17 18:53                                               ` Mikulas Patocka
2018-04-17 18:53                                                 ` Mikulas Patocka
2018-04-17 21:42                                                 ` Christopher Lameter
2018-04-17 14:49                                           ` Christopher Lameter
2018-04-17 14:49                                             ` Christopher Lameter
2018-04-17 14:47                                         ` Christopher Lameter
2018-04-17 14:47                                           ` Christopher Lameter
2018-04-16 19:32                               ` [PATCH RESEND] " Mikulas Patocka
2018-04-17 14:45                                 ` Christopher Lameter
2018-04-17 16:16                                   ` Vlastimil Babka
2018-04-17 16:38                                     ` Christopher Lameter
2018-04-17 19:09                                       ` Mikulas Patocka
2018-04-17 17:26                                     ` Mikulas Patocka
2018-04-17 19:13                                       ` Vlastimil Babka
2018-04-17 19:06                                   ` Mikulas Patocka
2018-04-17 19:06                                     ` Mikulas Patocka
2018-04-18 14:55                                     ` Christopher Lameter
2018-04-25 21:04                                       ` Mikulas Patocka
2018-04-25 23:24                                         ` Mikulas Patocka
2018-04-26 19:01                                           ` Christopher Lameter
2018-04-26 21:09                                             ` Mikulas Patocka
2018-04-27 16:41                                               ` Christopher Lameter
2018-04-27 19:19                                                 ` Mikulas Patocka
2018-06-13 17:01                                                   ` Mikulas Patocka
2018-06-13 18:16                                                     ` Christoph Hellwig
2018-06-13 18:53                                                       ` Mikulas Patocka
2018-04-26 18:51                                         ` Christopher Lameter
2018-04-16 19:38                             ` Vlastimil Babka
2018-04-16 19:38                               ` Vlastimil Babka
2018-04-16 21:04                         ` Mikulas Patocka
2018-04-16 21:04                           ` Mikulas Patocka

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=b0e6ccf6-06ce-e50b-840e-c8d3072382fd@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dm-devel@redhat.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=mpatocka@redhat.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=snitzer@redhat.com \
    --cc=willy@infradead.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.