From: Allison Henderson <achender@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
rds-devel@oss.oracle.com
Subject: Re: [PATCH] net/rds: drop the device reference for ODP memory regions
Date: Wed, 04 Nov 2026 15:15:46 -0700 [thread overview]
Message-ID: <b9b97bf371302d42319ce21fbd4532d39ee97a28.camel@kernel.org> (raw)
In-Reply-To: <20261104022810.1484182-1-vulab@iscas.ac.cn>
On Wed, 2026-11-04 at 02:28 +0000, Wentao Liang wrote:
> rds_ib_get_mr() takes a reference on the rds_ib_device with
> rds_ib_get_device(). The FRMR path stores it in ibmr->device and
> rds_ib_free_mr() drops it when the MR is freed.
>
> The ODP path allocates the ibmr with kzalloc_obj() and returns it
> without recording the device. rds_ib_odp_mr_worker() only deregisters
> the MR and frees the ibmr, so the reference taken for every ODP MR is
> never dropped and the rds_ib_device can no longer be released.
>
> Store the reference in ibmr->device and drop it in the worker after
> the MR has been deregistered, which also keeps the device and its PD
> alive for as long as the MR exists.
>
> Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Hi Wentao,
Thanks for the patch. The fix itself looks reasonable, but few things to update: since
this is a bug fix, it should should target net with [PATCH net v2]. The commit message
should mention how this was found, and whether it was tested. Reproducing this needs an
ODP-capable device, so if it was only build-tested, please say so. It looks like there's
a few check patch nits to work through as well:
https://patchwork.kernel.org/project/netdevbpf/patch/20261104022810.1484182-1-vulab@iscas.ac.cn/
Other than that it looks straight forward to me.
Thanks,
Allison
> ---
> net/rds/ib_rdma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
> index db7e92e7bd29..8cd8295f66a3 100644
> --- a/net/rds/ib_rdma.c
> +++ b/net/rds/ib_rdma.c
> @@ -591,6 +591,7 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
> }
> ibmr->u.mr = ib_mr;
> ibmr->odp = 1;
> + ibmr->device = rds_ibdev;
>
> sge.addr = virt_addr;
> sge.length = length;
> @@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
>
> ibmr = container_of(work, struct rds_ib_mr, work.work);
> ib_dereg_mr(ibmr->u.mr);
> + rds_ib_dev_put(ibmr->device);
> kfree(ibmr);
> }
next prev parent reply other threads:[~2026-11-04 22:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 2:28 [PATCH] net/rds: drop the device reference for ODP memory regions Wentao Liang
2026-11-04 2:33 ` netdev-bot+sinfo
2026-11-04 7:11 ` Krzysztof Kozlowski
2026-11-04 22:15 ` Allison Henderson [this message]
2026-11-05 2:28 ` sashiko-bot
2026-11-08 3:04 ` netdev-bot+sashiko
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=b9b97bf371302d42319ce21fbd4532d39ee97a28.camel@kernel.org \
--to=achender@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rds-devel@oss.oracle.com \
--cc=vulab@iscas.ac.cn \
/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.