Skip to content

Commit

Permalink
Merge pull request #181 from ixhamza/arc-changes
Browse files Browse the repository at this point in the history
arc_default_max on Linux should match FreeBSD
  • Loading branch information
amotin authored Nov 15, 2023
2 parents f0eca96 + 70b81b0 commit 5a013a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 1 addition & 4 deletions man/man4/zfs.4
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,7 @@ Max size of ARC in bytes.
If
.Sy 0 ,
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.
Under
.Fx ,
the larger of
The larger of
.Sy all_system_memory No \- Sy 1 GiB
and
.Sy 5/8 No \(mu Sy all_system_memory
Expand Down
10 changes: 8 additions & 2 deletions module/os/linux/zfs/arc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* This may be overridden by tuning the zfs_arc_max module parameter.
*/
uint64_t
arc_default_max(uint64_t min, uint64_t allmem)
{
/* Default to 1/2 of all memory. */
return (MAX(allmem / 2, min));
uint64_t size;

if (allmem >= 1 << 30)
size = allmem - (1 << 30);
else
size = min;
return (MAX(allmem * 5 / 8, size));
}

#ifdef _KERNEL
Expand Down

0 comments on commit 5a013a6

Please sign in to comment.