From: Ming Lei <tom.leiming@gmail.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Keith Busch <kbusch@meta.com>,
axboe@kernel.dk, hch@lst.de, linux-block@vger.kernel.org
Subject: Re: [PATCHv2] blk-mq: check for stale cached request in blk_mq_submit_bio
Date: Tue, 19 May 2026 11:36:28 +0800 [thread overview]
Message-ID: <agvavGiivHKgL43h@fedora> (raw)
In-Reply-To: <agvT6mMM5Tc2ABbk@kbusch-mbp>
On Mon, May 18, 2026 at 09:07:22PM -0600, Keith Busch wrote:
> On Tue, May 19, 2026 at 09:24:50AM +0800, Ming Lei wrote:
> > On Fri, May 01, 2026 at 10:41:19AM -0700, Keith Busch wrote:
> > >
> > > new_request:
> > > if (rq) {
> > > - blk_mq_use_cached_rq(rq, plug, bio);
> > > + if (!blk_mq_use_cached_rq(rq, plug, bio)) {
> > > + struct bio_integrity_payload *bip = bio_integrity(bio);
> > > +
> > > + if (bip && (bip->bip_flags & BIP_BLOCK_INTEGRITY))
> > > + bio_integrity_free(bio);
> > > + rq = NULL;
> > > + goto retry;
> > > + }
> >
> > This way still looks fragile, given rq isn't guaranteed to be live.
>
> Yeah. The current usage in this patch looks like it should work out, but
> not necessarily by design, so yes, fragile.
>
> > Just wondering why not pop it from plug->cached_rqs from beginning, and
> > move it back in case of `queue_exit:`?
>
> Not sure. I guess it's an optimization when the bio merges with a
> previous request in the plug? If we popped initially, a successful merge
> has to push it back. Maybe there's a better reason I'm not seeing.
Yes, this way may avoid potential perf regression for heavy merge cases.
Thanks,
Ming
prev parent reply other threads:[~2026-05-19 3:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 17:41 [PATCHv2] blk-mq: check for stale cached request in blk_mq_submit_bio Keith Busch
2026-05-18 14:44 ` Keith Busch
2026-05-19 6:47 ` Christoph Hellwig
2026-05-19 1:24 ` Ming Lei
2026-05-19 3:07 ` Keith Busch
2026-05-19 3:36 ` Ming Lei [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=agvavGiivHKgL43h@fedora \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-block@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 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.