Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@suse.com>,
	lsf-pc@lists.linux-foundation.org, linux-mm@kvack.org,
	bpf <bpf@vger.kernel.org>
Subject: Re: [Lsf-pc] [LSF/MM/BPF TOPIC] SLUB: what's next?
Date: Mon, 6 May 2024 14:04:54 -0700	[thread overview]
Message-ID: <3B8114F2-2284-441C-BC26-5AA95D02B7A0@linux.dev> (raw)
In-Reply-To: <67304905-57d7-47f5-937b-2c4fb95d13ba@suse.cz>


> On May 2, 2024, at 2:26 AM, Vlastimil Babka <vbabka@suse.cz> wrote:
> 
> 
> 
>> On 5/2/24 09:59, Michal Hocko wrote:
>>> On Tue 30-04-24 17:42:18, Vlastimil Babka wrote:
>>> Hi,
>>> 
>>> I'd like to propose a session about the next steps for SLUB. This is
>>> different from the BOF about sheaves that Matthew suggested, which would be
>>> not suitable for the whole group due to being not fleshed out enough yet.
>>> But the session could be scheduled after the BOF so if we do brainstorm
>>> something promising there, the result could be discussed as part of the full
>>> session.
>>> 
>>> Aside from that my preliminary plan is to discuss:
>>> 
>>> - what was made possible by reducing the slab allocators implementations to
>>> a single one, and what else could be done now with a single implementation
>>> 
>>> - the work-in-progress work (for now in the context of maple tree) on SLUB
>>> per-cpu array caches and preallocation
>>> 
>>> - what functionality would SLUB need to gain so the extra caching done by
>>> bpf allocator on top wouldn't be necessary? (kernel/bpf/memalloc.c)
>>> 
>>> - similar wrt lib/objpool.c (did you even noticed it was added? :)
>>> 
>>> - maybe the mempool functionality could be better integrated as well?
>>> 
>>> - are there more cases where people have invented layers outside mm and that
>>> could be integrated with some effort? IIRC io_uring also has some caching on
>>> top currently...
>>> 
>>> - better/more efficient memcg integration?

This is definitely an interesting topic, especially in a light of recent slab accounting performance conversations with Linus. Unfortunately I’m not attending in person this year, but happy to join virtually if it’s possible.

It’s not yet entirely clear to me if the kmem accounting performance problem exists outside of some micro-benchmarks.

Additionally, Linus proposed to optimize for cases when allocations might be short-living. In the proposed form it would complicate call sites significantly, but maybe we need some sort of transactional api, e.g.:

memcg_kmem_local_accounting_start();
p1 = kmalloc(GFP_ACCOUNT_LOCAL);
p2 = kmalloc(GFP_ACCOUNT_LOCAL);
…
kfree(p1);
memcg_kmem_local_accounting_commit();

In this case all allocations within the transaction will be saved to some temporarily buffer and not fully accounted until memcg_kmem_local_accounting_commit(). This will make them way faster. But a user should guarantee that these allocations won’t be freed from any other context until memcg_kmem_local_accounting_commit().

Thanks!

  reply	other threads:[~2024-05-06 21:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 15:42 [LSF/MM/BPF TOPIC] SLUB: what's next? Vlastimil Babka
2024-05-01  9:23 ` Alexei Starovoitov
2024-05-02  7:59 ` [Lsf-pc] " Michal Hocko
2024-05-02  9:26   ` Vlastimil Babka
2024-05-06 21:04     ` Roman Gushchin [this message]
2024-05-20 20:52 ` Vlastimil Babka

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=3B8114F2-2284-441C-BC26-5AA95D02B7A0@linux.dev \
    --to=roman.gushchin@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=mhocko@suse.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).