From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by sourceware.org (Postfix) with ESMTPS id C32CE3858D20 for ; Tue, 2 Apr 2024 03:14:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C32CE3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C32CE3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712027646; cv=none; b=mogxwfloATfB/kroSsDz6FlTAQwoiP679pfjrykq+H8AlVM2rIVR9DElHBKCUJ9quiEqjSfCAfF+NDoo3nGrKIBj808nK4hxxCU7+T8EZk+UQkhvKDS+VPF/CSyox/ezEOThpTldkHWnGxaMIWiBg5Wuczseevt/x1gNZ6BB8Ow= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712027646; c=relaxed/simple; bh=8iSlNs0+PlCMGaEar2HKpBYL4/1fyiHHESPUkyksrvs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=tSMercvheeiACYgdtp8q6IGYr/L3hQVqa1DdjgHaq3FPJ86V6IwgBYOBDWhk/zw5HxjK8he+m0+962em4MatnK8Rm8mqziVmpRHQtsRs/CBS4JA8QnI4S72ra2qR2pwsR1GZTUR//69v5Wh7HcEvkQhO8gPGeyhgk7VE3HwSyng= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-dc6d8bd618eso4263460276.3 for ; Mon, 01 Apr 2024 20:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712027644; x=1712632444; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7AI7ER1DDB+8s0EXvrSNAyukkH/igZlLm6j0Dwrklrk=; b=DVQ5jBNcqE8NmhbSP5tHxAWE0QemEsA+9JP7qkJ9C1t7HSDh9lY6ARTVyex2ECTFKy +sUhO62C+LDtO4ApLUhr/L5IlCn/92wFX8EaO7f0AjVwtnED4J5arc6lzVjbfrC2karM aRC/RXDTyLAJjTjIatBKgDrKznBfLKFFK3snuq7R8SOoy3AiyNfMo7nGjWW31bkfCFDn yrO5Sz+g84Mv49Mq3cnDkFJiALudE2hTCDPgXum8+lyC2+Pu5enzVLtmN1Eh/q67D90T wDFzmn78uELdbMx9zHr6yo6LOS+1/MtwCXFMAw2sN5awb3WSUG+aCfhEAUSufK3yrbS5 vvlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712027644; x=1712632444; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7AI7ER1DDB+8s0EXvrSNAyukkH/igZlLm6j0Dwrklrk=; b=d0u9jsN70n47q8rX5EzHTax0JnwFf9hyhKVoYTdDXiolwyuRVP5JbwYBwj1o2OlaxI uo+gq+/BsJr8/llttZUMKyNs8T8zBqQror2GiXFaWj7Din3Pex9Abza0nRgYhYhqWuPo vL4kCXbLcOcs7KF/AzhYyWZe1CPOoLR6OeZnShfLS4XYGzNFsaf89RT2TrYqitccNYlc DXD+h343CpTj5eZLv+PPUfSTI9eAo/9vrF3HPFnd66HTvQXEz13AACq+lMxU8wJmkfY2 scO7Nlikaz9ToQ5joyMkgkP5FTOLvTNsYu/BFVDBnyJAm+LiR1eyBviUVkluiY48sTQm ASQA== X-Forwarded-Encrypted: i=1; AJvYcCXvtDFLfbbEmdA56a3XJrNvsIMs2LaFaylclUJHZfKRzE4YLFjH3BBJHmechNg1PiJsPoFZ+BBbN6Jde1JWZ59sgXCgh/mfzaU6 X-Gm-Message-State: AOJu0Yy+1zA6/Yid3TfH+jUBHfBfwRA7ewNxU8Xy0MqYIXc0cDapn8QA heZJB9wvgU7b6DZeCAo2WpGKLDCgAAkK3MQSEWVs72j9qCllVdumx2A7vFOT5vIL2eBdV7ok5dW nERfnPyCvKR5YckjESBiKNwdoGKs= X-Google-Smtp-Source: AGHT+IG88XB1o9docSlwU1hAGHHEBTmrmeHLCxMzNLY5zQTKKU78OqgAUZFzOlmZfEY2lLv1zKp1263yXqLIYEy5wfk= X-Received: by 2002:a05:6902:2c6:b0:dc7:5cb3:256a with SMTP id w6-20020a05690202c600b00dc75cb3256amr9276192ybh.42.1712027644087; Mon, 01 Apr 2024 20:14:04 -0700 (PDT) MIME-Version: 1.0 References: <87plv91b22.fsf@oldenburg3.str.redhat.com> In-Reply-To: From: "H.J. Lu" Date: Mon, 1 Apr 2024 20:13:27 -0700 Message-ID: Subject: Re: [PATCH] stdlib: reorganize stdlib Makefile routines by functionality To: abush wang Cc: Florian Weimer , abushwang via Libc-alpha , adhemerval.zanella@linaro.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3013.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 Mon, Apr 1, 2024 at 7:28=E2=80=AFPM abush wang wr= ote: > > Actually, not just d275970ab > I found after a91bf4e0ff, there is also performance degradation on x86-64= , > even if this commit has nothing to do with lrand48. > This is my test data: > before a91bf4e0ff: > Average time for lrand48: 1940 cycles > > after: > Average time for lrand48: 5626 cycles Please compare alignments of 2 versions of lrand48. > It seems like there is a gradual performance degradation for lrand48. > > > On Tue, Apr 2, 2024 at 10:17=E2=80=AFAM abush wang = wrote: >> >> Yes=EF=BC=8Con x86-64. >> I just compare the disassemble between d275970ab and before commit by ob= jdump. >> And __drand48_iterate will be more long distance after d275970ab, so I r= evert this >> commit and found the performance will recover a little. >> >> Thanks, >> abush >> >> >> On Mon, Apr 1, 2024 at 9:12=E2=80=AFPM Florian Weimer wrote: >>> >>> * abush wang: >>> >>> > This is test: >>> > ``` >>> > uint64_t getnsecs() { >>> > uint32_t lo, hi; >>> > __asm__ __volatile__ ( >>> > "rdtsc" : "=3Da"(lo), "=3Dd"(hi) >>> > ); >>> > return ((uint64_t)hi << 32) | lo; >>> > } >>> > >>> > int main() { >>> > const int num_iterations =3D 1; >>> > uint64_t start, end, total_time =3D 0; >>> > >>> > start =3D getnsecs(); >>> > for (int i =3D 0; i < num_iterations; i++) { >>> > (void) lrand48(); >>> > } >>> > end =3D getnsecs(); >>> > total_time +=3D (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. >>> >>> Thanks, >>> Florian >>> --=20 H.J.