From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 7FB2C3858D20 for ; Mon, 1 Apr 2024 13:46:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FB2C3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7FB2C3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711979182; cv=none; b=aDrfPq8mg1hqWPMgOb7XsjH3D5o0rO+rzWE7wVU1jxwrfncviGtuyw7Qd9NrcL2bxM1hqnYPl5P1JD4qFYRKPVxAbJagyvrJ34V8kCU9OzisdBHPMEYhhOYxR7oryZ9037PmubfJcQ2DVaRnVfaL2oZRV4VSoh7nZvlca6mfRoY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711979182; c=relaxed/simple; bh=GeYyDbM3Lh7PQ0iSQdUGQ2l05ZLuPrzSMKgAyiCSk7g=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=e5/ltJwqUw+u+I58Jl6ah8FGCD1LTZaoZE8rUjNdMHe98hgwZ2bO9bW9FRmi0XCp+PuNF6PZG2tHPnND0FYqluad65aKMlpCoFEIoYdvjq9Oll2BNCcAcCMZ1dIisgUz9kjq5wB0iAkF8Vp/Zivocy5kMNCEL6Gh+eFlc7UafBQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5dbd519bde6so2738459a12.1 for ; Mon, 01 Apr 2024 06:46:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711979172; x=1712583972; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=vLKIgmxMDoF7tjpxWB4szHNB5fpsyqZnSPFumPdWVu4=; b=SHxVyTVbvW3Wq8Fv8ZB84AUysm8I1a9VcQDGGlepDg9+e8oHU5lxKfEYieUHyOOYJU cGxBiF32j+qcTGL85jIWyvmL5uzdLsbrQtVNdRPktMDxifI3VOtgBat38mUidkrz8JY8 WNy0gmEeogkva7M8MAVFhJ2wfwpjpxLARuHM3AlsLk8ZyKIBS2jObSg5D8eXNkk/SMWh z1COz89ACqG8pKYuI9ZKbVUIY+JM2PWQ5cGKaKDTzBN6CsEEVQS3Y2aR3Dbp9RBfazkU P//zPz2WgbcJnW7BtYvkbzyf3HG3hhNB6057W8eT5wDNrEDQK6KvmUIwg9g8xrQrA5Yd QdiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711979172; x=1712583972; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vLKIgmxMDoF7tjpxWB4szHNB5fpsyqZnSPFumPdWVu4=; b=IPa+GQW+6ZvytHGYqtCpBJ2pOjg33QDkXXabOKf5euKVERzuZD4rReukKxfcN6Gtmb 88KoVANeu4139H/EA7N5rCkjUj9E1fyDP54UhbJIJJ1K/sQOyACcr9uov9nGl6Ghotx3 HHoGfDH1sshRPOvBGDrv8loG48c4VpL03qM7M0hr+w+hg8Zoo/scpsVj+z6mDw8/iBwy 7+UoVd21CQ8P/1JpKMiwTC89aZruZtnPF1eMoKVWQ8hP79qRbu/nYmQHZbrBgWmqiPV0 mMQyIvFocGIITCFFvFN0EfA9HARbpFrUBVibIIzigwO/G0dqpAYw0WOHeZI1ylLy9jYR +LyA== X-Forwarded-Encrypted: i=1; AJvYcCVmhMpbeqdPC6OqEUnAIwobEZtzM74g26ZWePC8ools1aFLxYuXPD/6+dlVuu8OXU2J7S8JM4NaqtbdOcy4lj1n01yx/OJXBQqx X-Gm-Message-State: AOJu0YxHpVY8ldKjPrknbMqkham+9cZAKN9JdJyrXjMxT8+lmbBQrHqT WBe28vmGEMmXKOECh3KyUlnlrWEa70F1ezTP2m/h/ePhl5YWVJKJBBPylwWUk5k= X-Google-Smtp-Source: AGHT+IFEbxKr78y46Howd9jV9qMeA1bXLlbfeAOw0jNjPhrIvB2k78XAgYw3rwd/r41cCRN78FIFMw== X-Received: by 2002:a17:902:ea12:b0:1df:ff0a:7130 with SMTP id s18-20020a170902ea1200b001dfff0a7130mr11998289plg.33.1711979172259; Mon, 01 Apr 2024 06:46:12 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c3:b18e:bd64:f0b7:697:92fc? ([2804:1b3:a7c3:b18e:bd64:f0b7:697:92fc]) by smtp.gmail.com with ESMTPSA id d14-20020a170903230e00b001e06c1eed85sm8908145plh.141.2024.04.01.06.46.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Apr 2024 06:46:11 -0700 (PDT) Message-ID: Date: Mon, 1 Apr 2024 10:46:08 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] stdlib: reorganize stdlib Makefile routines by functionality To: "H.J. Lu" , Florian Weimer Cc: abush wang , abushwang via Libc-alpha References: <87plv91b22.fsf@oldenburg3.str.redhat.com> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On 01/04/24 10:17, H.J. Lu wrote: > On Mon, Apr 1, 2024 at 6:13 AM Florian Weimer wrote: >> >> * abush wang: >> >>> This is test: >>> ``` >>> uint64_t getnsecs() { >>> uint32_t lo, hi; >>> __asm__ __volatile__ ( >>> "rdtsc" : "=a"(lo), "=d"(hi) >>> ); >>> return ((uint64_t)hi << 32) | lo; >>> } >>> >>> int main() { >>> const int num_iterations = 1; >>> uint64_t start, end, total_time = 0; >>> >>> start = getnsecs(); >>> for (int i = 0; i < num_iterations; i++) { >>> (void) lrand48(); >>> } >>> end = getnsecs(); >>> total_time += (end - start); >>> >>> printf("Average time for lrand48: %lu cycles\n", total_time / num_iterations); >>> return 0; >>> } >>> ``` >>> before: >>> Average time for lrand48: 21418 cycles >>> >>> after: >>> Average time for lrand48: 9892 cycles >> >> Do you see this on x86-64? So this isn't a displacement range issue? >> >> It could be that this is a random performance change due to code >> alignment, and not actually caused by the direct call distance. >> > > I have a linker patch to control section layout: > > https://patchwork.sourceware.org/project/binutils/list/?series=29973 > > It can > > 1. Reduce gaps between text sections. > 2. Put hot text sections close to each other. > > If it can solve this issue, we should add this feature to ld. > Another possibility, if this is related to a displacement range due some ISA limitation; would to move the lrand entrypoint to the same TU (at least the one that are simple wrapper that ended up being tail calls).