From: Roman Gushchin <roman.gushchin@linux.dev>
To: Shakeel Butt <shakeelb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Waiman Long <longman@redhat.com>,
Sven Luther <Sven.Luther@windriver.com>
Subject: Re: [PATCH RFC] ipc/mqueue: introduce msg cache
Date: Tue, 20 Dec 2022 12:59:40 -0800 [thread overview]
Message-ID: <Y6IiPCg7c1A5fhsC@P9FQF9L96D.corp.robot.car> (raw)
In-Reply-To: <CALvZod7WNxj0vdfiEad_xfBACsJu3iA0nF25m4VN3M=yLF4igg@mail.gmail.com>
On Tue, Dec 20, 2022 at 11:53:25AM -0800, Shakeel Butt wrote:
> +Vlastimil
>
> On Tue, Dec 20, 2022 at 10:48 AM Roman Gushchin
> <roman.gushchin@linux.dev> wrote:
> >
> > Sven Luther reported a regression in the posix message queues
> > performance caused by switching to the per-object tracking of
> > slab objects introduced by patch series ending with the
> > commit 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches for all
> > allocations").
> >
> > To mitigate the regression cache allocated mqueue messages on a small
> > percpu cache instead of releasing and re-allocating them every time.
> >
>
> Seems fine with me but I am wondering what is stopping us to do this
> caching in the slab layer for all accounted allocations? Does this
> only make sense for specific scenarios/use-cases?
It's far from trivial, unfortunately. Here we have an mqueue object to associate
a percpu cache with and the hit rate is expected to be high, assuming the mqueue
will be used to pass a lot of messages.
With a generic slab cache we return to the necessity of managing
the per-cgroup x per-slab-cache x per-cpu free list (or some other data structure),
which is already far from trivial, based on the previous experience. It can
easily lead to a significant memory waste, which will fully compensate all perf
wins.
So probably we need some heuristics to allocate caches only for really hot slab
caches and use some sort of a hash map (keyed by cgroup and slab cache) to
access freelists. What I miss to commit more time to this project (aside from not
having it), is the lack of real workloads which will noticeably win from this work.
Sven provided a good example and benchmark to reproduce the regression, so it
was easy to justify the work.
Thanks!
next prev parent reply other threads:[~2022-12-20 20:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 18:48 Roman Gushchin
2022-12-20 19:53 ` Shakeel Butt
2022-12-20 20:59 ` Roman Gushchin [this message]
2022-12-20 23:28 ` Shakeel Butt
2022-12-20 23:56 ` Roman Gushchin
2022-12-21 9:29 ` Thorsten Leemhuis
2022-12-22 11:52 ` Brian Foster
2022-12-22 16:37 ` Roman Gushchin
2022-12-22 17:54 ` Brian Foster
2023-02-16 12:29 ` Linux regression tracking (Thorsten Leemhuis)
2023-02-17 18:26 ` Roman Gushchin
2023-02-24 10:47 ` Linux regression tracking (Thorsten Leemhuis)
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=Y6IiPCg7c1A5fhsC@P9FQF9L96D.corp.robot.car \
--to=roman.gushchin@linux.dev \
--cc=Sven.Luther@windriver.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=shakeelb@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