git: 152c34e2dd8e - stable/13 - Use the existing page size in libthr

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Tue, 07 Jun 2022 14:23:27 UTC
The branch stable/13 has been updated by andrew:

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

commit 152c34e2dd8e221609928cf736ceb18a892346cf
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-04-07 16:20:04 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-06-07 14:20:18 +0000

    Use the existing page size in libthr
    
    Rather than calling getpagesize() twice use the value saved after the
    first call to size a mmap allocation.
    
    Reviewed by:    kib, markj
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D34983
    
    (cherry picked from commit 86c500937c4514dda2319f193c4ccc043ffde2b3)
---
 lib/libthr/thread/thr_kern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c
index 1e6338657204..0b83b2dd5ac9 100644
--- a/lib/libthr/thread/thr_kern.c
+++ b/lib/libthr/thread/thr_kern.c
@@ -158,7 +158,7 @@ _thr_alloc_wake_addr(void)
 		unsigned i;
 		unsigned pagesize = getpagesize();
 		struct wake_addr *pp = (struct wake_addr *)
-			mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE,
+			mmap(NULL, pagesize, PROT_READ|PROT_WRITE,
 			MAP_ANON|MAP_PRIVATE, -1, 0);
 		for (i = 1; i < pagesize/sizeof(struct wake_addr); ++i)
 			pp[i].link = &pp[i+1];