From patchwork Fri Mar 1 17:47:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 208988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp42125dyc; Fri, 1 Mar 2024 09:49:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWn8Y/lVdIJ7RlSeVheeUBk959/AXfY0rK8SlOKPUdB0EH5Uu/xXJ5cg9jWjXOS1aYQqZT9AIIDvM+18AHCR3gHzltxdA== X-Google-Smtp-Source: AGHT+IGv2ZvHQ7YOJX/SXUBRMrSFYTkBnC2kocqa2GTbByZ08QQSARB/VJDImHq8LGfTku0q8Tdr X-Received: by 2002:a17:906:f217:b0:a43:f170:bbdb with SMTP id gt23-20020a170906f21700b00a43f170bbdbmr1672680ejb.71.1709315370255; Fri, 01 Mar 2024 09:49:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709315370; cv=pass; d=google.com; s=arc-20160816; b=XyGzcEpe2XoOHJdgIhl6cDMykt5m7UaLFWThwfTxFdq61WtIPGMW+E6WvF3K5JpyM/ hLDOYYNQBmCc6Cm/V6Bneb2+p2nk+zqNUc6PkEzhq0hWMHJQpsBSwoXMCX6N3vbMIueB XD+7NSRqwdc2sv9FmyhF18rndpllirVfF863VZKmJQxwusVhX8oUQ07xz+/XKjCiolLX BsvhT6Bezcbhndaa6/MY1/9vhhQzZ6Es7rARA/sFQSa/mF5tijNA4tSVNYD2Flt46FpI t40DK0qw4hnGO0MeC4F5ea0H8RKDbvDM/rtTMQBvpD9CrUGSfvLrQDhvFbEoAjdHIf/i JDhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date:dkim-signature; bh=U18PnMNDf0UkaDQ9M9UQ3swVgmnuLROuEHdrzUL6kPk=; fh=oEM2y8UN86MYFjy7LVAOl9AAHhXjJa1QuS8yIviWEfg=; b=haeS6RFKe0BqArVbopzEWrTijGA7M6QHbu0hoZ23zYUODNEzw76UdUohuyZG8lVhlV bdx2TTB4XfSFjZqSaU8P6jwUb7hFCCTuCfu1V63Q+Pcu2vtz99myB3EFH/FIjVtwyyJF 0LtZJXMHwbtk9kpdXoaQqi7i3O4vG25wu17btIIq7A46zsRjq9jMDNrZ/PVWJ1LQ3Gj+ bQ6LwKi75BLB5IxB3DMcfN1uXCysU9amnA1BMsJ8OINppDUPGji7nVCfDA1JkYj9EO4a OtT9qrSCCMjn38VyOh6Wxg8lF9JUYeqWDhcHyKErxjkv7zT1lf0rK8sPsfUXqSPyUjxW 7srQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=x3FWfZBX; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-88864-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88864-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id sa20-20020a1709076d1400b00a43ee9a524csi1615588ejc.813.2024.03.01.09.49.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:49:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88864-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=x3FWfZBX; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-88864-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88864-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A30931F252A8 for ; Fri, 1 Mar 2024 17:49:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21B213A1BD; Fri, 1 Mar 2024 17:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="x3FWfZBX" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4D4939FEB for ; Fri, 1 Mar 2024 17:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709315280; cv=none; b=guzvElkqeEZO0ylAcym/QgrGzcVZFuU0RZokCxkwPZrFBBiCD9HqxDVrQxPITjcv8XGI70V1IkYJbRTdrqtxCnxMM9XwMGn7RrWIFCBFxIiq689ykU/FhJgCMBlegThngvG1w6OudrcWyclhRDg/xCS2GRR2/1UvfP79JnHk0y4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709315280; c=relaxed/simple; bh=Vq9zT+y6gZ9b4h7EmmS4QVHvVta5/MOikqgIaakqi+g=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=gW6Dljtava/Ciil408xey/ZQaCHrI7Eg5g5kdomtz7rela50P75BBh7Z9sJ8MFkoZBf1Vlcru8JRTaL2nV3Ln9UNUlJLIJWetMIPD1fkbZcvtVrpUE+jEabVrQtASVbSHpfGtrKoIbk5ch/xBc3nxXD9FSv7yBgVOlKAFWdiV6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=x3FWfZBX; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60966f363c1so34185147b3.3 for ; Fri, 01 Mar 2024 09:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709315277; x=1709920077; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=U18PnMNDf0UkaDQ9M9UQ3swVgmnuLROuEHdrzUL6kPk=; b=x3FWfZBX14rOAQf4pGkaNjtg6HtLrybEcRlsLchlBuU3S76W96VkAlKh0EYCo8yxuS +EBm5r5CUFm5cLZdkJh7H5XmrPbsUm14aMYtl2hnh2Yfd3ErEgrxhWszZ9XJEnhdsOpE NSQR4hIGq51Dnz0kw3dctr5Tjfm52eAaPh++M8RtsouBsfTlLH+23+UIfqtRQDEVIaIb G6UIC4o0cpM/icAwlmLG8w2m4/xBjnbpbLATEZEuRBkK6n4LWl5bPElOMHmuHlY2FqFs aYKeJ4IwgxUAzqCCPXLgozBwcyExY2h2HMppapweADC3ZpD9GCNPIwuF7fqq0EEPRqfg D6Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709315277; x=1709920077; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=U18PnMNDf0UkaDQ9M9UQ3swVgmnuLROuEHdrzUL6kPk=; b=oiJQiR1M83Nxi5bUjtYkP4Fm13pCPkCYXgMRY0NklMA5HHgbYGQ1Bf2MUDH/fp13Bj qOa8c11aAqdDb/A1lKQ+KZrvxmPjnYKwCvvnvqz4e3TA0z2zhx5wN5s0kW06PJ0KYpWn OOdIFfIctGlb+3838Nb+9HLvH6eaX8Z9BSLfFJQUsPsDnTvbn79r8T7Ctp0Vj+rLa2dG 2y0+VFsI3tfYyeu4N/8eUsl+/yJzyLytszdDFWzRgypmgogrbd93eRlBQSQGVQNKXqzw vk81nG/fVuV9ZhwiVrowD9sDdC7Uw/6/1uwuyJdqYoouhcr1go5nmn4f2qKSgQUSZ55Q Rrjg== X-Forwarded-Encrypted: i=1; AJvYcCW90NEecrTmkXBqPHJKQT0qC4PYa0tmBX7vcECMUbK1ejJy3ixhBaEBtPa2HhD3ANdLiW/hD9CJwazLFjIrfu0eRgDSMCzmeV4IGmof X-Gm-Message-State: AOJu0YzBkHIHCam2X1YqgvuMVSipgzQEey5IneRroosnh/7YLnlSlCHs HZSDInTaJPuVQ6YWV7RZ2Bw1hEETwy/BlhTx/+yNykIu/MFXuFpYkMXLwJgcsjf49VyCGpJPEzr yw37QHw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:af4b:7fc1:b7be:fcb7]) (user=irogers job=sendgmr) by 2002:a05:690c:fce:b0:608:c5b5:3d37 with SMTP id dg14-20020a05690c0fce00b00608c5b53d37mr565342ywb.2.1709315277703; Fri, 01 Mar 2024 09:47:57 -0800 (PST) Date: Fri, 1 Mar 2024 09:47:11 -0800 Message-Id: <20240301174711.2646944-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v1] perf tests: Run tests in parallel by default From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792347073398353219 X-GMAIL-MSGID: 1792347073398353219 Switch from running tests sequentially to running in parallel by default. Change the opt-in '-p' or '--parallel' flag to '-S' or '--sequential'. On an 8 core tigerlake an address sanitizer run time changes from: 326.54user 622.73system 6:59.91elapsed 226%CPU to: 973.02user 583.98system 3:01.17elapsed 859%CPU So over twice as fast, saving 4 minutes. Signed-off-by: Ian Rogers --- This change is on top of the test fixes in: https://lore.kernel.org/lkml/20240301074639.2260708-1-irogers@google.com/ --- tools/perf/tests/builtin-test.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index ddb2f4e38ea5..73f53b02f733 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -39,8 +39,8 @@ * making them easier to debug. */ static bool dont_fork; -/* Fork the tests in parallel and then wait for their completion. */ -static bool parallel; +/* Don't fork the tests in parallel and wait for their completion. */ +static bool sequential; const char *dso_to_test; const char *test_objdump_path = "objdump"; @@ -374,7 +374,7 @@ static int start_test(struct test_suite *test, int i, int subi, struct child_tes } (*child)->process.no_exec_cmd = run_test_child; err = start_command(&(*child)->process); - if (err || parallel) + if (err || !sequential) return err; return finish_test(*child, width); } @@ -440,7 +440,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) int err = start_test(t, curr, -1, &child_tests[child_test_num++], width); if (err) { - /* TODO: if parallel waitpid the already forked children. */ + /* TODO: if !sequential waitpid the already forked children. */ free(child_tests); return err; } @@ -460,7 +460,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) } } for (i = 0; i < child_test_num; i++) { - if (parallel) { + if (!sequential) { int ret = finish_test(child_tests[i], width); if (ret) @@ -536,8 +536,8 @@ int cmd_test(int argc, const char **argv) "be more verbose (show symbol address, etc)"), OPT_BOOLEAN('F', "dont-fork", &dont_fork, "Do not fork for testcase"), - OPT_BOOLEAN('p', "parallel", ¶llel, - "Run the tests altogether in parallel"), + OPT_BOOLEAN('S', "sequential", &sequential, + "Run the tests one after another rather than in parallel"), OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"), OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"), OPT_STRING(0, "objdump", &test_objdump_path, "path", @@ -564,6 +564,9 @@ int cmd_test(int argc, const char **argv) if (workload) return run_workload(workload, argc, argv); + if (dont_fork) + sequential = true; + symbol_conf.priv_size = sizeof(int); symbol_conf.try_vmlinux_path = true;