From fd509840d4c9e7aabdff73f0c6cae850207f5ebe Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 22 Sep 2017 09:38:04 -0700 Subject: [PATCH] scoutfs: use pages for seg shrink object count The VM wasn't very excited about trying to reclaim our seg count when we returned small count of the number of large segment objects available for reclaim. Each segment represents a ton of memory so we want to give the VM more visibility into the scale of the cache to encourage it to shrink it. We define the object count for the seg shrinker as the number of pages of segments in the lru. Signed-off-by: Zach Brown --- kmod/src/seg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kmod/src/seg.c b/kmod/src/seg.c index e7d9d1d0..f17a8ebd 100644 --- a/kmod/src/seg.c +++ b/kmod/src/seg.c @@ -718,7 +718,7 @@ static int seg_lru_shrink(struct shrinker *shrink, struct shrink_control *sc) LIST_HEAD(list); int ret; - nr = sc->nr_to_scan; + nr = DIV_ROUND_UP(sc->nr_to_scan, SCOUTFS_SEGMENT_PAGES); if (!nr) goto out; @@ -747,7 +747,8 @@ static int seg_lru_shrink(struct shrinker *shrink, struct shrink_control *sc) } out: - ret = min_t(unsigned long, cac->lru_nr, INT_MAX); + ret = min_t(unsigned long, cac->lru_nr * SCOUTFS_SEGMENT_PAGES, + INT_MAX); trace_scoutfs_seg_shrink_exit(sb, sc->nr_to_scan, ret); return ret; }