[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuCfpG4JYPE0YbzcLCZbtsqkqCrzaRENkBunpvzLC_B5q2vCA@mail.gmail.com>
Date: Fri, 26 Sep 2025 08:41:45 -0700
From: Suren Baghdasaryan <surenb@...gle.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Harry Yoo <harry.yoo@...cle.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Christoph Lameter <cl@...two.org>, David Rientjes <rientjes@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>, Uladzislau Rezki <urezki@...il.com>,
Sidhartha Kumar <sidhartha.kumar@...cle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, rcu@...r.kernel.org,
maple-tree@...ts.infradead.org, "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH v8 04/23] slab: add sheaf support for batching kfree_rcu() operations
On Fri, Sep 26, 2025 at 3:08 AM Vlastimil Babka <vbabka@...e.cz> wrote:
>
> On 9/25/25 06:35, Suren Baghdasaryan wrote:
> > On Thu, Sep 18, 2025 at 1:09 AM Vlastimil Babka <vbabka@...e.cz> wrote:
> >>
> >> Expected advantages:
> >> - batching the kfree_rcu() operations, that could eventually replace the
> >> existing batching
> >> - sheaves can be reused for allocations via barn instead of being
> >> flushed to slabs, which is more efficient
> >> - this includes cases where only some cpus are allowed to process rcu
> >> callbacks (Android)
> >
> > nit: I would say it's more CONFIG_RCU_NOCB_CPU related. Android is
> > just an instance of that.
>
> OK changed that.
>
> Changes due to your other suggestions:
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 8220ce095970..fec0cdc7ef37 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3945,15 +3945,12 @@ void flush_all_rcu_sheaves(void)
> */
>
> INIT_WORK(&sfw->work, flush_rcu_sheaf);
> - sfw->skip = false;
> sfw->s = s;
> queue_work_on(cpu, flushwq, &sfw->work);
> }
>
> for_each_online_cpu(cpu) {
> sfw = &per_cpu(slub_flush, cpu);
> - if (sfw->skip)
> - continue;
> flush_work(&sfw->work);
> }
>
> @@ -5643,6 +5640,10 @@ bool __kfree_rcu_sheaf(struct kmem_cache *s, void *obj)
>
> rcu_sheaf = pcs->rcu_free;
>
> + /*
> + * Since we flush immediately when size reaches capacity, we never reach
> + * this with size already at capacity, so no OOB write is possible.
> + */
Perfect!
Reviewed-by: Suren Baghdasaryan <surenb@...gle.com>
> rcu_sheaf->objects[rcu_sheaf->size++] = obj;
>
> if (likely(rcu_sheaf->size < s->sheaf_capacity))
>
Powered by blists - more mailing lists