Skip to content

Commit

Permalink
Set arc_c_min properly in userland builds
Browse files Browse the repository at this point in the history
Since it's set to arc_c_max / 2, it must be set after arc_c_max is set.
Also added protection against it falling below 2 * maxblocksize in
userland builds.

Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4268
  • Loading branch information
dweeezil authored and behlendorf committed Jan 25, 2016
1 parent 1b8951b commit 0a1f8cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5403,21 +5403,21 @@ arc_init(void)
arc_need_free = 0;
#endif

/* Set max to 1/2 of all memory */
arc_c_max = allmem / 2;

/*
* In userland, there's only the memory pressure that we artificially
* create (see arc_available_memory()). Don't let arc_c get too
* small, because it can cause transactions to be larger than
* arc_c, causing arc_tempreserve_space() to fail.
*/
#ifndef _KERNEL
arc_c_min = arc_c_max / 2;
arc_c_min = MAX(arc_c_max / 2, 2ULL << SPA_MAXBLOCKSHIFT);
#else
arc_c_min = 2ULL << SPA_MAXBLOCKSHIFT;
#endif

/* Set max to 1/2 of all memory */
arc_c_max = allmem / 2;

arc_c = arc_c_max;
arc_p = (arc_c >> 1);

Expand Down

0 comments on commit 0a1f8cd

Please sign in to comment.