From: Bart Van Assche <bvanassche@acm.org>
To: kensanya <kensanya@163.com>
Cc: jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org,
target-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
TanZheng <tanzheng@kylinos.cn>
Subject: Re: [PATCH v2] RDMA/srpt: Fix srpt_alloc_rw_ctxs() unwind counters
Date: Fri, 17 Jul 2026 15:14:33 -0700 [thread overview]
Message-ID: <0ff08421-b325-4d5d-adf1-e6ae94516b39@acm.org> (raw)
In-Reply-To: <386585bd.1730.19f6dcdb6cf.Coremail.kensanya@163.com>
On 7/16/26 7:00 PM, kensanya wrote:
> I have a question about restoring n_rw_ctx/n_rdma from local
> snapshots versus clearing them to 0 on the unwind path.
>
> Looking at the call chain:
> srpt_handle_new_iu()
> -> srpt_get_send_ioctx() /* sets n_rdma = 0, n_rw_ctx = 0 */
> -> srpt_get_desc_tbl()
> -> srpt_alloc_rw_ctxs()
>
> so when srpt_alloc_rw_ctxs() is entered, both counters are already
> 0. On the current call path, assigning 0 on unwind seems
> equivalent to restoring the values saved at function entry.
>
> Is the save/restore preferred because the loop starts from
> ioctx->n_rw_ctx (i.e. the function is written as if it may extend
> an existing allocation), or is there another reason to prefer it
> over clearing to 0?
Your analysis seems correct to me. I misremembered how the code works
when I wrote the message you replied to. It was a while ago when I
implemented srpt_get_send_ioctx() - in 2010 according to the git
history of the original implementation
(https://github.com/SCST-project/scst).
Bart.
prev parent reply other threads:[~2026-07-17 22:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 10:15 [PATCH v2] RDMA/srpt: Fix srpt_alloc_rw_ctxs() unwind counters kensanya
2026-07-16 8:53 ` Leon Romanovsky
2026-07-16 17:37 ` Bart Van Assche
2026-07-16 18:22 ` Leon Romanovsky
2026-07-16 18:24 ` Leon Romanovsky
2026-07-16 18:46 ` Bart Van Assche
2026-07-17 2:00 ` kensanya
2026-07-17 22:14 ` Bart Van Assche [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=0ff08421-b325-4d5d-adf1-e6ae94516b39@acm.org \
--to=bvanassche@acm.org \
--cc=jgg@ziepe.ca \
--cc=kensanya@163.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=tanzheng@kylinos.cn \
--cc=target-devel@vger.kernel.org \
/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