git: 4af932354260 - main - linuxkpi: Fix the shrinker scan target
Mark Johnston
markj at FreeBSD.org
Mon Jan 18 22:08:11 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=4af93235426012049161d82d7c2a5941f7c0a38b
commit 4af93235426012049161d82d7c2a5941f7c0a38b
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-01-18 22:07:55 +0000
Commit: Mark Johnston <markj at 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;
}
}
More information about the dev-commits-src-all
mailing list