public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Uday Shankar <ushankar@purestorage.com>, linux-block@vger.kernel.org
Subject: Re: [PATCH] ublk: remove io_cmds list in ublk_queue
Date: Wed, 19 Mar 2025 09:04:21 +0800	[thread overview]
Message-ID: <Z9oYFdWj1qAWH1q3@fedora> (raw)
In-Reply-To: <097f0495-b2e8-4938-9a0d-c321f618d49b@kernel.dk>

On Tue, Mar 18, 2025 at 12:48:44PM -0600, Jens Axboe wrote:
> On 3/18/25 12:43 PM, Uday Shankar wrote:
> > On Tue, Mar 18, 2025 at 12:22:57PM -0600, Jens Axboe wrote:
> >>>  struct ublk_rq_data {
> >>> -	struct llist_node node;
> >>> -
> >>>  	struct kref ref;
> >>>  };
> >>
> >> Can we get rid of ublk_rq_data then? If it's just a ref thing, I'm sure
> >> we can find an atomic_t of space in struct request and avoid it. Not a
> >> pressing thing, just tossing it out there...
> > 
> > Yeah probably - we do need a ref since one could complete a request
> > concurrently with another code path which references it (user copy and
> > zero copy). I see that struct request has a refcount in it already,
> 
> Right, at least with the current usage, we still do need that kref, or
> something similar. I would've probably made it just use refcount_t
> though, rather than rely on the indirect calls. kref doesn't really
> bring us anything here in terms of API.
> 
> > though I don't see any examples of drivers using it. Would it be a bad
> > idea to try and reuse that?
> 
> We can't reuse that one, and it's not for driver use - purely internal.
> But I _think_ you could easily grab space in the union that has the hash
> and ipi_list for it. And then you could dump needing this extra data per
> request.

It should be fine to reuse request->ref, since the payload shares same
lifetime with request.

But if it is exported, the interface is likely to be misused...


thanks,
Ming


  parent reply	other threads:[~2025-03-19  1:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 18:14 [PATCH] ublk: remove io_cmds list in ublk_queue Uday Shankar
2025-03-18 18:22 ` Jens Axboe
2025-03-18 18:43   ` Uday Shankar
2025-03-18 18:48     ` Jens Axboe
2025-03-18 21:58       ` Uday Shankar
2025-03-19  1:54         ` Jens Axboe
2025-03-19  1:04       ` Ming Lei [this message]
2025-03-19  1:57         ` Jens Axboe
2025-03-19  2:14 ` Ming Lei
2025-03-19 12:32 ` Jens Axboe

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=Z9oYFdWj1qAWH1q3@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ushankar@purestorage.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