diff options
author | Sebastian Gottschall <[email protected]> | 2020-09-30 22:22:34 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2020-09-30 13:22:34 -0700 |
commit | 8a171ccd9258c9528af413562b5bd6b994cf9c2e (patch) | |
tree | 9d1c0c93409f18190bcbfa9747e490ccc832eba5 /module/zfs/arc.c | |
parent | c0bd2e0fe206791242d467b6f84789bf08c3a118 (diff) |
do a cyclic seek for unused memory objects in pool
In non regular use cases allocated memory might stay persistent in memory
pool. This small patch checks every minute if there are old objects which
can be released from memory pool.
Right now with regular use, the pool is checked for old objects on each
allocation attempt from this pool. so basically polling by its use. Now
consider what happens if someone writes a lot of files and stops use of
the volume or even unmounts it. So the code will no longer check if
objects can be released from the pool. Already allocated objects will
still stay in pool cache. this is no big issue for common use. But
someone discovered this issue while doing tests. personally i know this
behavior and I'm aware of it. Its no big issue. just a enhancement
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Kjeld Schouten-Lebbing <[email protected]>
Signed-off-by: Sebastian Gottschall <[email protected]>
Closes #10938
Closes #10969
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r-- | module/zfs/arc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 1cce068e6..c54d53908 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -308,6 +308,7 @@ #include <sys/aggsum.h> #include <cityhash.h> #include <sys/vdev_trim.h> +#include <sys/zstd/zstd.h> #ifndef _KERNEL /* set with ZFS_DEBUG=watch, to enable watchpoints on frozen buffers */ @@ -4972,6 +4973,7 @@ static boolean_t arc_reap_cb_check(void *arg, zthr_t *zthr) { int64_t free_memory = arc_available_memory(); + static int reap_cb_check_counter = 0; /* * If a kmem reap is already active, don't schedule more. We must @@ -4996,6 +4998,14 @@ arc_reap_cb_check(void *arg, zthr_t *zthr) arc_no_grow = B_FALSE; } + /* + * Called unconditionally every 60 seconds to reclaim unused + * zstd compression and decompression context. This is done + * here to avoid the need for an independent thread. + */ + if (!((reap_cb_check_counter++) % 60)) + zfs_zstd_cache_reap_now(); + return (B_FALSE); } |