linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Joel Fernandes <joel@joelfernandes.org>,
	paulmck@kernel.org, Uladzislau Rezki <urezki@gmail.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	RCU <rcu@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>
Subject: Re: [PATCH v2 0/5] Move kvfree_rcu() into SLAB (v2)
Date: Wed, 22 Jan 2025 18:42:40 +0100	[thread overview]
Message-ID: <Z5EuEFZbBgaCPDYo@pc636> (raw)
In-Reply-To: <c210c44d-d1b1-4dc3-839d-f99ad73c3ee9@suse.cz>

On Wed, Jan 22, 2025 at 05:43:06PM +0100, Vlastimil Babka wrote:
> On 1/22/25 16:04, Joel Fernandes wrote:
> > On Tue, Jan 21, 2025 at 3:32 PM Paul E. McKenney <paulmck@kernel.org> wrote:
> >>
> >> On Tue, Jan 21, 2025 at 03:14:16PM +0100, Uladzislau Rezki wrote:
> >> > On Tue, Jan 21, 2025 at 02:49:13PM +0100, Vlastimil Babka wrote:
> >> > > Right so that's the first Possible solution, but without the #ifdef. So
> >> > > there's an overhead of checking __is_kvfree_rcu_offset() even if the
> >> > > batching is done in slab and this function is never called with an offset.
> >> > >
> >> > Or fulfilling a missing functionality? TREE is broken in that sense
> >> > whereas a TINY handles it without any issues.
> >> >
> >> > It can be called for SLUB_TINY option, just call_rcu() instead of
> >> > batching layer. And yes, kvfree_rcu_barrier() switches to rcu_barrier().
> >>
> >> Would this make sense?
> >>
> >>                 if (IS_ENABLED(CONFIG_TINY_RCU) && __is_kvfree_rcu_offset((unsigned long) f)) {
> >>
> >> Just to be repetitive, other alternatives include:
> >>
> >> 1.      Take advantage of SLOB being no longer with us.
> >>
> >> 2.      Get rid of Tiny RCU's special casing of kfree_rcu(), and then
> >>         eliminate the above "if" statement in favor of its "else" clause.
> >>
> >> 3.      Make Tiny RCU implement a trivial version of kfree_rcu() that
> >>         passes a list through RCU.
> >>
> >> I don't have strong feelings, and am happy to defer to your guys'
> >> decision.
> > 
> > If I may chime in with an opinion, I think the cleanest approach would
> > be to not special-case the func pointer and instead provide a callback
> > from the SLAB layer which does the kfree. Then get rid of
> 
> Right.
> 
> > __is_kvfree_rcu_offset() and its usage from Tiny. Granted, there is
> > the overhead of function calling, but I highly doubt that it is going
> > to be a bottleneck, considering that the __is_kvfree_rcu_offset() path
> > is a kfree slow-path.  I feel in the long run, this will also be more
> > maintainable.
> > 
> > Or is there a reason other than the theoretical function call overhead
> > why this may not work?
> 
> My concern was about the overhead of calculating the pointer to the object
> starting address, but it's just some arithmetics, so it should be
> negligible. So I'm prototyping this approach now. Thanks all.
> 
You are welcome :)

--
Uladzislau Rezki


  parent reply	other threads:[~2025-01-22 17:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 18:02 Uladzislau Rezki (Sony)
2024-12-12 18:02 ` [PATCH v2 1/5] rcu/kvfree: Initialize kvfree_rcu() separately Uladzislau Rezki (Sony)
2024-12-12 18:02 ` [PATCH v2 2/5] rcu/kvfree: Move some functions under CONFIG_TINY_RCU Uladzislau Rezki (Sony)
2024-12-12 18:02 ` [PATCH v2 3/5] rcu/kvfree: Adjust names passed into trace functions Uladzislau Rezki (Sony)
2024-12-12 18:02 ` [PATCH v2 4/5] rcu/kvfree: Adjust a shrinker name Uladzislau Rezki (Sony)
2024-12-12 18:02 ` [PATCH v2 5/5] mm/slab: Move kvfree_rcu() into SLAB Uladzislau Rezki (Sony)
2024-12-12 18:30 ` [PATCH v2 0/5] Move kvfree_rcu() into SLAB (v2) Christoph Lameter (Ampere)
2024-12-12 19:08   ` Uladzislau Rezki
2024-12-12 19:10   ` Paul E. McKenney
2024-12-12 19:13     ` Uladzislau Rezki
2024-12-15 17:30 ` Vlastimil Babka
2024-12-15 18:21   ` Paul E. McKenney
2024-12-16 11:03   ` Uladzislau Rezki
2024-12-16 14:20     ` Vlastimil Babka
2024-12-16 15:41       ` Uladzislau Rezki
2024-12-16 15:44         ` Vlastimil Babka
2024-12-16 15:55           ` Uladzislau Rezki
2024-12-16 16:46             ` Paul E. McKenney
2025-01-20 22:06               ` Vlastimil Babka
2025-01-21 13:33                 ` Uladzislau Rezki
2025-01-21 13:49                   ` Vlastimil Babka
2025-01-21 14:14                     ` Uladzislau Rezki
2025-01-21 20:32                       ` Paul E. McKenney
2025-01-22 15:04                         ` Joel Fernandes
2025-01-22 16:43                           ` Vlastimil Babka
2025-01-22 16:47                             ` Joel Fernandes
2025-01-22 17:42                             ` Uladzislau Rezki [this message]
2024-12-16 13:07   ` Uladzislau Rezki
2025-01-11 19:40     ` Vlastimil Babka
2025-01-06  7:21 ` [External Mail] " Hyeonggon Yoo
2025-01-11 19:43   ` 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=Z5EuEFZbBgaCPDYo@pc636 \
    --to=urezki@gmail.com \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleksiy.avramchenko@sony.com \
    --cc=paulmck@kernel.org \
    --cc=penberg@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --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