From 3ec34e55271d433e3c2dbb861a886361e006ca0a Mon Sep 17 00:00:00 2001 From: Brad Lewis Date: Wed, 15 Mar 2017 16:41:52 -0700 Subject: OpenZFS 9284 - arc_reclaim_thread has 2 jobs Following the fix for 9018 (Replace kmem_cache_reap_now() with kmem_cache_reap_soon), the arc_reclaim_thread() no longer blocks while reaping. However, the code is still confusing and error-prone, because this thread has two responsibilities. We should instead separate this into two threads each with their own responsibility: 1. keep `arc_size` under `arc_c`, by calling `arc_adjust()`, which improves `arc_is_overflowing()` 2. keep enough free memory in the system, by calling `arc_kmem_reap_now()` plus `arc_shrink()`, which improves `arc_available_memory()`. Furthermore, we can use the zthr infrastructure to separate the "should we do something" from "do it" parts of the logic, and normalize the start up / shut down of the threads. Authored by: Brad Lewis Reviewed by: Matt Ahrens Reviewed by: Serapheim Dimitropoulos Reviewed by: Pavel Zakharov Reviewed by: Dan Kimmel Reviewed by: Paul Dagnelie Reviewed by: Dan McDonald Reviewed by: Tim Kordas Reviewed by: Tim Chase Reviewed by: Brian Behlendorf Ported-by: Brad Lewis Signed-off-by: Brad Lewis OpenZFS-issue: https://www.illumos.org/issues/9284 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/de753e34f9 Closes #8165 --- include/sys/zfs_context.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/sys/zfs_context.h') diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 3637cc617..11a32bb31 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -773,6 +773,7 @@ typedef int fstrans_cookie_t; extern fstrans_cookie_t spl_fstrans_mark(void); extern void spl_fstrans_unmark(fstrans_cookie_t); extern int __spl_pf_fstrans_check(void); +extern int kmem_cache_reap_active(void); #define ____cacheline_aligned -- cgit v1.2.3