From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2] block/mq-deadline: serialize request dispatching
Date: Thu, 18 Jan 2024 11:45:33 -0700 [thread overview]
Message-ID: <3910157f-dbb7-4048-ac52-a2b354048be6@kernel.dk> (raw)
In-Reply-To: <d8485e78-5cf5-47c1-89d4-89f52ba7149f@acm.org>
On 1/18/24 11:24 AM, Bart Van Assche wrote:
> On 1/18/24 10:04, Jens Axboe wrote:
>> If we're entering request dispatch but someone else is already
>> dispatching, then just skip this dispatch. We know IO is inflight and
>> this will trigger another dispatch event for any completion. This will
>> potentially cause slightly lower queue depth for contended cases, but
>> those are slowed down anyway and this should not cause an issue.
>
> Shouldn't a performance optimization patch include numbers that show by
> how much that patch improves the performance of different workloads?
The commit messages may want some editing, but all of that is in the
cover letter that I'm sure you saw. This is just a POC/RFC posting.
>> struct deadline_data {
>> /*
>> * run time data
>> */
>> + struct {
>> + spinlock_t lock;
>> + spinlock_t zone_lock;
>> + } ____cacheline_aligned_in_smp;
>
> Is ____cacheline_aligned_in_smp useful here? struct deadline_data
> is not embedded in any other data structure but is allocated with kzalloc_node().
It's not for alignment of deadline_data, it's for alignment within
deadline_data so that grabbing/releasing these locks don't share a
cacheline with other bits. We could ensure that deadline_data itself
is aligned as well, that might be a good idea.
>> + /*
>> + * 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.
>> + */
>> + if (test_bit(DD_DISPATCHING, &dd->run_state) ||
>> + test_and_set_bit(DD_DISPATCHING, &dd->run_state))
>> + return NULL;
>> +
>
> The above code behaves similar to spin_trylock(). Has it been
> considered to use spin_trylock() instead?
Do you read the replies to the emails, from the other thread? First of
all, you'd need another lock for this. And secondly, this avoids a RMW
if it's already set. So no, I think this is cleaner than a separate
lock, and you'd still have cacheline bouncing on that for ALL calls if
you did it that way.
--
Jens Axboe
next prev parent reply other threads:[~2024-01-18 18:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 18:04 [PATCHSET RFC 0/2] mq-deadline scalability improvements Jens Axboe
2024-01-18 18:04 ` [PATCH 1/2] block/mq-deadline: serialize request dispatching Jens Axboe
2024-01-18 18:24 ` Bart Van Assche
2024-01-18 18:45 ` Jens Axboe [this message]
2024-01-18 18:51 ` Bart Van Assche
2024-01-18 18:55 ` Jens Axboe
2024-01-19 2:40 ` Ming Lei
2024-01-19 15:49 ` Jens Axboe
2024-01-18 18:04 ` [PATCH 2/2] block/mq-deadline: fallback to per-cpu insertion buckets under contention Jens Axboe
2024-01-18 18:25 ` Keith Busch
2024-01-18 18:28 ` Jens Axboe
2024-01-18 18:31 ` Bart Van Assche
2024-01-18 18:33 ` Jens Axboe
2024-01-18 18:53 ` Bart Van Assche
2024-01-18 18:56 ` Jens Axboe
2024-01-18 20:46 ` Bart Van Assche
2024-01-18 20:52 ` Jens Axboe
2024-01-19 23:11 ` Bart Van Assche
2024-01-18 19:29 ` [PATCHSET RFC 0/2] mq-deadline scalability improvements Jens Axboe
2024-01-18 20:22 ` 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=3910157f-dbb7-4048-ac52-a2b354048be6@kernel.dk \
--to=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--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