Linux kernel staging patches
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: shangxiaojing <shangxiaojing@huawei.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	andy.shevchenko@gmail.com, ilpo.jarvinen@linux.intel.com,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH -next v4] staging: fwserial: Switch to kfree_rcu() API
Date: Mon, 19 Sep 2022 13:27:17 +0300	[thread overview]
Message-ID: <YyhEBYGPSaB3XfNV@kadam> (raw)
In-Reply-To: <0f98fa2d-0bba-479c-914d-e6d1a8605733@huawei.com>

On Mon, Sep 19, 2022 at 05:43:33PM +0800, shangxiaojing wrote:
> 
> On 2022/9/19 17:11, Greg KH wrote:
> > On Mon, Sep 19, 2022 at 05:10:56PM +0800, Shang XiaoJing wrote:
> > > Instead of invoking a synchronize_rcu() to free a pointer after a grace
> > > period, we can directly make use of a new API that does the same but in
> > > a more efficient way.
> > > 
> > > Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> > > ---
> > > Changelog:
> > > v3: the first version of the PATCH
> > > v1: v3 resent as v1
> > > v2: use kfree_rcu() instead of kvfree_rcu() for clarity
> > > v4: resend v2 as v4 to avoid versioning confusion
> > > ---
> > >   drivers/staging/fwserial/fwserial.c | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
> > > index 81b06d88ed0d..8d2b4ed1f39e 100644
> > > --- a/drivers/staging/fwserial/fwserial.c
> > > +++ b/drivers/staging/fwserial/fwserial.c
> > > @@ -2117,8 +2117,7 @@ static void fwserial_remove_peer(struct fwtty_peer *peer)
> > >   	if (port)
> > >   		fwserial_release_port(port, true);
> > > -	synchronize_rcu();
> > > -	kfree(peer);
> > > +	kfree_rcu(peer);
> 
> The kfree_rcu(peer) should be kfree_rcu(peer, rcu), due to the rcu_head
> member named rcu in fwtty_peer.

Oh, huh.  What happens if you don't pas the "rcu" parameter?  I see
there is a similar instance in ext4_apply_quota_options().

		kfree_rcu(qname);

regards,
dan carpenter


  reply	other threads:[~2022-09-19 10:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  9:10 [PATCH -next v4] staging: fwserial: Switch to kfree_rcu() API Shang XiaoJing
2022-09-19  9:11 ` Greg KH
2022-09-19  9:43   ` shangxiaojing
2022-09-19 10:27     ` Dan Carpenter [this message]
2022-09-19 10:58       ` shangxiaojing
2022-09-20 12:04       ` shangxiaojing
2022-09-19  9:24 ` Dan Carpenter

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=YyhEBYGPSaB3XfNV@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-staging@lists.linux.dev \
    --cc=shangxiaojing@huawei.com \
    /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