mbox series

[v4,0/4] blk-mq: optimize flush and request size

Message ID 20230717040058.3993930-1-chengming.zhou@linux.dev (mailing list archive)
Headers show
Series blk-mq: optimize flush and request size | expand

Message

Chengming Zhou July 17, 2023, 4 a.m. UTC
From: Chengming Zhou <zhouchengming@bytedance.com>

v4:
 - Rebase on the updated block/master branch, which include a flush bugfix
   from Christoph. Please help to check patch 04. Thanks!
 - Add a bugfix patch 02 for post-flush requests, put before other flush optimizations.
 - Collect Reviewed-by tags from Ming and Christoph. Thanks!
 - [v3] https://lore.kernel.org/lkml/20230707093722.1338589-1-chengming.zhou@linux.dev/

v3:
 - Collect Reviewed-by tags from Ming and Christoph. Thanks!
 - Remove the list and csd variables which are only used once.
 - Fix a bug report of blktests nvme/012 by re-initialization of
   rq->queuelist, which maybe corrupted by rq->rq_next reuse.
 - [v2] https://lore.kernel.org/all/20230629110359.1111832-1-chengming.zhou@linux.dev/

v2:
 - Change to use call_single_data_t, which use __aligned() to avoid
   to use 2 cache lines for 1 csd. Thanks Ming Lei.
 - [v1] https://lore.kernel.org/all/20230627120854.971475-1-chengming.zhou@linux.dev/

Hello,

After the commit be4c427809b0 ("blk-mq: use the I/O scheduler for
writes from the flush state machine"), rq->flush can't reuse rq->elv
anymore, since flush_data requests can go into io scheduler now.

That increased the size of struct request by 24 bytes, but this
patchset can decrease the size by 40 bytes, which is good I think.

patch 1 use percpu csd to do remote complete instead of per-rq csd,
decrease the size by 24 bytes.

patch 2 fixes a bug in blk-flush for post-flush requests.

patch 3-4 reuse rq->queuelist in flush state machine pending list,
and maintain unsigned long counter of inflight flush_data requests,
decrease the size by 16 bytes.

Thanks for comments!

Chengming Zhou (4):
  blk-mq: use percpu csd to remote complete instead of per-rq csd
  blk-flush: fix rq->flush.seq for post-flush requests
  blk-flush: count inflight flush_data requests
  blk-flush: reuse rq queuelist in flush state machine

 block/blk-flush.c      | 26 +++++++++++++++-----------
 block/blk-mq.c         | 12 ++++++------
 block/blk.h            |  5 ++---
 include/linux/blk-mq.h |  6 +-----
 4 files changed, 24 insertions(+), 25 deletions(-)

Comments

Jens Axboe July 17, 2023, 2:18 p.m. UTC | #1
On Mon, 17 Jul 2023 12:00:54 +0800, chengming.zhou@linux.dev wrote:
> v4:
>  - Rebase on the updated block/master branch, which include a flush bugfix
>    from Christoph. Please help to check patch 04. Thanks!
>  - Add a bugfix patch 02 for post-flush requests, put before other flush optimizations.
>  - Collect Reviewed-by tags from Ming and Christoph. Thanks!
>  - [v3] https://lore.kernel.org/lkml/20230707093722.1338589-1-chengming.zhou@linux.dev/
> 
> [...]

Applied, thanks!

[1/4] blk-mq: use percpu csd to remote complete instead of per-rq csd
      commit: 660e802c76c89e871c29cd3174c07c8d23e39c35
[2/4] blk-flush: fix rq->flush.seq for post-flush requests
      commit: 28b241237470981a96fbd82077c8044466b61e5f
[3/4] blk-flush: count inflight flush_data requests
      commit: b175c86739d38e41044d3136065f092a6d95aee6
[4/4] blk-flush: reuse rq queuelist in flush state machine
      commit: 81ada09cc25e4bf2de7d2951925fb409338a545d

Best regards,