Skip to content

dm: reduce memory overhead of DM devices

Junichi Nomura dm-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4dm: remove nr_iovecs parameter from alloc_tio()drivers/md/dm.c+4 -91 reply
2/4block: use bio_clone_fast() in blk_rq_prep_clone()block/blk-core.c+1 -10 replies
3/4block: add bioset_nobvec_create()block/bio.c include/linux/bio.h+45 -171 reply
4/4dm: use bioset_nobvec_create()drivers/md/dm.c+1 -10 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMike Snitzer
SeriesA-b
1/4
2/4
3/4A-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] dm: reduce memory overhead of DM devices

This series of patches reduce the memory overhead of device-mapper device mainly by removing unused mempool for bio vecs.

DM creates per-device bioset to ensure forward progress under low memory situation and bioset always includes mempool for bvec.

However, with the introduction of immutable bvec by Kent Overstreet, dm core now uses bio_clone_fast for creating a clone bio, and no longer needs bvecs for it.

For example, when you create 10,000 bio-based DM devices and 1,000 request-based DM devices, memory usage of biovec under no load is:

  # grep biovec /proc/slabinfo
  biovec-256        418068 418068   4096  ...
  biovec-128             0      0   2048  ...
  biovec-64              0      0   1024  ...
  biovec-16              0      0    256  ...

With this patch series applied, the usage becomes:

  # grep biovec /proc/slabinfo
  biovec-256           116    116   4096  ...
  biovec-128             0      0   2048  ...
  biovec-64              0      0   1024  ...
  biovec-16              0      0    256  ...

So 4096 * (418068 - 116) = 1.6GB of memory is saved in this example.

Jun'ichi Nomura (4):
dm: remove nr_iovecs parameter from alloc_tio()
block: use bio_clone_fast() in blk_rq_prep_clone()
block: add bioset_nobvec_create()
dm: use bioset_nobvec_create()

 block/bio.c         | 61 ++++++++++++++++++++++++++++++++++++++---------------
 block/blk-core.c    |  2 +-
 drivers/md/dm.c     | 15 +++++--------
 include/linux/bio.h |  1 +
 4 files changed, 51 insertions(+), 28 deletions(-)
Signature · 4 lines
1.9.3

--
Jun'ichi Nomura, NEC Corporation