diff options
author | Brad Lewis <[email protected]> | 2017-03-15 16:41:52 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-12-26 13:22:28 -0800 |
commit | 3ec34e55271d433e3c2dbb861a886361e006ca0a (patch) | |
tree | fab6a16b1b471804360b4162a4a833a9d3be5707 /include/spl | |
parent | 00f198de6b6ac663926bff2666d956a61cea85db (diff) |
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 <[email protected]>
Reviewed by: Matt Ahrens <[email protected]>
Reviewed by: Serapheim Dimitropoulos <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Reviewed by: Dan Kimmel <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Reviewed by: Dan McDonald <[email protected]>
Reviewed by: Tim Kordas <[email protected]>
Reviewed by: Tim Chase <[email protected]>
Reviewed by: Brian Behlendorf <[email protected]>
Ported-by: Brad Lewis <[email protected]>
Signed-off-by: Brad Lewis <[email protected]>
OpenZFS-issue: https://www.illumos.org/issues/9284
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/de753e34f9
Closes #8165
Diffstat (limited to 'include/spl')
-rw-r--r-- | include/spl/sys/kmem.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/spl/sys/kmem.h b/include/spl/sys/kmem.h index d6b428551..72d3a7765 100644 --- a/include/spl/sys/kmem.h +++ b/include/spl/sys/kmem.h @@ -163,6 +163,7 @@ extern unsigned int spl_kmem_alloc_max; #define kmem_alloc(sz, fl) spl_kmem_alloc((sz), (fl), __func__, __LINE__) #define kmem_zalloc(sz, fl) spl_kmem_zalloc((sz), (fl), __func__, __LINE__) #define kmem_free(ptr, sz) spl_kmem_free((ptr), (sz)) +#define kmem_cache_reap_active spl_kmem_cache_reap_active extern void *spl_kmem_alloc(size_t sz, int fl, const char *func, int line); extern void *spl_kmem_zalloc(size_t sz, int fl, const char *func, int line); @@ -181,5 +182,6 @@ extern void spl_kmem_free_track(const void *buf, size_t size); extern int spl_kmem_init(void); extern void spl_kmem_fini(void); +extern int spl_kmem_cache_reap_active(void); #endif /* _SPL_KMEM_H */ |