summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2024-09-30 08:09:40 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2024-09-30 08:09:40 +0000
commit4a41707fc9901be89755810a61786285e4f33f13 (patch)
tree4e7abc136febfdd5e5c1f29124aa2475f3f426a8
parent72e66def00a941e9a531c3c24c5fa8b8716274cc (diff)
Return the number of freed pages and handle SHRINK_STOP in drmbackoff().
ok jsg@
-rw-r--r--sys/dev/pci/drm/drm_linux.c11
-rw-r--r--sys/uvm/uvm_pdaemon.c4
2 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index b914a9eba94..f7a7a106e32 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.116 2024/09/30 03:55:46 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.117 2024/09/30 08:09:39 mpi Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -2942,20 +2942,25 @@ unregister_shrinker(struct shrinker *shrinker)
TAILQ_REMOVE(&shrinkers, shrinker, next);
}
-void
+unsigned long
drmbackoff(long npages)
{
struct shrink_control sc;
struct shrinker *shrinker;
- u_long ret;
+ u_long ret, freed = 0;
shrinker = TAILQ_FIRST(&shrinkers);
while (shrinker && npages > 0) {
sc.nr_to_scan = npages;
ret = shrinker->scan_objects(shrinker, &sc);
+ if (ret == SHRINK_STOP)
+ break;
npages -= ret;
+ freed += ret;
shrinker = TAILQ_NEXT(shrinker, next);
}
+
+ return freed;
}
void *
diff --git a/sys/uvm/uvm_pdaemon.c b/sys/uvm/uvm_pdaemon.c
index 700d4206ed2..be32a5ab635 100644
--- a/sys/uvm/uvm_pdaemon.c
+++ b/sys/uvm/uvm_pdaemon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pdaemon.c,v 1.114 2024/05/01 12:54:27 mpi Exp $ */
+/* $OpenBSD: uvm_pdaemon.c,v 1.115 2024/09/30 08:09:39 mpi Exp $ */
/* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */
/*
@@ -84,7 +84,7 @@
#include "drm.h"
#if NDRM > 0
-extern void drmbackoff(long);
+extern unsigned long drmbackoff(long);
#endif
/*