Linux block layer
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>, Nirmoy Das <nirmoyd@nvidia.com>
Cc: ming.lei@redhat.com, hare@suse.de, dwagner@suse.de,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] blk-mq: clear stale inactive flag on hctx reuse
Date: Wed, 21 Oct 2026 08:18:57 -0700	[thread overview]
Message-ID: <a39c904d-4d84-49ef-84b2-16db1b28b706@acm.org> (raw)
In-Reply-To: <29692751-e80e-4f29-a07a-ea0221f1116e@kernel.dk>

On 10/20/26 7:39 AM, Jens Axboe wrote:
> On 10/20/26 8:13 AM, Bart Van Assche wrote:
>> On 10/20/26 5:51 AM, Nirmoy Das wrote:
>>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>>> index 025a799f35b924d..00b75eb95dd943a 100644
>>> --- a/block/blk-mq.c
>>> +++ b/block/blk-mq.c
>>> @@ -4002,6 +4002,7 @@ static int blk_mq_init_hctx(struct request_queue *q,
>>>            goto fail;
>>>          hctx->queue_num = hctx_idx;
>>> +    clear_bit(BLK_MQ_S_INACTIVE, &hctx->state);
>>>          hctx->tags = set->tags[hctx_idx];
>>
>> Why clear_bit() instead of __clear_bit()?
> 
> Since this isn't a hot path at all, going into details like
> that does more harm than good. clear_bit() is totally fine
> and honestly preferred.

Although I'm fine with the patch as-is, I want to clarify that
the concern behind my reply is code readability rather than a
micro-optimization. No other context should be accessing a hctx while
blk_mq_init_hctx() is in progress. Using clear_bit() instead of
__clear_bit() might make readers of this code wonder whether any other
context might be accessing the hctx concurrently with the
blk_mq_init_hctx() call.

Thanks,

Bart.

  reply	other threads:[~2026-10-21 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 12:51 [PATCH] blk-mq: clear stale inactive flag on hctx reuse Nirmoy Das
2026-10-20 14:13 ` Bart Van Assche
2026-10-20 14:28   ` Nirmoy Das
2026-10-20 14:39   ` Jens Axboe
2026-10-21 15:18     ` Bart Van Assche [this message]
2026-10-21 16:32       ` Jens Axboe
2026-10-20 14:40 ` Jens Axboe
2026-10-20 14:43   ` Nirmoy Das

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=a39c904d-4d84-49ef-84b2-16db1b28b706@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nirmoyd@nvidia.com \
    --cc=stable@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