Re: [PATCH 1/2] block/mq-deadline: serialize request dispatching

Bart Van Assche
2024-01-18T18:24:25Z

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?

> 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().

> + /*
> + * 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?

Thanks,

Bart.