]> granicus.if.org Git - zfs/commit
OpenZFS 9284 - arc_reclaim_thread has 2 jobs
authorBrad Lewis <brad.lewis@delphix.com>
Wed, 15 Mar 2017 23:41:52 +0000 (16:41 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 26 Dec 2018 21:22:28 +0000 (13:22 -0800)
commit3ec34e55271d433e3c2dbb861a886361e006ca0a
treefab6a16b1b471804360b4162a4a833a9d3be5707
parent00f198de6b6ac663926bff2666d956a61cea85db
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 <brad.lewis@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Tim Kordas <tim.kordas@joyent.com>
Reviewed by: Tim Chase <tim@chase2k.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: Brad Lewis <brad.lewis@delphix.com>
Signed-off-by: Brad Lewis <brad.lewis@delphix.com>
OpenZFS-issue: https://www.illumos.org/issues/9284
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/de753e34f9
Closes #8165
include/spl/sys/kmem.h
include/sys/zfs_context.h
include/sys/zthr.h
lib/libzpool/kernel.c
module/spl/spl-kmem-cache.c
module/zfs/arc.c
module/zfs/zthr.c