summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-03-27 12:14:46 -0400
committerGitHub <[email protected]>2020-03-27 09:14:46 -0700
commit9a51738b60c2164822baefa17f8fdcebe9d82fbc (patch)
treea16926d3b550160a937d533e41a6651b6f3ad6c8 /module/zfs
parent3f38797338f2e4b16e8e0065e21f1bca6ef59784 (diff)
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 <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10155
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/arc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index c6b194183..8a0c1a4a7 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -7150,13 +7150,13 @@ arc_init(void)
arc_lowmem_init();
#endif
- /* Set max to 1/2 of all memory */
- arc_c_max = allmem / 2;
-
-#ifdef _KERNEL
- /* Set min cache to 1/32 of all memory, or 32MB, whichever is more */
+ /* Set min cache to 1/32 of all memory, or 32MB, whichever is more. */
arc_c_min = MAX(allmem / 32, 2ULL << SPA_MAXBLOCKSHIFT);
-#else
+
+ /* How to set default max varies by platform. */
+ arc_c_max = arc_default_max(arc_c_min, allmem);
+
+#ifndef _KERNEL
/*
* In userland, there's only the memory pressure that we artificially
* create (see arc_available_memory()). Don't let arc_c get too