git: b0e45fea61a5 - stable/14 - vm_page_free_pages_toq(): return the count of freed pages

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 05 Oct 2024 07:11:34 UTC
The branch stable/14 has been updated by kib:

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

commit b0e45fea61a53bf7831e9a8de356cfda055e1d44
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-09-27 16:20:31 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-05 07:08:56 +0000

    vm_page_free_pages_toq(): return the count of freed pages
    
    (cherry picked from commit 1784fb44498da8007fb8cd8ee5060894eb5fe1e6)
---
 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 8496a39154de..fe104e1e87af 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -3993,14 +3993,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) {
@@ -4011,6 +4011,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 a1df6f736aee..68f68d62d2be 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -706,7 +706,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);