git: 86c500937c45 - main - Use the existing page size in libthr

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Tue, 03 May 2022 10:05:52 UTC
The branch main has been updated by andrew:

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

commit 86c500937c4514dda2319f193c4ccc043ffde2b3
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-04-07 16:20:04 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-05-03 10:04:06 +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
---
 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];