aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_vfsops.c
diff options
context:
space:
mode:
authorTim Chase <[email protected]>2015-06-14 11:19:40 -0500
committerBrian Behlendorf <[email protected]>2015-06-17 10:43:13 -0700
commit90947b2357157a376fdd23dadbcfedad82652525 (patch)
treec8a505d82d31e31772867c95b1b2b018b2b48594 /module/zfs/zfs_vfsops.c
parent410921241d00d9e6e48d6e544ab5fbf2f642a72d (diff)
3.12 compat, NUMA-aware per-superblock shrinker
Kernels >= 3.12 have a NUMA-aware superblock shrinker which is used in ZoL by zfs_sb_prune(). This patch calls the shrinker for each on-line NUMA node in order that memory be freed for each one. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3495
Diffstat (limited to 'module/zfs/zfs_vfsops.c')
-rw-r--r--module/zfs/zfs_vfsops.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index 2b532a333..88f655a8c 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -68,7 +68,6 @@
#include <sys/zpl.h>
#include "zfs_comutil.h"
-
/*ARGSUSED*/
int
zfs_sync(struct super_block *sb, int wait, cred_t *cr)
@@ -1093,7 +1092,17 @@ zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
ZFS_ENTER(zsb);
-#if defined(HAVE_SPLIT_SHRINKER_CALLBACK)
+#if defined(HAVE_SPLIT_SHRINKER_CALLBACK) && \
+ defined(SHRINK_CONTROL_HAS_NID) && \
+ defined(SHRINKER_NUMA_AWARE)
+ if (sb->s_shrink.flags & SHRINKER_NUMA_AWARE) {
+ *objects = 0;
+ for_each_online_node(sc.nid)
+ *objects += (*shrinker->scan_objects)(shrinker, &sc);
+ } else {
+ *objects = (*shrinker->scan_objects)(shrinker, &sc);
+ }
+#elif defined(HAVE_SPLIT_SHRINKER_CALLBACK)
*objects = (*shrinker->scan_objects)(shrinker, &sc);
#elif defined(HAVE_SHRINK)
*objects = (*shrinker->shrink)(shrinker, &sc);