Message ID | PAWPR08MB89822B28BED09B70092067EB838DA@PAWPR08MB8982.eurprd08.prod.outlook.com |
---|---|
State | New |
Headers | show
Return-Path: <libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=EOz9OEs4; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=EOz9OEs4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sqy7L2CNVz20LX for <incoming@patchwork.ozlabs.org>; Thu, 14 Dec 2023 01:10:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56854385B51C for <incoming@patchwork.ozlabs.org>; Wed, 13 Dec 2023 14:10:36 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2048.outbound.protection.outlook.com [40.107.21.48]) by sourceware.org (Postfix) with ESMTPS id 92225385C40E for <libc-alpha@sourceware.org>; Wed, 13 Dec 2023 14:10:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 92225385C40E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 92225385C40E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.48 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702476628; cv=pass; b=IAAvPllZVZDDJvrbD+AIhp6zVwawHDRYVZr5kK+psA3u1vWbTgYCLyCQw6Of3fbsQnWprjU7qK43IiYI0SBvNq0KADsneeVo/Nf71FC+q23RVGgM3BvjJ39PRtsfrXMbYmpv9l345FhEHscwWHSMAA1W10MVs4xQw9+Gm0njMIU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702476628; c=relaxed/simple; bh=Y01+QWelp9uUaYy3NKtliVGtIODTbmPLCpAEupgKvqE=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=cFmZ0PhWLlMQJIJftQdbT0Fp9YbkHq6yo8sfExb65d22TB2G77/IJ0uVLf0KdDXZZOlYRhe/tbP83uM8dwqTf2Ca3um0eCNNOi8VTE0rbevgALUmLw8IUIlInfCO6+yWG8eQuNn6R2OIUylfo9u5ZtiXEzuOAFWv9/hD/MnkP3g= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=FVNw6ohtyz9HPE8dqKH7i6aNhURB6EUR03OEVlygatBD31Mn6cyGA6wfSWttGtCFzcXjZ0u9koQ+jAvsJ8P0Bg3bkxOAZlGNLtqLeJD9+kDIgjJYnNHSzqzAnmeA2NPK8cckFeh/STa8hDdjYXzUXpRju+s8UnVuUOXWPo0FI8+Dhfab0VNuq+w7kGOQHZiKwCWObUA5gD5TsAM+GCtgFj9SonpSLwIR5wJQTqLcCMs8grpXcXjf+6wrWf5QyKGP7OeYSkyCrlO6csLg6P1GP8L6N/wQHiigrbSD1dkixkTEwDbUOaXjEnER/dBNqyuRYRafzDNYJ82GOE2M/K6Xzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZDne19+aGr0eYmoc1Rj1txwZtiApeY7Bhh9VS8Xf9PM=; b=BTPFT5ZAZG0xszaAJannWsSAytH+wO6KozUSkWRPEa8XurmAFPdZXTDqqsIo5geLahJWHafAz/0vIWSmLmRvSyxhJ+NHRmh6OM2el9bT/Gn2Bo/Ze26NWMmoQZF2xjFagDJ7o6h7nDyvPSy/KPAAkpkD+H4kTcLvb6uc/3DKbV2UQxYvuU64KDgLMy8B98n9jEi2x/23pA0hwvRJMJ/Jj8dF+z1OOnTdJJteW1c0+nweh7po5x/IjvGk7VvVV9Y+j2WEBrF12+4X9Ajo0tzxs10ncxpYZJfxM5AQlt6E004gsZ1/6kxXDZQXrm30G462Na5ITQ09PfBPXevYF4yepw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZDne19+aGr0eYmoc1Rj1txwZtiApeY7Bhh9VS8Xf9PM=; b=EOz9OEs4oTJaL8Wg4e0Mx0uyBT/aF1NoWRejO2KyxyW/UXu7JfvC0BKolOceidaGv8dzhNcXjBLTa7U44Vux0SGp2RDJXQcvRdOXX9kBMJ9ca+3jjpTU+h97Ki0as+yt51zmExSen+rDX+ak/e6wQciiLDWPqLw/aglVkFAKGZI= Received: from AM9P195CA0001.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:21f::6) by DB9PR08MB6393.eurprd08.prod.outlook.com (2603:10a6:10:25a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 14:10:23 +0000 Received: from AM3PEPF00009B9F.eurprd04.prod.outlook.com (2603:10a6:20b:21f::4) by AM9P195CA0001.outlook.office365.com (2603:10a6:20b:21f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 14:10:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM3PEPF00009B9F.mail.protection.outlook.com (10.167.16.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 14:10:23 +0000 Received: ("Tessian outbound 5d213238733f:v228"); Wed, 13 Dec 2023 14:10:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0f99cc7af7023f5c X-CR-MTA-TID: 64aa7808 Received: from 5921cbf537b3.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E741CF89-9F97-4B95-8F67-D4C13DC2C089.1; Wed, 13 Dec 2023 14:10:16 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5921cbf537b3.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Dec 2023 14:10:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUS8bCGL1U9tR6NL5Y71KIhTjAn8qi+0CjlLpn7ML6rouzmYO5VVe8pGg5bcLiGgTFPqJs7quZVlJO0cJK5WLcuEDojH4CKbrDzKjIr0LMaZgoUz3mfSbjOpDbuBg0Z9Pv8zp36K/5y+OrsCrdyeXxyHd5e6NRpgDngNj/roPvvFgwC4TiqsooGtlkQlzH8LzC38HuJucnc1CTtMfC6D19UHKX4p2HPcsD6TG3JuxZfLG7EA1A+mYPnP1HZqQsU05liMyIbf6qPWFTeleBw3O18qog9RE2VH1AGEsGMIVXgOsVGndYv7o0t6faGOWcswLpv2U/Np/RLECcNEuJks/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZDne19+aGr0eYmoc1Rj1txwZtiApeY7Bhh9VS8Xf9PM=; b=f8I1U7NdrBE8adpN6UEeuD4mfG1L8ClTOAbi6YfYzc6chH/jO9EpYxUjxtY8RgDyF2KlZmO/y9pe7RlyrJ/B77TPm/0xLJcV1etPM1DeG0zjtvQff/6Z5GnJV44FaEVUnSvdfLB/9gZUMfY8VzUeT8vjyO7cahMQl53muX2sgdDhF2gbEepa2N84teSoqNjOvcNohCI5vk1UVRBc2lfkDFhQdpHOr4EirTXXXZOn3nnA/JRmDAYTwH0GzN4tbFF6Ne/DHl+xYb/zt08j9fkiQ+7UUl7fLoKUBq0TqkFq+41tHDKnUEfiMsim9H5I0qmjZD4lyXOJ6e+i8Xk7J++55Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZDne19+aGr0eYmoc1Rj1txwZtiApeY7Bhh9VS8Xf9PM=; b=EOz9OEs4oTJaL8Wg4e0Mx0uyBT/aF1NoWRejO2KyxyW/UXu7JfvC0BKolOceidaGv8dzhNcXjBLTa7U44Vux0SGp2RDJXQcvRdOXX9kBMJ9ca+3jjpTU+h97Ki0as+yt51zmExSen+rDX+ak/e6wQciiLDWPqLw/aglVkFAKGZI= Received: from PAWPR08MB8982.eurprd08.prod.outlook.com (2603:10a6:102:33f::20) by VE1PR08MB5792.eurprd08.prod.outlook.com (2603:10a6:800:1a6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 14:10:14 +0000 Received: from PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::2ed5:dc23:2624:df0a]) by PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::2ed5:dc23:2624:df0a%7]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 14:10:14 +0000 From: Wilco Dijkstra <Wilco.Dijkstra@arm.com> To: 'GNU C Library' <libc-alpha@sourceware.org> Subject: [PATCH v3 2/2] Add single-threaded fast path to rand() Thread-Topic: [PATCH v3 2/2] Add single-threaded fast path to rand() Thread-Index: AQHaLc4XbeAP2hVUVUen27IfZxhrXQ== Date: Wed, 13 Dec 2023 14:10:14 +0000 Message-ID: <PAWPR08MB89822B28BED09B70092067EB838DA@PAWPR08MB8982.eurprd08.prod.outlook.com> References: <PAWPR08MB8982EE1FB47C3332FE47EC24838EA@PAWPR08MB8982.eurprd08.prod.outlook.com> <PAWPR08MB89827ACE1C81F74C117F11B2838DA@PAWPR08MB8982.eurprd08.prod.outlook.com> In-Reply-To: <PAWPR08MB89827ACE1C81F74C117F11B2838DA@PAWPR08MB8982.eurprd08.prod.outlook.com> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: PAWPR08MB8982:EE_|VE1PR08MB5792:EE_|AM3PEPF00009B9F:EE_|DB9PR08MB6393:EE_ X-MS-Office365-Filtering-Correlation-Id: 803d3809-7c5c-494a-65ee-08dbfbe53f7f x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 47gCvY8G4kmvixN0nV46JqUhbjfZM3NvBv2dU6zdUJjC0WfIB/jKkdsNQHnFD2JJooBpXT/TMzDDZzKsRuMtaMA+/1FpiMj3RXzzrbthpzAs/PukO3ikqW5g7PuE8zvQVVLugn5B82ih0BrUttg0/OCZKuJoWRbU50aOejlanL4u2ay/bqL17RxLrd1FmhxynnAQxGVsTsxIxQbTPCUNgqgvsCEsikc0Ps6eridW4u1l4knTozkIeyfQUVpsasEi9O12qwGfzNFe/QsJWyOWx8picjoKEH6r2cA4ziTQN4CbFxw2u1UG49RptqV2gZE8zL5J9cIi7aHi/CmPeN2d1dNHoFof4kcfHqetuxXFr+RCaMBUWgLOXVcvKmRpuCFvqwfqLcK28YHzOMs2CpU/DoUJh+/4k28Q6jNy6Bla0ilP80GnvkHrLG0H09lKZ47adfyUA9UAjO98DOTA60S4BW/69XWcmptKItnLGrBnGYqeUtH8ghSTvYWb2WlMNEqiVQef3j0I7SU0gyzA4NjIlhylqk1nvZ2BKSnY59e0jg5zSLXe/SBze6UswChKw+WCVHKn02/t+8kZpMlnbPZUyaTp1GsTXkOk2OCAIGsK22BeZn7EIWT3TO/HiHP0EOD2 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8982.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(366004)(346002)(376002)(396003)(39850400004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(55016003)(38070700009)(26005)(76116006)(66946007)(66446008)(91956017)(66476007)(64756008)(6916009)(66556008)(86362001)(33656002)(122000001)(7696005)(83380400001)(6506007)(2940100002)(9686003)(316002)(4744005)(2906002)(71200400001)(478600001)(5660300002)(8676002)(38100700002)(8936002)(41300700001)(52536014); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5792 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF00009B9F.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 7ab798cc-3eaf-422c-4c02-08dbfbe53a5c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JIcCTePSOOj3WUscz8kc8XnvxJ/GyC2WzyfaVVVJnQMlHvbYAZKIq90nbezuL2Hrf/lumtnFjg+5VlOOp/Nm0fwCjMEBadx8450L5r2tSFSRsElm4tJA1IeRINDqQyBSG0qD8WlsCplZwq1LZq28SlbCTMUBuY6X7rO++o+IgdPj45ZFUFX1yZEmB7Q73FMTTndFtNDUaDNhIYuRq/MGEVl87XBnDsRxtZ/GGJ6mfV2TlbN4bPd3br+nkEtFaTcXWfaHepaYL2XtVVUenVLNVHY/+HsByjQ53UsUaBfvUoihpFXy1CKvnxMdKczDZph3NjI7ne5XWAduV0JcFgSm9hbadjgS5G/8WWm66slOrTDU+DRBlAQs+OD+I0X2am7ADYp6XY6P3oYa7WigJMNdutgc3FEua/wh6cQ87/pIBlHAqwgBN1oldOX4pWSIWVcedJgEu4/eL08YsRSQp/JY0iX6mSSe1cq+geFs/AgPiZxyMPvOfZWUubzzFmiK0nSH3EwVoqgM3OWmTC50LDvKFb17IjljmvunP9PG8shzCizSMDoWai2ubp+eigtsup+n71L3foVBsRKIAM+hB0xT0VrY9t8229QtWkNgCvQKyP2DN9X6PzEParoEHwCGUIMz7NHMl1FJCqFNxQTydBNY6P645rFJV2HcWpt/ZRuvJrzenfRVl6uXtuFx1G1uMaFT1z9PTmtptudoI3lb4iP+Op8s6TZ6hHAKew/R01iYytQ= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(396003)(39860400002)(136003)(346002)(376002)(230922051799003)(1800799012)(64100799003)(82310400011)(186009)(451199024)(36840700001)(46966006)(40470700004)(40480700001)(86362001)(33656002)(40460700003)(55016003)(7696005)(9686003)(70206006)(70586007)(82740400003)(6506007)(41300700001)(336012)(26005)(356005)(81166007)(83380400001)(47076005)(4744005)(2906002)(8676002)(2940100002)(478600001)(36860700001)(8936002)(6916009)(316002)(52536014)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 14:10:23.3984 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 803d3809-7c5c-494a-65ee-08dbfbe53f7f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM3PEPF00009B9F.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6393 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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 <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org |
Series |
[v3,1/2] Add random benchmark
|
expand
|
ping Improve performance of rand() and __random() by adding a single-threaded fast path. Bench-random-lock shows about 5x speedup on Neoverse V1. --- diff --git a/stdlib/random.c b/stdlib/random.c index 62f22fac8d58c7977f09c134bf80a797750da645..174603a8915fd8aa4b3ae64d023003c9e2c038f2 100644 --- a/stdlib/random.c +++ b/stdlib/random.c @@ -51,6 +51,7 @@ SUCH DAMAGE.*/ #include <libc-lock.h> +#include <sys/single_threaded.h> #include <limits.h> #include <stddef.h> #include <stdlib.h> @@ -288,6 +289,12 @@ __random (void) { int32_t retval; + if (SINGLE_THREAD_P) + { + (void) __random_r (&unsafe_state, &retval); + return retval; + } + __libc_lock_lock (lock); (void) __random_r (&unsafe_state, &retval);
diff --git a/stdlib/random.c b/stdlib/random.c index 62f22fac8d58c7977f09c134bf80a797750da645..174603a8915fd8aa4b3ae64d023003c9e2c038f2 100644 --- a/stdlib/random.c +++ b/stdlib/random.c @@ -51,6 +51,7 @@ SUCH DAMAGE.*/ #include <libc-lock.h> +#include <sys/single_threaded.h> #include <limits.h> #include <stddef.h> #include <stdlib.h> @@ -288,6 +289,12 @@ __random (void) { int32_t retval; + if (SINGLE_THREAD_P) + { + (void) __random_r (&unsafe_state, &retval); + return retval; + } + __libc_lock_lock (lock); (void) __random_r (&unsafe_state, &retval);