All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: Zhu Yanjun <zyjzyj2000@gmail.com>, Jason Gunthorpe <jgg@ziepe.ca>,
	Leon Romanovsky <leon@kernel.org>,
	Devesh Sharma <devesh.s.sharma@oracle.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Zhu Yanjun <yanjun.zhu@linux.dev>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Date: Wed, 15 Mar 2023 15:59:54 -0400	[thread overview]
Message-ID: <CAEXW_YTOC4KcnjP+oZEmUwhxT2RTRJUGZcK-bC2dZHNxQaWc5w@mail.gmail.com> (raw)
In-Reply-To: <7a0dfc9f-6d21-fce4-4b83-72bb171454d3@gmail.com>

On Wed, Mar 15, 2023 at 3:05 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
>
> On 3/15/23 13:41, Joel Fernandes wrote:
> > On Wed, Mar 15, 2023 at 2:38 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
> >>
> >> On 3/15/23 13:19, Joel Fernandes (Google) wrote:
> >>> The k[v]free_rcu() macro's single-argument form is deprecated.
> >>> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> >>> is to avoid accidental use of the single-argument forms, which can
> >>> introduce functionality bugs in atomic contexts and latency bugs in
> >>> non-atomic contexts.
> >>>
> >>> There is no functionality change with this patch.
> >>>
> >>> Link: https://lore.kernel.org/rcu/20230201150815.409582-1-urezki@gmail.com
> >>> Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
> >>> Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
> >>> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> >>> Fixes: 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")
> >>> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> >>> ---
> >>>  drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> >>> index b10aa1580a64..ae3a100e18fb 100644
> >>> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> >>> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> >>> @@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
> >>>               return -EINVAL;
> >>>
> >>>       rxe_cleanup(mr);
> >>> -     kfree_rcu(mr);
> >>> +     kfree_rcu_mightsleep(mr);
> >>>       return 0;
> >>>  }
> >>>
> >> Please replace kfree_rcu_mightsleep() by kfree(). There is no need to delay the kfree(mr).
> >
> > I thought you said either was Ok, but yeah that's fine with me. I was
> > trying to play it safe ;-). An extra GP may not hurt, but not having
> > one when it is needed might. I will update it to just be kfree.
>
> Thanks. The reason to not add the pause is that it really isn't required and will just make
> people think that it is. With the current state of the driver the mr cleanup code will disable
> looking up the mr from its rkey or lkey and then wait until all the references to the mr are dropped
> before calling kfree. This will always work (unless a new bug is introduced) so no reason to
> add the rcu delay.
>

Sounds good! I updated it in my queue, and I will repost it in the
future pending test results and other comments.

thanks,

 - Joel

  reply	other threads:[~2023-03-15 20:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 02/14] misc: vmw_vmci: " Joel Fernandes (Google)
2023-03-16  6:50   ` Greg Kroah-Hartman
2023-03-16 15:21     ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 03/14] tracing: " Joel Fernandes (Google)
2023-03-16  7:38   ` Daniel Bristot de Oliveira
2023-03-16 15:11     ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 04/14] lib/test_vmalloc.c: " Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 05/14] net/sysctl: " Joel Fernandes (Google)
2023-03-26 12:28   ` Joel Fernandes
2023-03-27 17:14     ` Jakub Kicinski
2023-03-30 15:43       ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-26 12:34   ` Joel Fernandes
2023-03-27 15:09     ` Saeed Mahameed
2023-03-15 18:18 ` [PATCH v2 07/14] ext4/super: " Joel Fernandes (Google)
2023-03-15 19:07   ` Theodore Ts'o
2023-03-16 15:23     ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 08/14] rcuscale: " Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 09/14] torture: Enable clocksource watchdog with "tsc=watchdog" Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 10/14] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 11/14] rcu/kvfree: Eliminate k[v]free_rcu() single argument macro Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-16 16:41   ` Stefan Schmidt
2023-03-16 18:06     ` Joel Fernandes
2023-03-15 18:19 ` [PATCH v2 13/14] RDMA/rxe: " Joel Fernandes (Google)
2023-03-15 18:38   ` Bob Pearson
2023-03-15 18:41     ` Joel Fernandes
2023-03-15 19:05       ` Bob Pearson
2023-03-15 19:59         ` Joel Fernandes [this message]
2023-03-15 18:19 ` [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used Joel Fernandes (Google)
2023-03-16  3:49   ` Paul E. McKenney
2023-03-26 12:27 ` [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes
2023-03-27 19:26   ` Jens Axboe
2023-03-30 15:38     ` Joel Fernandes

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=CAEXW_YTOC4KcnjP+oZEmUwhxT2RTRJUGZcK-bC2dZHNxQaWc5w@mail.gmail.com \
    --to=joel@joelfernandes.org \
    --cc=devesh.s.sharma@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=yanjun.zhu@linux.dev \
    --cc=zyjzyj2000@gmail.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 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.