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

David Holmes david.holmes at oracle.com
Thu Mar 23 00:03:09 UTC 2017


Looks good Chris!

Thanks.

David

On 23/03/2017 7:38 AM, Chris Plummer 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