linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<ming.lei@redhat.com>, <linux-scsi@vger.kernel.org>,
	<kashyap.desai@broadcom.com>, <hare@suse.de>,
	John Garry <john.garry@huawei.com>
Subject: [PATCH 0/9] blk-mq: Reduce static requests memory footprint for shared sbitmap
Date: Wed, 14 Jul 2021 23:06:26 +0800	[thread overview]
Message-ID: <1626275195-215652-1-git-send-email-john.garry@huawei.com> (raw)

Currently a full set of static requests are allocated per hw queue per
tagset when shared sbitmap is used.

However, only tagset->queue_depth number of requests may be active at
any given time. As such, only tagset->queue_depth number of static
requests are required.

The same goes for using an IO scheduler, which allocates a full set of
static requests per hw queue per request queue.

This series very significantly reduces memory usage in both scenarios by
allocating static rqs per tagset and per request queue, respectively,
rather than per hw queue per tagset and per request queue.

For megaraid sas driver on my 128-CPU arm64 system with 1x SATA disk, we
save approx. 300MB(!) [370MB -> 60MB]

A couple of patches are marked as RFC, as maybe there is a better
implementation approach.

Any more testing would be appreciated also.

John Garry (9):
  blk-mq: Change rqs check in blk_mq_free_rqs()
  block: Rename BLKDEV_MAX_RQ -> BLKDEV_DEFAULT_RQ
  blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests()
  blk-mq: Add blk_mq_tag_resize_sched_shared_sbitmap()
  blk-mq: Invert check in blk_mq_update_nr_requests()
  blk-mq: Refactor blk_mq_{alloc,free}_rqs
  blk-mq: Allocate per tag set static rqs for shared sbitmap
  blk-mq: Allocate per request queue static rqs for shared sbitmap
  blk-mq: Clear mappings for shared sbitmap sched static rqs

 block/blk-core.c       |   2 +-
 block/blk-mq-sched.c   |  57 ++++++++++++--
 block/blk-mq-sched.h   |   2 +-
 block/blk-mq-tag.c     |  22 ++++--
 block/blk-mq-tag.h     |   1 +
 block/blk-mq.c         | 165 +++++++++++++++++++++++++++++++----------
 block/blk-mq.h         |   9 +++
 drivers/block/rbd.c    |   2 +-
 include/linux/blk-mq.h |   4 +
 include/linux/blkdev.h |   6 +-
 10 files changed, 215 insertions(+), 55 deletions(-)

-- 
2.26.2


             reply	other threads:[~2021-07-14 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 15:06 John Garry [this message]
2021-07-14 15:06 ` [PATCH 1/9] blk-mq: Change rqs check in blk_mq_free_rqs() John Garry
2021-07-20  7:35   ` Ming Lei
2021-07-14 15:06 ` [PATCH 2/9] block: Rename BLKDEV_MAX_RQ -> BLKDEV_DEFAULT_RQ John Garry
2021-07-20  7:44   ` Ming Lei
2021-07-14 15:06 ` [PATCH 3/9] blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests() John Garry
2021-07-20  7:50   ` Ming Lei
2021-07-20  8:06     ` John Garry
2021-07-14 15:06 ` [PATCH 4/9] blk-mq: Add blk_mq_tag_resize_sched_shared_sbitmap() John Garry
2021-07-20  7:57   ` Ming Lei
2021-07-20  8:08     ` John Garry
2021-07-14 15:06 ` [PATCH 5/9] blk-mq: Invert check in blk_mq_update_nr_requests() John Garry
2021-07-14 15:06 ` [PATCH RFC 6/9] blk-mq: Refactor blk_mq_{alloc,free}_rqs John Garry
2021-07-14 15:06 ` [PATCH RFC 7/9] blk-mq: Allocate per tag set static rqs for shared sbitmap John Garry
2021-07-14 15:06 ` [PATCH 8/9] blk-mq: Allocate per request queue " John Garry
2021-07-14 15:06 ` [PATCH 9/9] blk-mq: Clear mappings for shared sbitmap sched static rqs John Garry
2021-07-20 15:22 ` [PATCH 0/9] blk-mq: Reduce static requests memory footprint for shared sbitmap Ming Lei
2021-07-20 17:05   ` John Garry

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=1626275195-215652-1-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).