Thread (17 messages) 17 messages, 4 authors, 2021-09-27

Re: [PATCH 3/4] block/mq-deadline: Stop using per-CPU counters

From: Damien Le Moal <hidden>
Date: 2021-09-27 00:19:51

On 2021/09/25 11:59, Bart Van Assche wrote:
On 9/24/21 03:58, Damien Le Moal wrote:
quoted
On 2021/09/24 8:27, Bart Van Assche wrote:
quoted
-/* I/O statistics for all I/O priorities (enum dd_prio). */
-struct io_stats {
-	struct io_stats_per_prio stats[DD_PRIO_COUNT];
+	uint32_t inserted;
+	uint32_t merged;
+	uint32_t dispatched;
+	atomic_t completed;
Why not use 64-bits types (regular unsigned long long and atomic64_t) ?
Even 64-bit counters can overflow. Using 32-bit counters makes it easier to
trigger an overflow of these counters.
I was more thinking about the speed of additions/subtractions on 64-bits arch,
which is a large part (the majority ?) of mq-deadline users. Not sure if there
is a difference in speed for 32 bits and 64 bits simple math on 64 bits arch
though. Probably not.

Another thing: in patch 3, you are actually not handling the overflows. So
dd_queued() may return some very weird number (temporarily) when the inserted
count overflows before the completed count does. Since
dd_dispatch_aged_requests() does not care about the actual value of dd_queued(),
only if it is 0 or not, I am not 100% sure if it is useful to fix. Except maybe
for sysfs attributes ?



-- 
Damien Le Moal
Western Digital Research
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help