From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH 2/4] block/mq-deadline: serialize request dispatching
Date: Fri, 19 Jan 2024 15:24:40 -0800 [thread overview]
Message-ID: <711e450e-e8ef-40b0-a519-dba510bffa86@acm.org> (raw)
In-Reply-To: <20240119160338.1191281-3-axboe@kernel.dk>
On 1/19/24 08:02, Jens Axboe wrote:
> + /*
> + * If someone else is already dispatching, skip this one. This will
> + * defer the next dispatch event to when something completes, and could
> + * potentially lower the queue depth for contended cases.
> + *
> + * See the logic in blk_mq_do_dispatch_sched(), which loops and
> + * retries if nothing is dispatched.
> + */
> + if (test_bit(DD_DISPATCHING, &dd->run_state) ||
> + test_and_set_bit(DD_DISPATCHING, &dd->run_state))
> + return NULL;
> +
> spin_lock(&dd->lock);
> rq = dd_dispatch_prio_aged_requests(dd, now);
> if (rq)
> @@ -616,6 +635,7 @@ static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx)
> }
>
> unlock:
> + clear_bit(DD_DISPATCHING, &dd->run_state);
> spin_unlock(&dd->lock);
From Documentation/memory-barriers.txt: "These are also used for atomic RMW
bitop functions that do not imply a memory barrier (such as set_bit and
clear_bit)." Does this mean that CPUs with a weak memory model (e.g. ARM)
are allowed to execute the clear_bit() call earlier than where it occurs in
the code? I think that spin_trylock() has "acquire" semantics and also that
"spin_unlock()" has release semantics. While a CPU is allowed to execute
clear_bit() before the memory operations that come before it, I don't think
that is the case for spin_unlock(). See also
tools/memory-model/Documentation/locking.txt.
Thanks,
Bart.
next prev parent reply other threads:[~2024-01-19 23:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 16:02 [PATCHSET RFC v2 0/4] mq-deadline scalability improvements Jens Axboe
2024-01-19 16:02 ` [PATCH 1/4] block/mq-deadline: pass in queue directly to dd_insert_request() Jens Axboe
2024-01-19 23:35 ` Bart Van Assche
2024-01-19 16:02 ` [PATCH 2/4] block/mq-deadline: serialize request dispatching Jens Axboe
2024-01-19 23:24 ` Bart Van Assche [this message]
2024-01-20 0:00 ` Jens Axboe
2024-01-19 16:02 ` [PATCH 3/4] block/mq-deadline: fallback to per-cpu insertion buckets under contention Jens Axboe
2024-01-19 23:16 ` Bart Van Assche
2024-01-20 0:05 ` Jens Axboe
2024-01-20 0:13 ` Jens Axboe
2024-01-20 0:31 ` Jens Axboe
2024-01-22 23:55 ` Bart Van Assche
2024-01-19 16:02 ` [PATCH 4/4] block/mq-deadline: skip expensive merge lookups if contended 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=711e450e-e8ef-40b0-a519-dba510bffa86@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox