Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1272292rdb; Fri, 20 Oct 2023 13:32:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmiAonNYQMAP0cFnq1scZe0BGug+JyAOVdGHw2Ku7hNhBcHM3IN832DXU1uask8fj6d/xd X-Received: by 2002:a05:6a21:1a5:b0:17a:e981:817e with SMTP id le37-20020a056a2101a500b0017ae981817emr4149970pzb.3.1697833939502; Fri, 20 Oct 2023 13:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697833939; cv=none; d=google.com; s=arc-20160816; b=OfurQqt+Qbd3blDdG9uaOrHbc6k9o2c+Nre/s1UFN+xgl8UamQRTeAdxh6PRCO2KpL +Sc5Zo+nkyEGF9RKx+TGPcsEKLylvybyJt/cMGb1Mhug3zm5kjSqkXjm1TiSijUMAlFt 6gQTn0cJkMoOvr5erIl/PNGeCbOmbb8/KSMWYQNuCvQVWxL50/20+mUlokFOfrOFIetW s0K7IZwY/Ie3nTkfD9kFTti4gJKHsmgU21U/q2cBRcHf84tC7FB4WIhdq4W/EaWp/O0K RmzFGsNWrovHMroKPpKZoTIc/gR9ldfBywLNC0qLgLil+M43NVRHQ7YMVS84VaSw9X60 xuNw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v9mXiNCYacJ9i2bNdq5T+bfrL+ra0bU/c4KlGIq2TNA=; fh=ATmfKs0sIZhJDElMvHKl6znBn0xqTXk0lYgtDjKC1GM=; b=I8BQa8szeE+sBrFP9/lhH7DGsmd+ToVGNRKJaCCvsfsgzhY5AQIZCTTcW+UQRlsilz uSh2hBWSddyOPgoHVhohe8xtL3K3iDQD9frttupiYpedyXqQ9Q91l5D/wltddkOMmGyD bWn+st7feonrTp4DXmYrDknQWWfT7n/RWlzuJMtC68B+oz0IIx2hK7Gh0UQQocQHD7AH Zb771o4FIrhCZLRsmHiDYYkEE6rBWcCYbs1w5jbto7BW9R0UQupxt7vQ8ZjxkBAEmncW kUL7a687XjDnP32gGlJWTuwTMXexydjGBvEWmsd8vB8Z6ZWp/woRFqFqP6i5/7XjYXfI ajtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="i5N/3Vsp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x7-20020aa79a47000000b006be322191dasi2448934pfj.140.2023.10.20.13.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 13:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="i5N/3Vsp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 740CB8375EBC; Fri, 20 Oct 2023 13:32:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjJTUcM (ORCPT + 99 others); Fri, 20 Oct 2023 16:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjJTUcL (ORCPT ); Fri, 20 Oct 2023 16:32:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 598DB1A4 for ; Fri, 20 Oct 2023 13:32:10 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C66C0C433C7; Fri, 20 Oct 2023 20:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697833930; bh=4gcbCVldBqv13HwyWncnUbVgIxvEAM6vWbNe5FdwbzI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i5N/3VspUfptQF2Q8sSj4M06jjU6kst2InC8Rood0yAjrYZat/BhK/c5Ot51N41nf ebalsmLk2sWmra8/NhmLZj1c4s+r6ZjI5K5gjAfLQBlEQjo9ATehL7BRE8e4rQrTuZ weKSzJ2LX7eKaNIzx0hFc9IZfEUxBiurCtnHUQxQPveck/Vvy6xZzYYvzaM+tGQWtC 4BcZqz+jHQ0QBzNYRTHEB0/P2IOIt3+h+VpvkikbNgbA17yiYwFpmND+Up3BpsSas5 L4hsIttQCmrAiPIElnHoeNsmpUqvxT1pVdjeACh0ehouw4I/xZi4dmG3SDU3tT00qG t1PIRcgKr4P6A== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 493954035D; Fri, 20 Oct 2023 17:32:07 -0300 (-03) Date: Fri, 20 Oct 2023 17:32:07 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: Re: [PATCH v4] perf bench sched pipe: Add -G/--cgroups option Message-ID: References: <20231017202342.1353124-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231017202342.1353124-1-namhyung@kernel.org> 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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 20 Oct 2023 13:32:17 -0700 (PDT) Em Tue, Oct 17, 2023 at 01:23:42PM -0700, Namhyung Kim escreveu: > The -G/--cgroups option is to put sender and receiver in different > cgroups in order to measure cgroup context switch overheads. > > taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB > /dev/null > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB': > > 20,001 context-switches > 20,001 cgroup-switches Tested-by: Arnaldo Carvalho de Melo [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.063 [sec] 6.367500 usecs/op 157047 ops/sec Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000': 20,004 context-switches 4 cgroup-switches 0.084191842 seconds time elapsed 0.008332000 seconds user 0.067193000 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: no access to cgroup /sys/fs/cgroup/BBB Failed to open cgroup file in BBB Hint: create the cgroup first, like 'mkdir /sys/fs/cgroup/BBB' no access to cgroup /sys/fs/cgroup/AAA Failed to open cgroup file in AAA Hint: create the cgroup first, like 'mkdir /sys/fs/cgroup/AAA' Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB': 2 context-switches 1 cgroup-switches 0.010356533 seconds time elapsed 0.003209000 seconds user 0.007122000 seconds sys [root@five ~]# vim /tmp/bla [root@five ~]# [root@five ~]# mkdir /sys/fs/cgroup/BBB /sys/fs/cgroup/AAA [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.079 [sec] 7.987800 usecs/op 125190 ops/sec Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB': 20,008 context-switches 20,007 cgroup-switches 0.089361029 seconds time elapsed 0.009004000 seconds user 0.065376000 seconds sys [root@five ~]#