Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3114090rdg; Tue, 17 Oct 2023 05:16:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/oeP2yovnv0zYhSAj8/yqQj+Nn/IKbnaMe76V9I14Udm0XSY0fiKTcCPBKSSd76pRuIfW X-Received: by 2002:a17:90a:9cc:b0:27d:348:94a8 with SMTP id 70-20020a17090a09cc00b0027d034894a8mr1859967pjo.6.1697544975990; Tue, 17 Oct 2023 05:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697544975; cv=none; d=google.com; s=arc-20160816; b=hT7Sdh9SCIIbxzKf7ZzBe8P5UYkQa2Ch+ZqS0R92C1Gb/oKbqTdEW/dEHVSwh8FnwT ySzwRdx/511yVKysCeYyy8+34GTRsM50dijh2/SLZTEGZa7pFSr3ecl/CP6Mmk1dhBYb dZLYT016Untp/Ebwtict3sY+lpIuZMYlN2ijaRHERVUODgWUdXqUoP1YBG/cEgZUJ+q2 vMlBi/MZlVxiiVw9mql1IULkPMpHOtTILH0mrXwzGS5pj1/a9Y+6lJZ3PpwzSqHvmJvX kln/PGDke/W2pvUygjYhETnG5VKX/zNfSDgZHDZNNcp36zWmR76uRJLNcQhkVjfbR/lv /czQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mSVgUIVf5D1Uth9E1W2/XCbBLLJ/Rl/7vI6eHF7Haz4=; fh=KuL+coC1VMi9/3QtKKGZnc+sJf5ToJR+In64MMoLqog=; b=VKXIToEGCOuJxDAuiv1HLcMaljfYdrhkyhUY8umJBnHf6XO2LveruFHskc492nDcFu x2Vptf5RqzUTTkg2zrtGk7CMd3FmcNidHZjkCaONTCr9tDA/QmkcFIxnoUW1INmEeIDU BA14kbigx/NPaMoIHlKjoEfr/o/rvMKCC7Zr4ZQ5LzTCaXqGwo2nyn2qJC+TsRG72Ror grstpQ+VxFEerbhS2KyKJ+o82QOFsTmQBPY1kbxm9EsBSQTvqtQswrQ3R6Ht5ponh9uI hdbIeZGDTt8WBOH+jGFYW/lpfBTVUEhzne2lD/VDGQfhY8eUZJ3vd/lWZZa5t/Jyq7vx rhgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lylVMsvc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id z4-20020a17090a6d0400b00278ff770796si8216866pjj.88.2023.10.17.05.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lylVMsvc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 56BE18083495; Tue, 17 Oct 2023 05:16:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343556AbjJQMQF (ORCPT + 99 others); Tue, 17 Oct 2023 08:16:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235134AbjJQMPt (ORCPT ); Tue, 17 Oct 2023 08:15:49 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB838681 for ; Tue, 17 Oct 2023 05:11:17 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B8BC433C7; Tue, 17 Oct 2023 12:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697544552; bh=Nbr+W9iQN07rxrGeF9ml8ztmKyGXJr/6WE1uNPvYYws=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lylVMsvcb6xDmtPi9qyEtGHKKdlAR28RVW/kf/UNFXmpUy81m7tNI4hHgx8AtE3aV kQOCMg6e8N+7d6hKtAM1LY5NuiQ505/TikPzND2NZq1aMk8Xvp5ISZadWXdtOOAq5o NW67qK2xEqDdNj5ITe41i+n1KtSx5JUxYgE+mD7fm2cl2ZgNAgeVLjNZ3Ai5G92lZ+ 8EKACzpRtV35Yxr8Lymnck/iyRlCRy45gfDeQebL2A+8NMtfhwkS4iRWmTy+BlnjMA G9tfAJYXSpu5LxKvspHQRF1b9KAZ65pG1P7K8P/donx/LsZO1RSkF7/S9VO/JV3Du+ a1PQFT9RCUIIA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 0946C40016; Tue, 17 Oct 2023 09:09:10 -0300 (-03) Date: Tue, 17 Oct 2023 09:09:09 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , LKML , linux-perf-users@vger.kernel.org Subject: Re: [PATCH v3] perf bench sched pipe: Add -G/--cgroups option Message-ID: References: <20231016044225.1125674-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 17 Oct 2023 05:16:13 -0700 (PDT) Em Mon, Oct 16, 2023 at 02:44:23PM -0700, Namhyung Kim escreveu: > On Mon, Oct 16, 2023 at 1:35 PM Arnaldo Carvalho de Melo wrote: > > Em Mon, Oct 16, 2023 at 12:55:33PM -0300, Arnaldo Carvalho de Melo escreveu: > > > Em Mon, Oct 16, 2023 at 12:51:52PM -0300, Arnaldo Carvalho de Melo escreveu: > > > > Now back at testing with with cgroups. > > > > > Humm, even without the -G I get: > > > > > [root@five ~]# perf stat -e context-switches,cgroup-switches perf bench sched pipe -l 10000 > > > # Running 'sched/pipe' benchmark: > > > # Executed 10000 pipe operations between two processes > > > > > Total time: 0.082 [sec] > > > > > 8.246400 usecs/op > > > 121265 ops/sec > > > > > Performance counter stats for 'perf bench sched pipe -l 10000': > > > > > 20,002 context-switches > > > 20,002 cgroup-switches > > > > Same number, but then I forgot to add the 'taskset -c 0' part of the > > command line, if I have it: > > > > [root@five ~]# perf stat -e context-switches,cgroup-switches taskset -c 0 perf bench sched pipe -l 10000 > > # Running 'sched/pipe' benchmark: > > # Executed 10000 pipe operations between two processes > > > > Total time: 0.072 [sec] > > > > 7.231500 usecs/op > > 138283 ops/sec > > > > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000': > > > > 20,002 context-switches > > 3 cgroup-switches > > > > 0.082855113 seconds time elapsed > > > > 0.007765000 seconds user > > 0.074020000 seconds sys > > > > > > [root@five ~]# perf stat -e context-switches,cgroup-switches taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB > > # Running 'sched/pipe' benchmark: > > # Executed 10000 pipe operations between two processes > > > > Total time: 0.093 [sec] > > > > 9.341800 usecs/op > > 107045 ops/sec > > > > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB': > > > > 20,004 context-switches > > 20,003 cgroup-switches > > > > 0.103436330 seconds time elapsed > > > > 0.018109000 seconds user > > 0.063058000 seconds sys > > > > > > [root@five ~]# > > > > I.e. it works as in your results, but can you please spell out why that > > 'taskset -c 0' is needed to get these results? > > > > I wasn't expecting the same number of cgroup-switches when not using > > 'taskset -c 0' :-\ > > Without taskset, each task is likely to run on different CPUs > and other tasks (including idle) on that CPU would be in > different cgroup so it'll create cgroup switches everytime > if they run in AAA or BBB. Sure, and the 'perf stat' is counting _just_ that workload and its children (no -a). Can you please add this to the cset commit log message? I.e. describe the test setup thoroughly to help in reviewing and for us to quickly understand what is being tested, the purpose of the test and how the results match our expectations. This will be specially helpful in the future, when we do bisects, try to understand why changes were made, etc. Even in the man page this information would be useful in helping users to understand the purpose of the 'perf bench' -G option. So I think its better to have it there instead of in the cset commit log message. > With taskset, both sender and receiver would run on the > same CPU. So it'd see the impact of cgroup switches > with this option. Thanks! - Arnaldo