linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET v4 0/6] Cache issue side time querying
@ 2024-01-23 17:30 Jens Axboe
  2024-01-23 17:30 ` [PATCH 1/6] block: move cgroup time handling code into blkdev.h Jens Axboe
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Jens Axboe @ 2024-01-23 17:30 UTC (permalink / raw)
  To: linux-block

Hi,

When I run my peak testing to see if we've regressed, my test script
always does:

	echo 0 > /sys/block/$DEV/queue/iostats
	echo 2 > /sys/block/$DEV/queue/nomerges

for each device being used. It's unfortunate that we need to disable
iostats, but without doing that, I lose about 12% performance. The main
reason for that is the time querying we need to do, when iostats are
enabled. As it turns out, lots of other block code is quite trigger
happy with querying time as well. We do have some nice batching in place
which helps ammortize that, but it's not perfect.

This trivial patchset simply caches the current time in struct blk_plug,
on the premise that any issue side time querying can get adequate
granularity through that. Nobody really needs nsec granularity on the
timestamp.

Results in patch 3, but tldr is a more than 9% improvement (108M -> 118M
IOPS) for my test case, which doesn't even enable most of the costly
block layer items that you'd typically find in a distro and which would
further increase the number of issue side time calls. This brings iostats
enabled _almost_ to the level of turning it off.

Can also be found in my block-issue-ts branch:

https://git.kernel.dk/cgit/linux/log/?h=block-issue-ts

 block/bfq-cgroup.c        | 14 +++---
 block/bfq-iosched.c       | 28 +++++------
 block/blk-cgroup.c        |  2 +-
 block/blk-core.c          | 33 +++++++------
 block/blk-flush.c         |  2 +-
 block/blk-iocost.c        |  8 ++--
 block/blk-iolatency.c     |  6 +--
 block/blk-mq.c            | 18 ++++----
 block/blk-throttle.c      |  6 +--
 block/blk-wbt.c           |  5 +-
 drivers/md/raid1-10.c     |  2 +-
 include/linux/blk_types.h | 42 -----------------
 include/linux/blkdev.h    | 97 ++++++++++++++++++++++++++++++++++++---
 include/linux/sched.h     |  2 +-
 kernel/sched/core.c       |  4 +-
 15 files changed, 160 insertions(+), 109 deletions(-)

Changes since v3:
	- Include a ktime_get() variant, and use that to convert the
	  remaining ktime user (BFQ)
	- Remove RFC label, I think this is ready to go
	- Rebase on 6.8-rc1

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCHSET RFC v3 0/6] Cache issue side time querying
@ 2024-01-18 19:20 Jens Axboe
  2024-01-18 19:20 ` [PATCH 6/6] block: convert struct blk_plug callback list to hlists Jens Axboe
  0 siblings, 1 reply; 15+ messages in thread
From: Jens Axboe @ 2024-01-18 19:20 UTC (permalink / raw)
  To: linux-block

Hi,

When I run my peak testing to see if we've regressed, my test script
always does:

	echo 0 > /sys/block/$DEV/queue/iostats
	echo 2 > /sys/block/$DEV/queue/nomerges

for each device being used. It's unfortunate that we need to disable
iostats, but without doing that, I lose about 12% performance. The main
reason for that is the time querying we need to do, when iostats are
enabled. As it turns out, lots of other block code is quite trigger
happy with querying time as well. We do have some nice batching in place
which helps ammortize that, but it's not perfect.

This trivial patchset simply caches the current time in struct blk_plug,
on the premise that any issue side time querying can get adequate
granularity through that. Nobody really needs nsec granularity on the
timestamp.

Results in patch 2, but tldr is a more than 9% improvement (108M -> 118M
IOPS) for my test case, which doesn't even enable most of the costly
block layer items that you'd typically find in a distro and which would
further increase the number of issue side time calls. This brings iostats
enabled _almost_ to the level of turning it off.

Can also be found in my block-issue-ts branch:

https://git.kernel.dk/cgit/linux/log/?h=block-issue-ts

 block/bfq-cgroup.c        | 14 +++---
 block/bfq-iosched.c       | 22 +++++-----
 block/blk-cgroup.c        |  2 +-
 block/blk-core.c          | 33 ++++++++------
 block/blk-flush.c         |  2 +-
 block/blk-iocost.c        |  6 +--
 block/blk-iolatency.c     |  6 +--
 block/blk-mq.c            | 18 ++++----
 block/blk-throttle.c      |  6 +--
 block/blk-wbt.c           |  5 +--
 drivers/md/raid1-10.c     |  2 +-
 include/linux/blk_types.h | 42 ------------------
 include/linux/blkdev.h    | 92 ++++++++++++++++++++++++++++++++++++---
 include/linux/sched.h     |  2 +-
 kernel/sched/core.c       |  4 +-
 15 files changed, 151 insertions(+), 105 deletions(-)

Changes since v2:
	- Ensure PF_BLOCK_TS is cleared when plug is flushed or
	  invalidated
	- Fix missing raid1-10 conversion
	- Fix missing cgroup timestamp

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-01-24 15:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 17:30 [PATCHSET v4 0/6] Cache issue side time querying Jens Axboe
2024-01-23 17:30 ` [PATCH 1/6] block: move cgroup time handling code into blkdev.h Jens Axboe
2024-01-23 17:30 ` [PATCH 2/6] block: add blk_time_get_ns() and blk_time_get() helpers Jens Axboe
2024-01-24  9:28   ` Christoph Hellwig
2024-01-24 15:04     ` Jens Axboe
2024-01-23 17:30 ` [PATCH 3/6] block: cache current nsec time in struct blk_plug Jens Axboe
2024-01-23 17:30 ` [PATCH 4/6] block: update cached timestamp post schedule/preemption Jens Axboe
2024-01-23 17:55   ` Keith Busch
2024-01-23 19:15     ` Jens Axboe
2024-01-23 17:30 ` [PATCH 5/6] block: shrink plug->{nr_ios, rq_count} to unsigned char Jens Axboe
2024-01-24  9:29   ` Christoph Hellwig
2024-01-24 15:04     ` Jens Axboe
2024-01-23 17:30 ` [PATCH 6/6] block: convert struct blk_plug callback list to hlists Jens Axboe
2024-01-24  9:30   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2024-01-18 19:20 [PATCHSET RFC v3 0/6] Cache issue side time querying Jens Axboe
2024-01-18 19:20 ` [PATCH 6/6] block: convert struct blk_plug callback list to hlists Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).