Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jun 2023 16:22:32 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: 6062d9faf23f - main - vm_phys: Change the return type of vm_phys_unfree_page() to bool
Message-ID:  <202306051622.355GMW7J000109@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=6062d9faf23f11e0655f3a222c204725e3111fe8

commit 6062d9faf23f11e0655f3a222c204725e3111fe8
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-06-05 14:40:15 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-06-05 16:22:11 +0000

    vm_phys: Change the return type of vm_phys_unfree_page() to bool
    
    This is in keeping with the trend of removing uses of boolean_t, and the
    sole caller was implicitly converting it to a "bool".
    
    No functional change intended.
    
    Reviewed by:    dougm, alc, imp, kib
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D40401
---
 sys/vm/vm_page.c |  8 ++++----
 sys/vm/vm_phys.c | 14 +++++++-------
 sys/vm/vm_phys.h |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 4b967a94aa1f..5d822d34ed7c 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -327,7 +327,7 @@ vm_page_blacklist_add(vm_paddr_t pa, bool verbose)
 {
 	struct vm_domain *vmd;
 	vm_page_t m;
-	int ret;
+	bool found;
 
 	m = vm_phys_paddr_to_vm_page(pa);
 	if (m == NULL)
@@ -335,15 +335,15 @@ vm_page_blacklist_add(vm_paddr_t pa, bool verbose)
 
 	vmd = vm_pagequeue_domain(m);
 	vm_domain_free_lock(vmd);
-	ret = vm_phys_unfree_page(m);
+	found = vm_phys_unfree_page(m);
 	vm_domain_free_unlock(vmd);
-	if (ret != 0) {
+	if (found) {
 		vm_domain_freecnt_inc(vmd, -1);
 		TAILQ_INSERT_TAIL(&blacklist_head, m, listq);
 		if (verbose)
 			printf("Skipping page with pa 0x%jx\n", (uintmax_t)pa);
 	}
-	return (ret);
+	return (found);
 }
 
 /*
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 42875d12ba81..8db6529b8c80 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -1291,12 +1291,12 @@ vm_phys_scan_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high,
 
 /*
  * Search for the given physical page "m" in the free lists.  If the search
- * succeeds, remove "m" from the free lists and return TRUE.  Otherwise, return
- * FALSE, indicating that "m" is not in the free lists.
+ * succeeds, remove "m" from the free lists and return true.  Otherwise, return
+ * false, indicating that "m" is not in the free lists.
  *
  * The free page queues must be locked.
  */
-boolean_t
+bool
 vm_phys_unfree_page(vm_page_t m)
 {
 	struct vm_freelist *fl;
@@ -1319,12 +1319,12 @@ vm_phys_unfree_page(vm_page_t m)
 		if (pa >= seg->start)
 			m_set = &seg->first_page[atop(pa - seg->start)];
 		else
-			return (FALSE);
+			return (false);
 	}
 	if (m_set->order < order)
-		return (FALSE);
+		return (false);
 	if (m_set->order == VM_NFREEORDER)
-		return (FALSE);
+		return (false);
 	KASSERT(m_set->order < VM_NFREEORDER,
 	    ("vm_phys_unfree_page: page %p has unexpected order %d",
 	    m_set, m_set->order));
@@ -1350,7 +1350,7 @@ vm_phys_unfree_page(vm_page_t m)
 		vm_freelist_add(fl, m_tmp, order, 0);
 	}
 	KASSERT(m_set == m, ("vm_phys_unfree_page: fatal inconsistency"));
-	return (TRUE);
+	return (true);
 }
 
 /*
diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h
index c1f6514e92e4..a294bbaad80a 100644
--- a/sys/vm/vm_phys.h
+++ b/sys/vm/vm_phys.h
@@ -79,7 +79,7 @@ void vm_phys_register_domains(int ndomains, struct mem_affinity *affinity,
     int *locality);
 vm_page_t vm_phys_scan_contig(int domain, u_long npages, vm_paddr_t low,
     vm_paddr_t high, u_long alignment, vm_paddr_t boundary, int options);
-boolean_t vm_phys_unfree_page(vm_page_t m);
+bool vm_phys_unfree_page(vm_page_t m);
 int vm_phys_mem_affinity(int f, int t);
 void vm_phys_early_add_seg(vm_paddr_t start, vm_paddr_t end);
 vm_paddr_t vm_phys_early_alloc(int domain, size_t alloc_size);



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