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 <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3495
This commit is contained in:
Tim Chase
2015-06-14 11:19:40 -05:00
committed by Brian Behlendorf
parent 410921241d
commit 90947b2357
3 changed files with 34 additions and 2 deletions
+11 -2
View File
@@ -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);