Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return number of pages freed in the __arc_shrunker_func(). #2753

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2608,6 +2608,9 @@ static int
__arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
{
uint64_t pages;
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
uint64_t oldpages;
#endif

/* The arc is considered warm once reclaim has occurred */
if (unlikely(arc_warm == B_FALSE))
Expand All @@ -2632,8 +2635,17 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
* reap whatever we can from the various arc slabs.
*/
if (pages > 0) {
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
oldpages = btop(arc_evictable_memory());
#endif
arc_kmem_reap_now(ARC_RECLAIM_AGGR, ptob(sc->nr_to_scan));
pages = btop(arc_evictable_memory());
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
if (pages > oldpages)
pages = pages - oldpages;
else
pages = 0;
#endif
} else {
arc_kmem_reap_now(ARC_RECLAIM_CONS, ptob(sc->nr_to_scan));
pages = -1;
Expand Down