All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Frank Mayhar <fmayhar@google.com>
Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: dm: Make MIN_IOS, et al, tunable via sysctl.
Date: Mon, 19 Aug 2013 10:00:16 -0400	[thread overview]
Message-ID: <20130819140016.GB27167@redhat.com> (raw)
In-Reply-To: <1376070533.26057.244.camel@bobble.lax.corp.google.com>

On Fri, Aug 16 2013 at  6:55pm -0400,
Frank Mayhar <fmayhar@google.com> wrote:

> The device mapper and some of its modules allocate memory pools at
> various points when setting up a device.  In some cases, these pools are
> fairly large, for example the multipath module allocates a 256-entry
> pool and the dm itself allocates three of that size.  In a
> memory-constrained environment where we're creating a lot of these
> devices, the memory use can quickly become significant.  Unfortunately,
> there's currently no way to change the size of the pools other than by
> changing a constant and rebuilding the kernel.
> 
> This patch fixes that by changing the hardcoded MIN_IOS (and certain
> other) #defines in dm-crypt, dm-io, dm-mpath, dm-snap and dm itself to
> sysctl-modifiable values.  This lets us change the size of these pools
> on the fly, we can reduce the size of the pools and reduce memory
> pressure.

These memory reserves are a long-standing issue with DM (made worse when
request-based mpath was introduced).  Two years ago, I assembled a patch
series that took one approach to trying to fix it:
http://people.redhat.com/msnitzer/patches/upstream/dm-rq-based-mempool-sharing/series.html

But in the end I wasn't convinced sharing the memory reserve would allow
for 100s of mpath devices to make forward progress if memory is
depleted.

All said, I think adding the ability to control the size of the memory
reserves is reasonable.  It allows for informed admins to establish
lower reserves (based on the awareness that rq-based mpath doesn't need
to support really large IOs, etc) without compromising the ability to
make forward progress.

But, as mentioned in my porevious mail, I'd like to see this implemnted
in terms of module_param_named().

> We tested performance of dm-mpath with smaller MIN_IOS sizes for both dm
> and dm-mpath, from a value of 32 all the way down to zero.

Bio-based can safely be reduced, as this older (uncommitted) patch did:
http://people.redhat.com/msnitzer/patches/upstream/dm-rq-based-mempool-sharing/0000-dm-lower-bio-based-reservation.patch

> Bearing in mind that the underlying devices were network-based, we saw
> essentially no performance degradation; if there was any, it was down
> in the noise.  One might wonder why these sizes are the way they are;
> I investigated and they've been unchanged since at least 2006.

Performance isn't the concern.  The concern is: does DM allow for
forward progress if the system's memory is completely exhausted?

This is why request-based has such an extensive reserve, because it
needs to account for cloning the largest possible request that comes in
(with multiple bios).

WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@redhat.com>
To: Frank Mayhar <fmayhar@google.com>
Cc: linux-kernel@vger.kernel.org, dm-devel@redhat.com
Subject: Re: dm: Make MIN_IOS, et al, tunable via sysctl.
Date: Mon, 19 Aug 2013 10:00:16 -0400	[thread overview]
Message-ID: <20130819140016.GB27167@redhat.com> (raw)
In-Reply-To: <1376070533.26057.244.camel@bobble.lax.corp.google.com>

On Fri, Aug 16 2013 at  6:55pm -0400,
Frank Mayhar <fmayhar@google.com> wrote:

> The device mapper and some of its modules allocate memory pools at
> various points when setting up a device.  In some cases, these pools are
> fairly large, for example the multipath module allocates a 256-entry
> pool and the dm itself allocates three of that size.  In a
> memory-constrained environment where we're creating a lot of these
> devices, the memory use can quickly become significant.  Unfortunately,
> there's currently no way to change the size of the pools other than by
> changing a constant and rebuilding the kernel.
> 
> This patch fixes that by changing the hardcoded MIN_IOS (and certain
> other) #defines in dm-crypt, dm-io, dm-mpath, dm-snap and dm itself to
> sysctl-modifiable values.  This lets us change the size of these pools
> on the fly, we can reduce the size of the pools and reduce memory
> pressure.

These memory reserves are a long-standing issue with DM (made worse when
request-based mpath was introduced).  Two years ago, I assembled a patch
series that took one approach to trying to fix it:
http://people.redhat.com/msnitzer/patches/upstream/dm-rq-based-mempool-sharing/series.html

But in the end I wasn't convinced sharing the memory reserve would allow
for 100s of mpath devices to make forward progress if memory is
depleted.

All said, I think adding the ability to control the size of the memory
reserves is reasonable.  It allows for informed admins to establish
lower reserves (based on the awareness that rq-based mpath doesn't need
to support really large IOs, etc) without compromising the ability to
make forward progress.

But, as mentioned in my porevious mail, I'd like to see this implemnted
in terms of module_param_named().

> We tested performance of dm-mpath with smaller MIN_IOS sizes for both dm
> and dm-mpath, from a value of 32 all the way down to zero.

Bio-based can safely be reduced, as this older (uncommitted) patch did:
http://people.redhat.com/msnitzer/patches/upstream/dm-rq-based-mempool-sharing/0000-dm-lower-bio-based-reservation.patch

> Bearing in mind that the underlying devices were network-based, we saw
> essentially no performance degradation; if there was any, it was down
> in the noise.  One might wonder why these sizes are the way they are;
> I investigated and they've been unchanged since at least 2006.

Performance isn't the concern.  The concern is: does DM allow for
forward progress if the system's memory is completely exhausted?

This is why request-based has such an extensive reserve, because it
needs to account for cloning the largest possible request that comes in
(with multiple bios).

  parent reply	other threads:[~2013-08-19 14:00 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 17:48 [PATCH] dm: Make MIN_IOS, et al, tunable via sysctl Frank Mayhar
2013-08-13 16:41 ` Frank Mayhar
2013-08-16 22:58 ` Frank Mayhar
2013-08-17 12:30 ` [dm-devel] " Alasdair G Kergon
2013-08-19 13:40   ` Mike Snitzer
2013-08-19 15:04     ` Frank Mayhar
2013-08-19 14:00 ` Mike Snitzer [this message]
2013-08-19 14:00   ` Mike Snitzer
2013-08-19 17:54   ` [dm-devel] " Frank Mayhar
2013-08-19 18:15     ` Mike Snitzer
2013-08-20 21:44     ` [dm-devel] " Mikulas Patocka
2013-08-20 21:52       ` Frank Mayhar
2013-08-20 21:41   ` Mikulas Patocka
2013-08-20 21:22 ` [dm-devel] [PATCH] " Mikulas Patocka
2013-08-20 21:28   ` Frank Mayhar
2013-08-20 21:47     ` Mikulas Patocka
2013-08-20 21:57       ` Frank Mayhar
2013-08-20 22:24         ` Mike Snitzer
2013-08-20 22:52           ` Mikulas Patocka
2013-08-20 23:14           ` Frank Mayhar
2013-08-22 17:26             ` Frank Mayhar
2013-08-26 14:28             ` Mikulas Patocka
2013-09-12 22:24               ` [PATCH 0/7] dm: allow mempool and bioset reserves to be tuned Mike Snitzer
2013-09-12 22:24                 ` [PATCH 1/7] dm: lower bio-based mempool reservation Mike Snitzer
2013-09-12 22:40                   ` Mikulas Patocka
2013-09-12 22:24                 ` [PATCH 2/7] dm: add reserved_rq_based_ios module parameter Mike Snitzer
2013-09-12 22:45                   ` Mikulas Patocka
2013-09-12 23:15                     ` Mike Snitzer
2013-09-12 23:27                       ` Mikulas Patocka
2013-09-12 23:32                         ` Mike Snitzer
2013-09-12 22:24                 ` [PATCH 3/7] dm: add reserved_bio_based_ios " Mike Snitzer
2013-09-12 22:47                   ` Mikulas Patocka
2013-09-12 23:11                     ` Mike Snitzer
2013-09-12 23:17                       ` Mikulas Patocka
2013-09-18 15:17                         ` Frank Mayhar
2013-09-12 22:24                 ` [PATCH 4/7] dm io: use dm_get_reserved_bio_based_ios to size reserves Mike Snitzer
2013-09-12 22:48                   ` Mikulas Patocka
2013-09-12 22:24                 ` [PATCH 5/7] dm mpath: use dm_get_reserved_rq_based_ios to size mempool Mike Snitzer
2013-09-12 22:48                   ` Mikulas Patocka
2013-09-12 22:24                 ` [PATCH 6/7] dm: track the maximum number of bios in a cloned request Mike Snitzer
2013-09-12 22:55                   ` Mikulas Patocka
2013-09-12 23:09                     ` Mike Snitzer
2013-09-12 22:24                 ` [PATCH 7/7] dm: optimize clone_rq() when track_peak_rq_based_ios is disabled Mike Snitzer
2013-09-12 23:00                   ` Mikulas Patocka
2013-09-12 23:06                     ` Mike Snitzer
2013-09-12 23:30                       ` Mikulas Patocka
2013-09-12 23:53                         ` Mike Snitzer
2013-09-13  4:46                           ` Jun'ichi Nomura
2013-09-13 13:04                             ` Mike Snitzer
2013-09-13 14:34                             ` Mikulas Patocka
2013-09-13 18:59                 ` [PATCH v2 0/3] dm: allow mempool and bioset reserves to be tuned Mike Snitzer
2013-09-13 18:59                   ` [PATCH v2 1/3] dm: lower bio-based mempool reservation Mike Snitzer
2013-09-13 18:59                   ` [PATCH v2 2/3] dm: add reserved_rq_based_ios module parameter Mike Snitzer
2013-09-13 18:59                   ` [PATCH v2 3/3] dm: add reserved_bio_based_ios " Mike Snitzer
2013-09-13 19:22                   ` [PATCH v2 0/3] dm: allow mempool and bioset reserves to be tuned Mike Snitzer
2013-09-13 20:30                     ` Mike Snitzer
2013-09-13 21:08                       ` [PATCH v3 " Mike Snitzer
2013-09-13 21:08                         ` [PATCH v3 1/3] dm: lower bio-based mempool reservation Mike Snitzer
2013-09-13 21:08                         ` [PATCH v3 2/3] dm: add reserved_rq_based_ios module parameter Mike Snitzer
2013-09-13 21:08                         ` [PATCH v3 3/3] dm: add reserved_bio_based_ios " Mike Snitzer
2013-09-18 15:10                         ` [PATCH v3 0/3] dm: allow mempool and bioset reserves to be tuned Frank Mayhar

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=20130819140016.GB27167@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=fmayhar@google.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.