aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2020-08-17 20:04:04 -0700
committerGitHub <[email protected]>2020-08-17 20:04:04 -0700
commit85ec5cbae228defb4332da4cf0ebb64d53aea157 (patch)
treef26f4f1e35fb32052c5294bdee661e629d3e1f48 /include/sys
parent994de7e4b748465f175b7cc48995b5c44adf2200 (diff)
Include scatter_chunk_waste in arc_size
The ARC caches data in scatter ABD's, which are collections of pages, which are typically 4K. Therefore, the space used to cache each block is rounded up to a multiple of 4K. The ABD subsystem tracks this wasted memory in the `scatter_chunk_waste` kstat. However, the ARC's `size` is not aware of the memory used by this round-up, it only accounts for the size that it requested from the ABD subsystem. Therefore, the ARC is effectively using more memory than it is aware of, due to the `scatter_chunk_waste`. This impacts observability, e.g. `arcstat` will show that the ARC is using less memory than it effectively is. It also impacts how the ARC responds to memory pressure. As the amount of `scatter_chunk_waste` changes, it appears to the ARC as memory pressure, so it needs to resize `arc_c`. If the sector size (`1<<ashift`) is the same as the page size (or larger), there won't be any waste. If the (compressed) block size is relatively large compared to the page size, the amount of `scatter_chunk_waste` will be small, so the problematic effects are minimal. However, if using 512B sectors (`ashift=9`), and the (compressed) block size is small (e.g. `compression=on` with the default `volblocksize=8k` or a decreased `recordsize`), the amount of `scatter_chunk_waste` can be very large. On a production system, with `arc_size` at a constant 50% of memory, `scatter_chunk_waste` has been been observed to be 10-30% of memory. This commit adds `scatter_chunk_waste` to `arc_size`, and adds a new `waste` field to `arcstat`. As a result, the ARC's memory usage is more observable, and `arc_c` does not need to be adjusted as frequently. Reviewed-by: Pavel Zakharov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #10701
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/arc.h1
-rw-r--r--include/sys/arc_impl.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/include/sys/arc.h b/include/sys/arc.h
index f322d6328..3fdf36e2a 100644
--- a/include/sys/arc.h
+++ b/include/sys/arc.h
@@ -203,6 +203,7 @@ typedef enum arc_space_type {
ARC_SPACE_DBUF,
ARC_SPACE_DNODE,
ARC_SPACE_BONUS,
+ ARC_SPACE_ABD_CHUNK_WASTE,
ARC_SPACE_NUMTYPES
} arc_space_type_t;
diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h
index bb9163ba7..d07791d07 100644
--- a/include/sys/arc_impl.h
+++ b/include/sys/arc_impl.h
@@ -844,6 +844,7 @@ typedef struct arc_stats {
kstat_named_t arcstat_sys_free;
kstat_named_t arcstat_raw_size;
kstat_named_t arcstat_cached_only_in_progress;
+ kstat_named_t arcstat_abd_chunk_waste_size;
} arc_stats_t;
typedef struct arc_evict_waiter {