Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 2021 22:08:11 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4af932354260 - main - linuxkpi: Fix the shrinker scan target
Message-ID:  <202101182208.10IM8Bdv039163@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4af93235426012049161d82d7c2a5941f7c0a38b

commit 4af93235426012049161d82d7c2a5941f7c0a38b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-01-18 22:07:55 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-01-18 22:07:55 +0000

    linuxkpi: Fix the shrinker scan target
    
    Use the number of items scanned to control the duration of the shrink
    loop.  Otherwise, if a consumer like TTM is not able to free the number
    of items requested for some reason, the shrinker keeps looping forever.
    
    Reviewed by:    manu
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D28224
---
 sys/compat/linuxkpi/common/src/linux_shrinker.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_shrinker.c b/sys/compat/linuxkpi/common/src/linux_shrinker.c
index adc22cc23510..0423f4e05804 100644
--- a/sys/compat/linuxkpi/common/src/linux_shrinker.c
+++ b/sys/compat/linuxkpi/common/src/linux_shrinker.c
@@ -71,7 +71,7 @@ shrinker_shrink(struct shrinker *s)
 	struct shrink_control sc;
 	unsigned long can_free;
 	unsigned long batch;
-	unsigned long freeed = 0;
+	unsigned long scanned = 0;
 	unsigned long ret;
 
 	can_free = s->count_objects(s, &sc);
@@ -79,12 +79,12 @@ shrinker_shrink(struct shrinker *s)
 		return;
 
 	batch = s->batch ? s->batch : SHRINKER_BATCH;
-	while (freeed <= can_free) {
+	while (scanned <= can_free) {
 		sc.nr_to_scan = batch;
 		ret = s->scan_objects(s, &sc);
 		if (ret == SHRINK_STOP)
 			break;
-		freeed += ret;
+		scanned += batch;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101182208.10IM8Bdv039163>