From mboxrd@z Thu Jan 1 00:00:00 1970 From: j.nixdorf@avm.de Date: Thu, 26 Nov 2020 15:52:28 +0100 Subject: [LTP] [PATCH] netstress: explicitly set a thread stack size In-Reply-To: References: , Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it Hi Alexey, On Thu, Nov 26, 2020 at 05:05:14PM +0300, Alexey Kodanev wrote: > > + tst_brk(TBROK | TERRNO, "pthread_attr_init failed"); > > + > > + errno = pthread_attr_setstacksize(&attr, 128*1024 + 2*max_msg_len); > > Since max_msg_len is 65535, the result won't be even 4 bytes aligned, > perhaps using just 256 * 1024? The function pthread_attr_setstacksize does not have any alignment requirements specified and only sets the minimum stack size. This means the libc is required to over-allocate and suitably align the stack to match platform requirements. Is this broken on any libraries the LTP project cares about? Note that this is different from pthread_attr_setstack, as there the memory region is provided by the caller and the libc can't change the alignment later on. I'm reluctant to use a static value here as max_msg_len may be modified by command line arguments. Regards, Johannes