diff options
author | Brian Behlendorf <[email protected]> | 2015-06-29 10:34:47 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-07-23 09:42:40 -0700 |
commit | 8c8af9d807cfed74c786c076ef4f708b7ccdc51b (patch) | |
tree | 140b969b32671b3878e28e493ab482530061a1e9 /module/zfs/arc.c | |
parent | 728d6ae91e5381cda813672c9e9f66a269f58368 (diff) |
Add hdr_recl() reclaim callback
Originally removed because it wasn't required under Linux. However,
there may still be some utility in signaling the arc reclaim thread
under Linux via reclaim. This should already have happened by other
means but it's not harmless and reduces another point of divergence
with upstream.
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #3533
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r-- | module/zfs/arc.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 2661bc8a7..e37d9d881 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1054,6 +1054,22 @@ buf_dest(void *vbuf, void *unused) arc_space_return(sizeof (arc_buf_t), ARC_SPACE_HDRS); } +/* + * Reclaim callback -- invoked when memory is low. + */ +/* ARGSUSED */ +static void +hdr_recl(void *unused) +{ + dprintf("hdr_recl called\n"); + /* + * umem calls the reclaim func when we destroy the buf cache, + * which is after we do arc_fini(). + */ + if (!arc_dead) + cv_signal(&arc_reclaim_thread_cv); +} + static void buf_init(void) { @@ -1089,9 +1105,9 @@ retry: } hdr_full_cache = kmem_cache_create("arc_buf_hdr_t_full", HDR_FULL_SIZE, - 0, hdr_full_cons, hdr_full_dest, NULL, NULL, NULL, 0); + 0, hdr_full_cons, hdr_full_dest, hdr_recl, NULL, NULL, 0); hdr_l2only_cache = kmem_cache_create("arc_buf_hdr_t_l2only", - HDR_L2ONLY_SIZE, 0, hdr_l2only_cons, hdr_l2only_dest, NULL, + HDR_L2ONLY_SIZE, 0, hdr_l2only_cons, hdr_l2only_dest, hdr_recl, NULL, NULL, 0); buf_cache = kmem_cache_create("arc_buf_t", sizeof (arc_buf_t), 0, buf_cons, buf_dest, NULL, NULL, NULL, 0); |