]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
md/raid5: allow the stripe_cache to grow and shrink.
authorNeilBrown <neilb@suse.de>
Thu, 26 Feb 2015 01:47:56 +0000 (12:47 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 21 Apr 2015 22:00:43 +0000 (08:00 +1000)
commitedbe83ab4c27ea6669eb57adb5ed7eaec1118ceb
tree0bfa3622e7c297cd7fc2b42a56bc5006ff87bfdc
parent5423399a84ee1d92d29d763029ed40e4905cf50f
md/raid5: allow the stripe_cache to grow and shrink.

The default setting of 256 stripe_heads is probably
much too small for many configurations.  So it is best to make it
auto-configure.

Shrinking the cache under memory pressure is easy.  The only
interesting part here is that we put a fairly high cost
('seeks') on shrinking the cache as the cost is greater than
just having to read more data, it reduces parallelism.

Growing the cache on demand needs to be done carefully.  If we allow
fast growth, that can upset memory balance as lots of dirty memory can
quickly turn into lots of memory queued in the stripe_cache.
It is important for the raid5 block device to appear congested to
allow write-throttling to work.

So we only add stripes slowly. We set a flag when an allocation
fails because all stripes are in use, allocate at a convenient
time when that flag is set, and don't allow it to be set again
until at least one stripe_head has been released for re-use.

This means that a spurt of requests will only cause one stripe_head
to be allocated, but a steady stream of requests will slowly
increase the cache size - until memory pressure puts it back again.

It could take hours to reach a steady state.

The value written to, and displayed in, stripe_cache_size is
used as a minimum.  The cache can grow above this and shrink back
down to it.  The actual size is not directly visible, though it can
be deduced to some extent by watching stripe_cache_active.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid5.c
drivers/md/raid5.h