(RFR)(S)(10): 8176768: hotspot ignores PTHREAD_STACK_MIN when creating new threads (original) (raw)

Thomas Stüfe thomas.stuefe at gmail.com
Thu Mar 23 05:01:47 UTC 2017


Looks fine!

On Wed, 22 Mar 2017 at 22:38, Chris Plummer <chris.plummer at oracle.com> wrote:

Hello,

Sorry to beat a dead horse here, but in addition to Dan's recommended fixes, I also reworked how I check for overflow when aligning up thanks to a suggestion from David: http://cr.openjdk.java.net/~cjplummer/8176768/webrev.03/webrev.hotspot/ src/os/linux/vm/oslinux.cpp: 726 // behaviour. However, be careful not to end up with a size 727 // of zero due to overflow. Don't add the guard page in that case. 728 sizet guardsize = os::Linux::defaultguardsize(thrtype); 729 if (stacksize <= SIZEMAX - guardsize) {_ _730 stacksize += guardsize;_ _731 }_ _732 assert(issizealigned(stacksize, os::vmpagesize()),_ _"stacksize not aligned");_ _src/os/posix/vm/osposix.cpp:_ _1260 // pthreadattrsetstacksize() may require that the size be_ _rounded up to the OS page size._ _1261 // Be careful not to round up to 0. Align down in that case._ _1262 if (stacksize <= SIZEMAX - vmpagesize()) {_ _1263 stacksize = alignsizeup(stacksize, vmpagesize());_ _1264 } else {_ _1265 stacksize = alignsizedown(stacksize, vmpagesize());_ _1266 }_ _Dan's comments below for reference:_ _> src/os/aix/vm/osaix.cpp > No comments. > > src/os/bsd/vm/osbsd.cpp > No comments. > > src/os/linux/vm/oslinux.cpp > L729: // In that cast just subract the page size to get the > maximum possible stack size. > Typo: 'cast' -> 'case' > Typo: 'subract' -> 'subtract' (Thomas also commented on it) > > src/os/posix/vm/osposix.cpp > L263: // aligning up could have resulted in the size being 0. In > that case just subract the > Nit: 'aligning' -> 'Aligning' (since it's a sentence) > Typo: 'subract' -> 'subtract' > > src/os/solaris/vm/ossolaris.cpp > No comments. > > src/share/vm/prims/jvm.cpp > L2812: // -Avoid truncating on 32-bit platforms if size is > greater than UINTMAX > Nit: needs a period at the end like L2813. > > test/runtime/Thread/TooSmallStackSize.java > No comments. > > test/runtime/Thread/TestThreadStackSizes.java > L26: * @summary Test user threads with various stacks sizes. > Typo?: "stacks sizes" -> "stack sizes" > > L36: super(null, null, "TestThreadStackSizes"+stackSize, > stackSize); > Nit: spaces around the "+". > > L46: TestThreadStackSizes testThreadStackSize = new > TestThreadStackSizes(stackSize); > Nit: extra space before '='. thanks Chris



More information about the hotspot-dev mailing list