arc_default_max on Linux should match FreeBSD

Commits 518b487 and 23bdb07 changed the default ARC size limit on
Linux systems to 1/2 of physical memory, which has become too
strict for modern systems with large amounts of RAM. This patch
changes the default limit to match that of FreeBSD, so ZFS may
have a unified value on both platforms.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Edmund Nadolski <edmund.nadolski@ixsystems.com>
Closes #15437
This commit is contained in:
ednadolski-ix 2023-10-26 10:13:01 -06:00 committed by GitHub
parent 3afdc97d91
commit 6a629f3234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -644,10 +644,7 @@ Max size of ARC in bytes.
If If
.Sy 0 , .Sy 0 ,
then the max size of ARC is determined by the amount of system memory installed. then the max size of ARC is determined by the amount of system memory installed.
Under Linux, half of system memory will be used as the limit. The larger of
Under
.Fx ,
the larger of
.Sy all_system_memory No \- Sy 1 GiB .Sy all_system_memory No \- Sy 1 GiB
and and
.Sy 5/8 No \(mu Sy all_system_memory .Sy 5/8 No \(mu Sy all_system_memory

View File

@ -80,12 +80,18 @@ static struct notifier_block arc_hotplug_callback_mem_nb;
/* /*
* Return a default max arc size based on the amount of physical memory. * Return a default max arc size based on the amount of physical memory.
* This may be overridden by tuning the zfs_arc_max module parameter.
*/ */
uint64_t uint64_t
arc_default_max(uint64_t min, uint64_t allmem) arc_default_max(uint64_t min, uint64_t allmem)
{ {
/* Default to 1/2 of all memory. */ uint64_t size;
return (MAX(allmem / 2, min));
if (allmem >= 1 << 30)
size = allmem - (1 << 30);
else
size = min;
return (MAX(allmem * 5 / 8, size));
} }
#ifdef _KERNEL #ifdef _KERNEL