diff options
author | Alexander Motin <[email protected]> | 2021-07-20 10:13:21 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-20 08:13:21 -0600 |
commit | 8172df643b6cdc7fe233b18c8d8e9b29455ae9f1 (patch) | |
tree | 2422fed87acd136b7b63b708f5d06ad0e1b670b9 /include | |
parent | e04210035eba31c40978658b8d2fa7f823a9f7de (diff) |
Minor ARC optimizations
Remove unneeded global, practically constant, state pointer variables
(arc_anon, arc_mru, etc.), replacing them with macros of real state
variables addresses (&ARC_anon, &ARC_mru, etc.).
Change ARC_EVICT_ALL from -1ULL to UINT64_MAX, not requiring special
handling in inner loop of ARC reclamation. Respectively change bytes
argument of arc_evict_state() from int64_t to uint64_t.
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Mark Maybee <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Closes #12348
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/arc.h | 2 | ||||
-rw-r--r-- | include/sys/arc_impl.h | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/sys/arc.h b/include/sys/arc.h index f58fa53b6..ef07a657f 100644 --- a/include/sys/arc.h +++ b/include/sys/arc.h @@ -44,7 +44,7 @@ extern "C" { * Used by arc_flush() to inform arc_evict_state() that it should evict * all available buffers from the arc state being passed in. */ -#define ARC_EVICT_ALL -1ULL +#define ARC_EVICT_ALL UINT64_MAX #define HDR_SET_LSIZE(hdr, x) do { \ ASSERT(IS_P2ALIGNED(x, 1U << SPA_MINBLOCKSHIFT)); \ diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index ddfa28c15..747100a22 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -964,6 +964,13 @@ typedef struct arc_evict_waiter { #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ #define arc_sys_free ARCSTAT(arcstat_sys_free) /* target system free bytes */ +#define arc_anon (&ARC_anon) +#define arc_mru (&ARC_mru) +#define arc_mru_ghost (&ARC_mru_ghost) +#define arc_mfu (&ARC_mfu) +#define arc_mfu_ghost (&ARC_mfu_ghost) +#define arc_l2c_only (&ARC_l2c_only) + extern taskq_t *arc_prune_taskq; extern arc_stats_t arc_stats; extern arc_sums_t arc_sums; @@ -974,8 +981,8 @@ extern int arc_no_grow_shift; extern int arc_shrink_shift; extern kmutex_t arc_prune_mtx; extern list_t arc_prune_list; -extern arc_state_t *arc_mfu; -extern arc_state_t *arc_mru; +extern arc_state_t ARC_mfu; +extern arc_state_t ARC_mru; extern uint_t zfs_arc_pc_percent; extern int arc_lotsfree_percent; extern unsigned long zfs_arc_min; |