From 9a51738b60c2164822baefa17f8fdcebe9d82fbc Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 27 Mar 2020 12:14:46 -0400 Subject: Let default arc_c_max be platform dependent Linux changed the default max ARC size to 1/2 of physical memory to deal with shortcomings of the Linux SLUB allocator. Other platforms do not require the same logic. Implement an arc_default_max() function to determine a default max ARC size in platform code. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10155 --- module/os/linux/zfs/arc_os.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'module/os/linux') diff --git a/module/os/linux/zfs/arc_os.c b/module/os/linux/zfs/arc_os.c index 1e0cabd0a..bff0f0517 100644 --- a/module/os/linux/zfs/arc_os.c +++ b/module/os/linux/zfs/arc_os.c @@ -60,6 +60,16 @@ int64_t last_free_memory; free_memory_reason_t last_free_reason; +/* + * Return a default max arc size based on the amount of physical memory. + */ +uint64_t +arc_default_max(uint64_t min, uint64_t allmem) +{ + /* Default to 1/2 of all memory. */ + return (MAX(allmem / 2, min)); +} + #ifdef _KERNEL /* * Return maximum amount of memory that we could possibly use. Reduced -- cgit v1.2.3