public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: John David Anglin <dave.anglin@bell.net>
Cc: Sam James <sam@gentoo.org>,
	 John David Anglin <dave@parisc-linux.org>,
	deller@gmx.de,  libc-alpha@sourceware.org
Subject: Re: [committed] hppa: Drop 16-byte pthread lock alignment
Date: Fri, 31 Mar 2023 09:14:29 +0200	[thread overview]
Message-ID: <87lejdqtnu.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <b1646d27-5d45-84d5-4091-567b81f52499@bell.net> (John David Anglin's message of "Thu, 30 Mar 2023 17:08:34 -0400")

* John David Anglin:

> On 2023-03-27 8:42 a.m., Florian Weimer wrote:
>>> Here is comment in map.h:
>>>     // MapAllocator does not support alignments beyond 8. Technically we should
>>>     // support up to std::max_align_t, but this fails with ubsan and tcmalloc
>>>     // debug allocation logic which assume 8 as default alignment.
>>>     static_assert(alignof(value_type) <= 8, "");
>>>
>>> It was the above comment that convinced me that we needed to change
>>> the pthread lock alignment.
>> It seems that current tcmalloc honors GCC's
>> __STDCPP_DEFAULT_NEW_ALIGNMENT__:
>>
>>    <https://github.com/google/tcmalloc/blob/master/tcmalloc/size_classes.cc>
> Agreed.
>
> The current tcmalloc is compiled with c++17.  For earlier versions of c++, we have the
> following issue:
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0035r4.html
>
> There are many packages in Debian and gentoo that are built with
> earlier versions of c++ and I don't see that changing.  This
> includes protobuf. 

Well, GCC nowadays defaults to C++17:

$ echo __cplusplus | gcc -x c++ -E -
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "<stdin>"
201703L

This is GCC 12 from Debian bookworm.

>> On panama.debian.net, it seems correct:
>>
>> $ gcc -x c++ -E - < /dev/null -dM | grep __STDCPP_DEFAULT_NEW_ALIGNMENT__
>> #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16

> That should change to 8 to minimize wasted bytes.  The current
> pthread types do not need 16-byte alignment.

There might be other reasons why 16-byte alignment is needed.  But
perhaps not on HPPA.

  reply	other threads:[~2023-03-31  7:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 21:22 John David Anglin
2023-03-27  0:33 ` Florian Weimer
2023-03-27  0:37   ` Sam James
2023-03-27  1:58     ` John David Anglin
2023-03-27 12:42       ` Florian Weimer
2023-03-30 21:08         ` John David Anglin
2023-03-31  7:14           ` Florian Weimer [this message]
2023-03-27  0:35 ` Sam James
2023-03-27 15:24 ` Pedro Alves
2023-07-06 16:01 ` John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lejdqtnu.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=dave.anglin@bell.net \
    --cc=dave@parisc-linux.org \
    --cc=deller@gmx.de \
    --cc=libc-alpha@sourceware.org \
    --cc=sam@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).