Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrens committed Jul 30, 2020
1 parent 50f52dc commit 742baea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@ The default limit of 10,000 (in practice, 160MB per allocation attempt with
less than 100ms per allocation attempt, even with a small average compressed
block size of ~8KB.
.sp
The parameter can be set to 0 (zero) to disable the limit.
.sp
This parameter only applies on Linux.
.sp
Default value: \fB10,000\fR.
Expand Down
12 changes: 7 additions & 5 deletions module/os/linux/zfs/arc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
* average compressed block size of ~8KB.
*
* See also the comment in arc_shrinker_count().
* Set to 0 to disable limit.
*/
int zfs_arc_shrinker_limit = 10000;

Expand Down Expand Up @@ -186,9 +187,9 @@ arc_shrinker_count(struct shrinker *shrink, struct shrink_control *sc)
}

/*
* This code is reached in the "direct reclaim" case, were the kernel
* (outside ZFS) is trying to allocate a page, and the system is low
* on memory.
* This code is reached in the "direct reclaim" case, where the
* kernel (outside ZFS) is trying to allocate a page, and the system
* is low on memory.
*
* The kernel's shrinker code doesn't understand how many pages the
* ARC's callback actually frees, so it may ask the ARC to shrink a
Expand All @@ -209,8 +210,9 @@ arc_shrinker_count(struct shrinker *shrink, struct shrink_control *sc)
*
* See also the comment above zfs_arc_shrinker_limit.
*/
return (MIN(zfs_arc_shrinker_limit,
btop((int64_t)arc_evictable_memory())));
int64_t limit = zfs_arc_shrinker_limit != 0 ?
zfs_arc_shrinker_limit : INT64_MAX;
return (MIN(limit, btop((int64_t)arc_evictable_memory())));
}

static unsigned long
Expand Down

0 comments on commit 742baea

Please sign in to comment.