diff options
author | Alexander Motin <[email protected]> | 2024-07-25 13:31:14 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-25 10:31:14 -0700 |
commit | 55427add3caab494476d8445829f07bd2cf8be23 (patch) | |
tree | eed114fad7281bb302881621ef01d43de49fc52e /include/sys | |
parent | c7ada64bb664d5fab73f255099da5e170e7c82e5 (diff) |
Several improvements to ARC shrinking (#16197)
- When receiving memory pressure signal from OS be more strict
trying to free some memory. Otherwise kernel may come again and
request much more. Return as result how much arc_c was actually
reduced due to this request, that may be less than requested.
- On Linux when receiving direct reclaim from some file system
(that may be ZFS) instead of ignoring request completely, just
shrink the ARC, but do not wait for eviction. Waiting there may
cause deadlock. Ignoring it as before may put extra pressure on
other caches and/or swap, and cause OOM if nothing help. While
not waiting may result in more ARC evicted later, and may be too
late if OOM killer activate right now, but I hope it to be better
than doing nothing at all.
- On Linux set arc_no_grow before waiting for reclaim, not after,
or it may grow back while we are waiting.
- On Linux add new parameter zfs_arc_shrinker_seeks to balance
ARC eviction cost, relative to page cache and other subsystems.
- Slightly update Linux arc_set_sys_free() math for new kernels.
Signed-off-by: Alexander Motin <[email protected]>
Sponsored by: iXsystems, Inc.
Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/arc_impl.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index defebe3b2..01693d72d 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -1058,10 +1058,10 @@ extern uint_t arc_lotsfree_percent; extern uint64_t zfs_arc_min; extern uint64_t zfs_arc_max; -extern void arc_reduce_target_size(int64_t to_free); +extern uint64_t arc_reduce_target_size(uint64_t to_free); extern boolean_t arc_reclaim_needed(void); extern void arc_kmem_reap_soon(void); -extern void arc_wait_for_eviction(uint64_t, boolean_t); +extern void arc_wait_for_eviction(uint64_t, boolean_t, boolean_t); extern void arc_lowmem_init(void); extern void arc_lowmem_fini(void); |