mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
Adjust arc_p based on "bytes" in arc_shrink
In an attempt to prevent arc_c from collapsing "too fast", the
arc_shrink() function was updated to take a "bytes" parameter by this
change:
commit 302f753f16
Author: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Tue Mar 13 14:29:16 2012 -0700
Integrate ARC more tightly with Linux
Unfortunately, that change failed to make a similar change to the way
that arc_p was updated. So, there still exists the possibility for arc_p
to collapse to near 0 when the kernel start calling the arc's shrinkers.
This change attempts to fix this, by decrementing arc_p by the "bytes"
parameter in the same way that arc_c is updated.
In addition, a minimum value of arc_p is attempted to be maintained,
similar to the way a minimum arc_p value is maintained in arc_adapt().
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2110
This commit is contained in:
parent
9141582592
commit
39e055c44b
@ -2332,6 +2332,7 @@ void
|
|||||||
arc_shrink(uint64_t bytes)
|
arc_shrink(uint64_t bytes)
|
||||||
{
|
{
|
||||||
if (arc_c > arc_c_min) {
|
if (arc_c > arc_c_min) {
|
||||||
|
uint64_t arc_p_min;
|
||||||
uint64_t to_free;
|
uint64_t to_free;
|
||||||
|
|
||||||
to_free = bytes ? bytes : arc_c >> zfs_arc_shrink_shift;
|
to_free = bytes ? bytes : arc_c >> zfs_arc_shrink_shift;
|
||||||
@ -2341,7 +2342,14 @@ arc_shrink(uint64_t bytes)
|
|||||||
else
|
else
|
||||||
arc_c = arc_c_min;
|
arc_c = arc_c_min;
|
||||||
|
|
||||||
atomic_add_64(&arc_p, -(arc_p >> zfs_arc_shrink_shift));
|
arc_p_min = (arc_c >> zfs_arc_p_min_shift);
|
||||||
|
to_free = bytes ? bytes : arc_p >> zfs_arc_shrink_shift;
|
||||||
|
|
||||||
|
if (arc_p > arc_p_min + to_free)
|
||||||
|
atomic_add_64(&arc_p, -to_free);
|
||||||
|
else
|
||||||
|
arc_p = arc_p_min;
|
||||||
|
|
||||||
if (arc_c > arc_size)
|
if (arc_c > arc_size)
|
||||||
arc_c = MAX(arc_size, arc_c_min);
|
arc_c = MAX(arc_size, arc_c_min);
|
||||||
if (arc_p > arc_c)
|
if (arc_p > arc_c)
|
||||||
|
Loading…
Reference in New Issue
Block a user