From patchwork Thu Jun 1 15:59:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 70463 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 5EC02385661C for ; Thu, 1 Jun 2023 16:00:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EC02385661C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1685635204; bh=G3gQWvrce5G4oL4n3j22bPOWWdHR8mToUHYzoYwkfJs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lcPM279Tgz+rwm/uS5qF/on9z1msD0Vk63pbkNBaF0NbCGrKNU/AiYRFpM41y0eGQ 0zHwHjeTgATgEctWCEeqqHaktUhzBT0sreVzL19JqOEoauITXGlS9f+jGEFaDdCCmM tDtPJYDPVaZSGd5SSvd+RXoUCBp+43V546mi+mzE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 705373856275 for ; Thu, 1 Jun 2023 15:59:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 705373856275 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6af8b25fc72so914474a34.3 for ; Thu, 01 Jun 2023 08:59:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685635178; x=1688227178; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G3gQWvrce5G4oL4n3j22bPOWWdHR8mToUHYzoYwkfJs=; b=ioIQXRz0zv0+eQZi6fHzYN0sUes7A5nCCxmlnibo7nDeop9xQc+M/3mXBqm8HoKIR0 h2a/2fIOme6aznkyE6CeaRHlxuOB1P7mhp5xivsLuvZMvpd5n0nU+Qjjjgiw4sgVeXUC zb+kH84L8hht4HUdmBeeeBmdSkOJXpAPgmS8eVrj4OWMCqie7hXR4uqvvcw0zCPfTALR zsQZU7fqe9uy2Tv92xqJNaie87R09Jzup0sTCQTd9fTp2uMNcs7h98bpxJqap8RKRaL1 hsuXF2teGz1pyyotfVo+fmwTTUWihzjDq0Y+1XGxduWSItTCIDoHcMJkJ3+z1I92Uso0 7R5A== X-Gm-Message-State: AC+VfDy6nABWlrBq3LcF9893JYmesYxQLKoJxyoL3a6VUFw9HkOgIt8D JKttMUv5yN8SYFSUiNhLf+HYsCRtzN2yXmBxG+n86w== X-Google-Smtp-Source: ACHHUZ6ffAM5qYb0xz5VV1XuUlajfxulywYH/ih91XeYgioup0iYbWBJJIoa4nqTMtcK/5635Bniug== X-Received: by 2002:a05:6830:22e3:b0:6a6:4ef2:7c98 with SMTP id t3-20020a05683022e300b006a64ef27c98mr5706017otc.31.1685635178267; Thu, 01 Jun 2023 08:59:38 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:4dd5:aab5:9e8c:dfc8:7cd]) by smtp.gmail.com with ESMTPSA id k3-20020a9d7603000000b006ab305429e7sm1669280otl.0.2023.06.01.08.59.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 08:59:37 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] stdlib: Tune down thread arc4random tests Date: Thu, 1 Jun 2023 12:59:34 -0300 Message-Id: <20230601155934.296647-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" There is no per-thread state on current arc4random implementation, so limit the maximum number of threads. The tests now run on 1s instead of 8s on a aarch64 system with 160 cores. Checked on aarch64-linux-gnu. --- stdlib/tst-arc4random-thread.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stdlib/tst-arc4random-thread.c b/stdlib/tst-arc4random-thread.c index 010828920e..4f8cc27b03 100644 --- a/stdlib/tst-arc4random-thread.c +++ b/stdlib/tst-arc4random-thread.c @@ -25,6 +25,7 @@ #include #include #include +#include /* Number of arc4random_buf calls per thread. */ enum { count_per_thread = 2048 }; @@ -35,6 +36,9 @@ enum { inner_threads = 4 }; /* Number of threads launching other threads. */ static int outer_threads = 1; +/* Maximum number of other threads. */ +enum { max_outer_threads = 4 }; + /* Number of launching rounds performed by the outer threads. */ enum { outer_rounds = 10 }; @@ -337,7 +341,8 @@ do_test (void) { unsigned int ncpus = CPU_COUNT (&cpuset); /* Limit the number to not overload the system. */ - outer_threads = (ncpus / 2) / inner_threads ?: 1; + outer_threads = MIN ((ncpus / 2) / inner_threads ?: 1, + max_outer_threads); } printf ("info: outer_threads=%d inner_threads=%d\n", outer_threads,