diff mbox

[v2,4/4] dm: use bioset_create_nobvec()

Message ID 1412371633-30356-4-git-send-email-snitzer@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

Mike Snitzer Oct. 3, 2014, 9:27 p.m. UTC
From: Junichi Nomura <j-nomura@ce.jp.nec.com>

Since DM core uses bio_clone_fast() for both bio-based and request-based
DM devices there is no need for DM's bioset to have a bvec mempool.

With this patch, on arch with 4KB page for example, memory usage will be
reduced by 64KB for each bio-based DM device and 1MB for each
request-based DM device.

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.

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/md/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junichi Nomura Oct. 5, 2014, 11:06 p.m. UTC | #1
On 10/04/14 06:27, Mike Snitzer wrote:
> @@ -3021,7 +3021,7 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity, u
>  	if (!pools->io_pool)
>  		goto out;
>  
> -	pools->bs = bioset_create(pool_size, front_pad);
> +	pools->bs = bioset_nobvec_create(pool_size, front_pad);
>  	if (!pools->bs)
>  		goto out;

Hi Mike,

thank you for the rename. It's better.
But we have to s/nobvec_create/create_nobvec/ here, too.
Mike Snitzer Oct. 6, 2014, 12:24 a.m. UTC | #2
On Sun, Oct 05 2014 at  7:06pm -0400,
Junichi Nomura <j-nomura@ce.jp.nec.com> wrote:

> On 10/04/14 06:27, Mike Snitzer wrote:
> > @@ -3021,7 +3021,7 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity, u
> >  	if (!pools->io_pool)
> >  		goto out;
> >  
> > -	pools->bs = bioset_create(pool_size, front_pad);
> > +	pools->bs = bioset_nobvec_create(pool_size, front_pad);
> >  	if (!pools->bs)
> >  		goto out;
> 
> Hi Mike,
> 
> thank you for the rename. It's better.
> But we have to s/nobvec_create/create_nobvec/ here, too.

Oops, thanks for letting me know.  I've fixed it and rebased
linux-dm.git's for-next branch ontop of linux-block's for-3.18/core
since Jens staged your 2 block patches.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index aaeed99..f78ac7f 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -3021,7 +3021,7 @@  struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity, u
 	if (!pools->io_pool)
 		goto out;
 
-	pools->bs = bioset_create(pool_size, front_pad);
+	pools->bs = bioset_nobvec_create(pool_size, front_pad);
 	if (!pools->bs)
 		goto out;