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 <zab@versity.com>
This commit is contained in:
Zach Brown
2017-09-22 09:38:04 -07:00
committed by Mark Fasheh
parent ccefffe74f
commit fd509840d4

View File

@@ -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;
}