Date: Wed, 06 Nov 2013 07:49:42 +0100 From: dt71@gmx.com To: Konstantin Belousov <kostikbel@gmail.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>, jasone@freebsd.org Subject: Re: alignment of thread-local storage Message-ID: <5279E686.5090508@gmx.com> In-Reply-To: <20131106023335.GZ59496@kib.kiev.ua> References: <52799E85.4050002@gmx.com> <20131106023335.GZ59496@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Konstantin Belousov wrote, On 11/06/2013 03:33: > On Wed, Nov 06, 2013 at 02:42:29AM +0100, dt71@gmx.com wrote: >> Starting with revision 191847 of Clang/LLVM, a bus error tends to happen in realloc() under special circumstances. >> > As I understand, the rev. of clang referenced is higher than what we have > in src/contrib, right ? Correct. >> - The __jemalloc_thread_allocated_tls variable is updated using a processor instruction that requires alignment (paddq), that is, as of Clang/LLVM r191847. The variable is defined as: >> __thread thread_allocated_t __attribute__((tls_model("initial-exec"))) thread_allocated_tls = {0,0}; >> >> - The variable turns out to be insufficiently aligned, having only 4-byte alignment. > > I do not see anything in the jemalloc sources which indicate that > thread_allocated must be 16-bytes aligned. The natural aligment for the > structure is 8 bytes. Which is still strictly more than the actual alignment (8 vs 4). Clang even attempts to use certain vector-instructions or what, so it supposedly increases its alignment-request appropriately.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5279E686.5090508>