Skip to content

Commit

Permalink
On powerpc64 calling a function needs 64 bytes of stack overhead
Browse files Browse the repository at this point in the history
per recursion.  On amd64 it is only 32.  Allocate more stack per
thread and the stack tests pass everywhere
  • Loading branch information
bluhm committed May 22, 2021
1 parent 1223370 commit 3747865
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions regress/sys/kern/fork-exit/fork-exit.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: fork-exit.c,v 1.5 2021/05/21 20:42:21 bluhm Exp $ */
/* $OpenBSD: fork-exit.c,v 1.6 2021/05/22 15:49:36 bluhm Exp $ */

/*
* Copyright (c) 2021 Alexander Bluhm <[email protected]>
Expand Down Expand Up @@ -123,7 +123,7 @@ create_threads(void)
if (stack) {
/* thread start and function call overhead needs a bit more */
error = pthread_attr_setstacksize(&tattr,
(stack + 2) * (4096 + 32));
(stack + 2) * (4096 + 64));
if (error)
errc(1, error, "pthread_attr_setstacksize");
}
Expand Down Expand Up @@ -236,7 +236,7 @@ main(int argc, char *argv[])
break;
case 's':
stack = strtonum(optarg, 0,
(INT_MAX / (4096 + 32)) - 2, &errstr);
(INT_MAX / (4096 + 64)) - 2, &errstr);
if (errstr != NULL)
errx(1, "number of stack allocations is %s: %s",
errstr, optarg);
Expand Down

0 comments on commit 3747865

Please sign in to comment.