From: Uladzislau Rezki <urezki@gmail.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Uladzislau Rezki <urezki@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>,
Suren Baghdasaryan <surenb@google.com>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Harry Yoo <harry.yoo@oracle.com>,
Sidhartha Kumar <sidhartha.kumar@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
rcu@vger.kernel.org, maple-tree@lists.infradead.org
Subject: Re: [PATCH v7 04/21] slab: add sheaf support for batching kfree_rcu() operations
Date: Wed, 10 Sep 2025 09:31:05 +0200 [thread overview]
Message-ID: <aMEpOTLh8EX6DXYq@pc636> (raw)
In-Reply-To: <772oyaa3j27tlklhpo6oqxsdtlvsg5goh2opzuig6xvgztgum4@scsoxrgtqm2f>
On Tue, Sep 09, 2025 at 10:35:15AM -0400, Liam R. Howlett wrote:
> * Uladzislau Rezki <urezki@gmail.com> [250909 05:08]:
>
> ...
>
> >
> > > > - call_rcu() can be slow, therefore we do not use it in the kvfree_rcu().
> > >
> > > If call_rcu() is called once per 32 kfree_rcu() filling up the rcu sheaf, is
> > > it still too slow?
> > >
> > You do not know where in a queue this callback lands, in the beginning,
> > in the end, etc. It is part of generic list which is processed one by
> > one. It can contain thousands of callbacks.
>
> How does this differ from kvfree_rcu()?
>
> Surely if you have enough calls to kvfree_rcu(), you will end up with a
> large list of frees before the end of a grace period? Our placement in
> the freeing order would still be dependent on what else is using the
> infrastructure in the same grace period, right?
>
In kfree_rcu() we use page blocks to carry pointers. Lists can be used
if there is a low memory condition so a page can not be allocated or
cache is empty. But this is not part of carr_rcu() track in any way.
Right regular call_rcu() puts callback into its own internal lists and
they are processed one by one during list iteration. In such lists you
can have hundred of thousand callback.
>
> How is kvfree_rcu() affected by rcu callback offloading to a specific
> cpu and rcu expedite? Often these two features come into play for
> certain workloads which are of concern to us.
>
We maintain a separate path. Offload is done after a grace period is
over. It is classic way. Historically all deferred freeing was one
call_rcu() per ptr.
> >
> > If performance is not needed then it is not an issue. But in
> > kvfree_rcu() we do not use it, because of we want to offload
> > fast.
>
> Today, I free things using call_rcu() and a custom callback so I would
> think stacking 32 together would make the list shorter, but latency
> would increase by waiting until there are 32.
>
> If we wanted to flush the kvfree_rcu() list, is it done in the same way
> as the call_rcu() list, or is there a better way?
>
For this case we have kvfree_rcu_barrier(). It is not same as call_rcu()
flushing.
--
Uladzislau Rezki
next prev parent reply other threads:[~2025-09-10 7:31 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 12:59 [PATCH v7 00/21] SLUB percpu sheaves Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 01/21] locking/local_lock: Expose dep_map in local_trylock_t Vlastimil Babka
2025-09-04 1:38 ` Harry Yoo
2025-09-03 12:59 ` [PATCH v7 02/21] slab: simplify init_kmem_cache_nodes() error handling Vlastimil Babka
2025-09-04 1:41 ` Harry Yoo
2025-09-03 12:59 ` [PATCH v7 03/21] slab: add opt-in caching layer of percpu sheaves Vlastimil Babka
2025-09-08 11:19 ` Harry Yoo
2025-09-08 12:26 ` Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 04/21] slab: add sheaf support for batching kfree_rcu() operations Vlastimil Babka
2025-09-08 11:59 ` Uladzislau Rezki
2025-09-08 12:45 ` Vlastimil Babka
2025-09-09 9:08 ` Uladzislau Rezki
2025-09-09 9:14 ` Uladzislau Rezki
2025-09-09 10:20 ` Vlastimil Babka
2025-09-09 14:55 ` Vlastimil Babka
2025-09-09 14:35 ` Liam R. Howlett
2025-09-10 7:31 ` Uladzislau Rezki [this message]
2025-09-03 12:59 ` [PATCH v7 05/21] slab: sheaf prefilling for guaranteed allocations Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 06/21] slab: determine barn status racily outside of lock Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 07/21] slab: skip percpu sheaves for remote object freeing Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 08/21] slab: allow NUMA restricted allocations to use percpu sheaves Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 09/21] tools/testing/maple_tree: Fix check_bulk_rebalance() locks Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 10/21] tools/testing/vma: Implement vm_refcnt reset Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 11/21] tools/testing: Add support for changes to slab for sheaves Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 12/21] mm, vma: use percpu sheaves for vm_area_struct cache Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 13/21] maple_tree: use percpu sheaves for maple_node_cache Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 14/21] tools/testing: include maple-shim.c in maple.c Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 15/21] testing/radix-tree/maple: Hack around kfree_rcu not existing Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 16/21] maple_tree: Use kfree_rcu in ma_free_rcu Vlastimil Babka
2025-09-03 12:59 ` [PATCH v7 17/21] maple_tree: Replace mt_free_one() with kfree() Vlastimil Babka
2025-09-03 13:00 ` [PATCH v7 18/21] tools/testing: Add support for prefilled slab sheafs Vlastimil Babka
2025-09-03 13:00 ` [PATCH v7 19/21] maple_tree: Prefilled sheaf conversion and testing Vlastimil Babka
2025-09-03 13:00 ` [PATCH v7 20/21] maple_tree: Add single node allocation support to maple state Vlastimil Babka
2025-09-03 13:00 ` [PATCH v7 21/21] maple_tree: Convert forking to use the sheaf interface Vlastimil Babka
2025-09-08 7:55 ` [PATCH v7 00/21] SLUB percpu sheaves 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=aMEpOTLh8EX6DXYq@pc636 \
--to=urezki@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=cl@gentwo.org \
--cc=harry.yoo@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=sidhartha.kumar@oracle.com \
--cc=surenb@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 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.