From: Uladzislau Rezki <urezki@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Uladzislau Rezki <urezki@gmail.com>,
Julia Lawall <julia.lawall@inria.fr>,
Vlastimil Babka <vbabka@suse.cz>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
RCU <rcu@vger.kernel.org>,
cocci@inria.fr
Subject: Re: [cocci] patch idea: convert trivial call_rcu users to kfree_rcu
Date: Tue, 11 Jun 2024 19:27:02 +0200 [thread overview]
Message-ID: <ZmiI5pE1PK1Tv1y2@pc636> (raw)
In-Reply-To: <c751813a-0ab7-4629-bdc4-00f472ae18ec@paulmck-laptop>
On Tue, Jun 11, 2024 at 10:25:52AM -0700, Paul E. McKenney wrote:
> On Tue, Jun 11, 2024 at 06:40:49PM +0200, Uladzislau Rezki wrote:
> > > >
> > > > These look ok to me. In the last two cases, the callback function is also
> > > > stored in a data structure, eg:
> > > >
> > > > static struct mfc6_cache *ip6mr_cache_alloc(void)
> > > > {
> > > > struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
> > > > if (!c)
> > > > return NULL;
> > > > c->_c.mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1;
> > > > c->_c.mfc_un.res.minvif = MAXMIFS;
> > > > c->_c.free = ip6mr_cache_free_rcu;
> > > > refcount_set(&c->_c.mfc_un.res.refcount, 1);
> > > > return c;
> > > > }
> > > >
> > > > Should that be left as it is?
> > >
> > > Given that ->_c.free isn't used in the RCU callback, I am guessing that
> > > this is intended for debugging purposes, so that you can see from a crash
> > > dump how this will be freed. But I could be completely off-base here.
> > >
> > > One approach would be to remove the ->_c.free field and call attention
> > > to this in the patches' commit logs.
> > >
> > > Another would be to instead put the address of the allocation function
> > > in ->_c.free, and again call attention to this in the commit logs.
> > >
> > > Is there a better approach than these three? ;-)
> > >
> > IMO, "_c.free" should be removed:
>
> Why not send the patch and see what the maintainers say? If they object,
> you can always fall back to one of the other two methods, depending on
> the nature of their objection.
>
I can send the patch :)
--
Uladzislau Rezki
prev parent reply other threads:[~2024-06-11 17:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 7:46 Vlastimil Babka
2024-05-27 8:13 ` [cocci] " Julia Lawall
2024-05-27 19:27 ` Paul E. McKenney
2024-05-27 19:46 ` Uladzislau Rezki
2024-05-27 19:51 ` Julia Lawall
2024-05-27 20:36 ` Uladzislau Rezki
2024-05-27 20:43 ` Julia Lawall
2024-05-27 21:48 ` Paul E. McKenney
2024-05-28 5:09 ` Julia Lawall
2024-05-28 12:03 ` Uladzislau Rezki
2024-05-28 12:08 ` Julia Lawall
2024-05-28 13:21 ` Uladzislau Rezki
2024-05-28 14:29 ` Paul E. McKenney
2024-05-31 16:02 ` Julia Lawall
2024-06-03 17:25 ` Paul E. McKenney
2024-06-03 19:29 ` Vlastimil Babka
2024-06-03 19:51 ` Julia Lawall
2024-06-04 11:26 ` Uladzislau Rezki
2024-06-09 8:32 ` Julia Lawall
2024-06-09 10:00 ` Julia Lawall
2024-06-09 17:03 ` Paul E. McKenney
2024-06-11 16:40 ` Uladzislau Rezki
2024-06-11 17:25 ` Paul E. McKenney
2024-06-11 17:27 ` Uladzislau Rezki [this message]
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=ZmiI5pE1PK1Tv1y2@pc636 \
--to=urezki@gmail.com \
--cc=cocci@inria.fr \
--cc=julia.lawall@inria.fr \
--cc=linux-mm@kvack.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--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