public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH v2 3/4] elf: Avoid RELATIVE relocs in __tunables_init
Date: Fri, 8 Jan 2021 15:25:32 -0300	[thread overview]
Message-ID: <c1b08ae1-b6cd-8c07-e557-91830b5a9970@linaro.org> (raw)
In-Reply-To: <628fdd96-7942-c32c-c829-da8b26dac375@gotplt.org>



On 08/01/2021 15:22, Siddhesh Poyarekar wrote:
> On 1/8/21 11:29 PM, Adhemerval Zanella via Libc-alpha wrote:
>>> @@ -38,7 +38,7 @@ __tunables_init (char **unused __attribute__ ((unused)))
>>>   /* A tunable.  */
>>>   struct _tunable
>>>   {
>>> -  const char *name;            /* Internal name of the tunable.  */
>>> +  const char name[64];            /* Internal name of the tunable.  */
>>>     tunable_type_t type;            /* Data type of the tunable.  */
>>>     tunable_val_t val;            /* The value.  */
>>>     bool initialized;            /* Flag to indicate that the tunable is
>>> @@ -54,7 +54,7 @@ struct _tunable
>>>                          target module if the value is
>>>                          considered unsafe.  */
>>>     /* Compatibility elements.  */
>>> -  const char *env_alias;        /* The compatibility environment
>>> +  const char env_alias[24];        /* The compatibility environment
>>>                          variable name.  */
>>>   };
>>>   
> <snip>
>> The change is ok, although I think we can at least not make the maximum r
>> equired size being automatically generated at build time:
> 
> I don't have a strong preference either way, but the nice thing about the above hardcoded sizes is that it makes the struct size 128 bytes, which means that the array lines up nicely with each element in a pair of cachelines on 64-bit architectures.
> 
> The code is not performance sensitive, so it's probably just an asthaetic thing :)

The struct is maked as read-only, so I doubt we will need to optimize
for cacheline to avoid false-sharing.  And coupling the size with the
tunable definitions itself is one less required change if tunables are
modified.

  reply	other threads:[~2021-01-08 18:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 16:19 [PATCH v2 0/4] fix ifunc with static pie [BZ #27072] Szabolcs Nagy
2021-01-08 16:19 ` [PATCH v2 1/4] configure: Require PI_STATIC_AND_HIDDEN for static pie Szabolcs Nagy
2021-01-08 16:20 ` [PATCH v2 2/4] Make libc symbols hidden in static PIE Szabolcs Nagy
2021-01-08 16:20 ` [PATCH v2 3/4] elf: Avoid RELATIVE relocs in __tunables_init Szabolcs Nagy
2021-01-08 17:59   ` Adhemerval Zanella
2021-01-08 18:22     ` Siddhesh Poyarekar
2021-01-08 18:25       ` Adhemerval Zanella [this message]
2021-01-11 10:56     ` Szabolcs Nagy
2021-01-11 12:13       ` Adhemerval Zanella
2021-01-08 16:20 ` [PATCH v2 4/4] csu: Move static pie self relocation later [BZ #27072] Szabolcs Nagy
2021-01-08 17:04 ` [PATCH v2 0/4] fix ifunc with static pie " H.J. Lu
2021-01-11 10:50   ` Szabolcs Nagy

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=c1b08ae1-b6cd-8c07-e557-91830b5a9970@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.org \
    --cc=szabolcs.nagy@arm.com \
    /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).