git: 1784fb44498d - main - vm_page_free_pages_toq(): return the count of freed pages

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 27 Sep 2024 17:34:47 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=1784fb44498da8007fb8cd8ee5060894eb5fe1e6

commit 1784fb44498da8007fb8cd8ee5060894eb5fe1e6
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-09-27 16:20:31 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-09-27 17:34:23 +0000

    vm_page_free_pages_toq(): return the count of freed pages
    
    Reviewed by:    bnovkov
    Sponsored by:   Advanced Micro Devices (AMD)
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D46820
---
 sys/vm/vm_page.c | 5 +++--
 sys/vm/vm_page.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 40108e8a9b0a..6256472e0336 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -4177,14 +4177,14 @@ vm_page_free_toq(vm_page_t m)
  *	from any VM object.  In other words, this is equivalent to
  *	calling vm_page_free_toq() for each page of a list of VM objects.
  */
-void
+int
 vm_page_free_pages_toq(struct spglist *free, bool update_wire_count)
 {
 	vm_page_t m;
 	int count;
 
 	if (SLIST_EMPTY(free))
-		return;
+		return (0);
 
 	count = 0;
 	while ((m = SLIST_FIRST(free)) != NULL) {
@@ -4195,6 +4195,7 @@ vm_page_free_pages_toq(struct spglist *free, bool update_wire_count)
 
 	if (update_wire_count)
 		vm_wire_sub(count);
+	return (count);
 }
 
 /*
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index a69155e50723..c7c1ec3872a8 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -710,7 +710,7 @@ int vm_page_is_valid(vm_page_t, int, int);
 void vm_page_test_dirty(vm_page_t);
 vm_page_bits_t vm_page_bits(int base, int size);
 void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid);
-void vm_page_free_pages_toq(struct spglist *free, bool update_wire_count);
+int vm_page_free_pages_toq(struct spglist *free, bool update_wire_count);
 
 void vm_page_dirty_KBI(vm_page_t m);
 void vm_page_lock_KBI(vm_page_t m, const char *file, int line);