Re: git: f5c894479e59 - main - Revert "Avoid division in round_up."
- In reply to: Brooks Davis : "git: f5c894479e59 - main - Revert "Avoid division in round_up.""
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 25 Jul 2024 23:13:45 UTC
On Thu, Jul 25, 2024 at 11:11:27PM +0000, Brooks Davis wrote: > The branch main has been updated by brooks: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f5c894479e5986323a0d5a5a698c7d2177eec20f > > commit f5c894479e5986323a0d5a5a698c7d2177eec20f > Author: Brooks Davis <brooks@FreeBSD.org> > AuthorDate: 2024-07-25 23:10:44 +0000 > Commit: Brooks Davis <brooks@FreeBSD.org> > CommitDate: 2024-07-25 23:11:11 +0000 > > Revert "Avoid division in round_up." > > This reverts commit 2b229739e7ca43b36e53f47147ac05a91333f7b9. > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1343 > --- > lib/libthr/thread/thr_stack.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c > index ab3b73085bb5..f576a2c04104 100644 > --- a/lib/libthr/thread/thr_stack.c > +++ b/lib/libthr/thread/thr_stack.c > @@ -126,7 +126,10 @@ static char *last_stack = NULL; > static inline size_t > round_up(size_t size) > { > - return (roundup2(size, _thr_page_size - 1)); Doug Moore pointed out that this isn't a power of two as required by roundup2. Sorry for not reviewing the revision to use roundup2 correctly. -- Brooks > + if (size % _thr_page_size != 0) > + size = ((size / _thr_page_size) + 1) * > + _thr_page_size; > + return size; > } > > void >