From patchwork Fri Dec 20 06:16:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 103491 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF9823858C52 for ; Fri, 20 Dec 2024 06:21:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF9823858C52 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hQUOw2+g X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 476763858CD1 for ; Fri, 20 Dec 2024 06:16:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 476763858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 476763858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734675387; cv=none; b=vA1V6QD+pVt79GAb/BRUrTLwISk9SnQihdiacGSv6nP5ctUaOO+OEngPJc2rF2TUbk8zdlEs1dQ96TtKnIntNwYBRdtjPnROHViD2jXKsJH53LLXE4L1rZ3woGoAsfRlnl4AZ4aF7tjYlFAz3sxKA8mfe/QNdfTEN1ImxmhFHP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734675387; c=relaxed/simple; bh=PI30tTJFhY8+egHK1DdS43KvUPx/wq1DGgvL3le6w18=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=YsdLOzu2NnWMqNWax4ELCJIPYeL4KThG4Dd4GnadPyBsFq5SEWZFo5pZwteFbUR8SB2MU/dc0AS+fX1T6nwk4FdDgVaFh9c8GdTQq0LPdE2EcSdT4o0Dldgsgk2Lje7EO7ItLf06SZEtRH1ez+VTBc+PndSl3ZCylIDzQB1cNHo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 476763858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734675387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yBT/vbgAn/uQaSWJu5QX/0Jf84GahfgmOGGcoFwIXJ8=; b=hQUOw2+go6J5eR3Z48nCDqif+N6JsLDDvvMBkuf9xS0JveNssOH3EIV1LnaTjRbVlhHPpK P79PxiUkiRg+TNAbb/WhkDfkXZIxcPwYo6s7unT4gDEOMv3yZttgZiHTvZkjkrEv9GKkk/ U8Cmu984HsMcr3ydcP1Zl3/nJqXD9Uc= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-275-XMQchbhqNAaAgzzc3tmKxw-1; Fri, 20 Dec 2024 01:16:25 -0500 X-MC-Unique: XMQchbhqNAaAgzzc3tmKxw-1 X-Mimecast-MFC-AGG-ID: XMQchbhqNAaAgzzc3tmKxw Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D312619560A1 for ; Fri, 20 Dec 2024 06:16:24 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.21]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF53119560A2 for ; Fri, 20 Dec 2024 06:16:23 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH v2 2/4] Optimize __libc_tsd_* thread variable access In-Reply-To: Message-ID: References: X-From-Line: f2045561f2996669ee35c4e3d79a18e695d29424 Mon Sep 17 00:00:00 2001 Date: Fri, 20 Dec 2024 07:16:20 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2ckb0-UoMHKLtC7TPdZsAq4blQamG4AOcz4hh0ihFRI_1734675384 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org These variables are not exported, and libc.so TLS is initial-exec anyway. Declare these variables as hidden and use the initial-exec TLS model. --- include/ctype.h | 9 ++++++--- include/rpc/rpc.h | 3 ++- locale/localeinfo.h | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/ctype.h b/include/ctype.h index e993adc86d..0f6e7fc7ea 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -29,9 +29,12 @@ libc_hidden_proto (toupper) # define CTYPE_EXTERN_INLINE extern inline # endif -extern __thread const uint16_t * __libc_tsd_CTYPE_B; -extern __thread const int32_t * __libc_tsd_CTYPE_TOUPPER; -extern __thread const int32_t * __libc_tsd_CTYPE_TOLOWER; +extern __thread const uint16_t * __libc_tsd_CTYPE_B + attribute_hidden attribute_tls_model_ie; +extern __thread const int32_t * __libc_tsd_CTYPE_TOUPPER + attribute_hidden attribute_tls_model_ie; +extern __thread const int32_t * __libc_tsd_CTYPE_TOLOWER + attribute_hidden attribute_tls_model_ie; CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const)) diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h index 936ea3cebb..ba967833ad 100644 --- a/include/rpc/rpc.h +++ b/include/rpc/rpc.h @@ -45,7 +45,8 @@ extern void __rpc_thread_key_cleanup (void) attribute_hidden; extern void __rpc_thread_destroy (void) attribute_hidden; -extern __thread struct rpc_thread_variables *__libc_tsd_RPC_VARS; +extern __thread struct rpc_thread_variables *__libc_tsd_RPC_VARS + attribute_hidden attribute_tls_model_ie; #define RPC_THREAD_VARIABLE(x) (__rpc_thread_variables()->x) diff --git a/locale/localeinfo.h b/locale/localeinfo.h index bc8e92e4dc..c3249d3715 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h @@ -237,7 +237,8 @@ extern struct __locale_struct _nl_global_locale attribute_hidden; /* This fetches the thread-local locale_t pointer, either one set with uselocale or &_nl_global_locale. */ #define _NL_CURRENT_LOCALE __libc_tsd_LOCALE -extern __thread locale_t __libc_tsd_LOCALE; +extern __thread locale_t __libc_tsd_LOCALE + attribute_hidden attribute_tls_model_ie; /* For static linking it is desireable to avoid always linking in the code and data for every category when we can tell at link time that they are