Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1262052rdg; Fri, 13 Oct 2023 16:03:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJFDUaF7PSQEfHfWjRZ+c2dzpFBkLnXebNvT2M6s+6/zP34Q+UedDnt2xeoAi4pXUD3NPj X-Received: by 2002:a17:903:187:b0:1c3:749f:6a5d with SMTP id z7-20020a170903018700b001c3749f6a5dmr30157397plg.4.1697238236055; Fri, 13 Oct 2023 16:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697238236; cv=none; d=google.com; s=arc-20160816; b=f6usuv49jnlJFhXb/GG1HWJPoYrsbp19awe1J0QZekMN9966GNuhFgLXELbuN8Qc1r zr8W39uSKUvfKFW5N9SzUaqU01SZR8L9vaCq9WFkXOdUKLUAMlOmGEOnyfzWcsSScwBk mRu1IE/aLRa7kIsfXDqR8qUT1bZU8a6MpyGuaIHOOVINuSxQyUKhAcdUcBC+JzZLGP7k aTjeb2+lnQYPbpWvhyL8rr976twfszxcxJC3cUQxlAUMsAA2wXFCtCELU3YmmUwfmJnr tV7Ckt62H2kXw2vzr6gA9puutdPQOO1IMPII5wf4Q6cuVF9m8ypT/fVOcLhPPuv6Dx52 47AA== 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=95BFw08JCHmR92gIDXhYEtwR8npl7mGLfvXre5D46V0=; fh=ATmfKs0sIZhJDElMvHKl6znBn0xqTXk0lYgtDjKC1GM=; b=aMHyDFfddZJPLaQGfiqJgHaoljIQ5Ni7X0YX1Eu2Cyi2c9Czqod6maHZg2D7eva7dw j5iR0UW1XzYEZN++dT9DK9i7Q7QjUVt4WA6Qj3JNrjP/kWF6p935jtKcuLIo9DxsaTGY USH3UTeXCCSQDjHfZCaLmcb1MfTxuj6QzWHsT4Ef1+uzVzyVDhmCJgy6nSDsH5awI6r0 SV2i9qz4p+3R9Yx32Au2Z3DWg0EB8bAlhU1F9KdhLE+7fqCDeydeIR48wqb1oZY8dStH uRFWZe6oKc/hCvJg4jKxDqs36Vzyz59ZucVGIfGdoAG1HayXAnnpV3xi9UQ2IKTut+k7 rdWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZUTjQumT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id k1-20020a170902c40100b001b8b4330585si6089212plk.510.2023.10.13.16.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 16:03:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZUTjQumT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 3A20482FCE85; Fri, 13 Oct 2023 16:03:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232576AbjJMXDl (ORCPT + 99 others); Fri, 13 Oct 2023 19:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232569AbjJMXDk (ORCPT ); Fri, 13 Oct 2023 19:03:40 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1BAC9 for ; Fri, 13 Oct 2023 16:03:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08918C433C8; Fri, 13 Oct 2023 23:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697238217; bh=iqMnf/BMDJwzFbazhNU1KYWGcCmtvvfRHnstjXFUjjI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZUTjQumTZ1JveX+KrzUF3EwwZD/Pxno1XqLO1TzfKno1IuxXHIs3vOK/nIfwOPdL/ xeNNkczh+TtrWXDVYrRIdnn7+9im/UhKjbxO6iuLlPojtaRryOFXJoj3ncg/btA51H lhaub5grrZ5APfH3VqKgGNR8JfXkMfVrdtn2irjS/dpnBUjVLtwerlQSXIHgak5Pv5 aKfZi82HsYKYQfNcZ2efxAUVK+KngZj4/7R0Z0j+zymh8hBKyEPLkcJkQC+pRtV6M0 +Gqolbt6tMZKLKv/MzdjR5NT1zKtUfu4QvQbUKXDYp8KHYD5JgCWH0+nCMHY9uYnNs cHFmtLLXJ9qow== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 32A7D40016; Fri, 13 Oct 2023 20:03:34 -0300 (-03) Date: Fri, 13 Oct 2023 20:03:34 -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] perf bench sched pipe: Add -G/--cgroups option Message-ID: References: <20231004204741.985422-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 16:03:53 -0700 (PDT) Em Fri, Oct 13, 2023 at 03:57:27PM -0700, Namhyung Kim escreveu: > Hi Arnaldo, > > On Fri, Oct 13, 2023 at 3:41 PM Arnaldo Carvalho de Melo > wrote: > > > > Em Wed, Oct 04, 2023 at 01:47:41PM -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. > > > > > > Users need to make sure the cgroups exist and accessible. > > > > > > # perf stat -e context-switches,cgroup-switches \ > > > > taskset -c 0 perf bench sched pipe -l 10000 > /dev/null > > > > > > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000': > > > > > > 20,001 context-switches > > > 2 cgroup-switches > > > > > > 0.053449651 seconds time elapsed > > > > > > 0.011286000 seconds user > > > 0.041869000 seconds sys > > > > > > # perf stat -e context-switches,cgroup-switches \ > > > > 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 > > > > > > 0.052768627 seconds time elapsed > > > > So I tried with: > > > > [root@quaco ~]# perf bench sched pipe -G system.slice,user.slice > > # Running 'sched/pipe' benchmark: > > cannot enter to cgroup: system.slice > > cannot enter to cgroup: user.slice > > # Executed 1000000 pipe operations between two processes > > > > Total time: 6.301 [sec] > > > > 6.301478 usecs/op > > 158692 ops/sec > > [root@quaco ~]# > > > > Should't it bail out when not managing to enter the cgroups? > > Hmm.. right. Will fix. > > > > > Also: > > > > [root@quaco ~]# mkdir /sys/fs/cgroup/AAA > > [root@quaco ~]# mkdir /sys/fs/cgroup/BBB > > [root@quaco ~]# > > [root@quaco ~]# perf bench sched pipe -G AAA,BBB > > # Running 'sched/pipe' benchmark: > > cannot enter to cgroup: AAA > > cannot enter to cgroup: BBB > > # Executed 1000000 pipe operations between two processes > > > > Total time: 6.397 [sec] > > > > 6.397830 usecs/op > > 156302 ops/sec > > [root@quaco ~]# > > > > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/AAA/cgroup.procs > > [root@quaco ~]# ls -la /sys/fs/cgroup/AAA/cgroup.threads > > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/AAA/cgroup.threads > > [root@quaco ~]# ls -la /sys/fs/cgroup/BBB/cgroup.threads > > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/BBB/cgroup.threads > > [root@quaco ~]# ls -la /sys/fs/cgroup/BBB/cgroup.procs > > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/BBB/cgroup.procs > > [root@quaco ~]# > > > > [root@quaco ~]# perf bench sched pipe -G AAA,BBB > > # Running 'sched/pipe' benchmark: > > cannot enter to cgroup: AAA (written=-1, len=6, errno=Operation not supported) > > cannot enter to cgroup: BBB (written=-1, len=6, errno=Operation not supported) > > # Executed 1000000 pipe operations between two processes > > > > Total time: 6.303 [sec] > > > > 6.303221 usecs/op > > 158649 ops/sec > > [root@quaco ~]# > > > > I'm certainly missing something here :-\ > > Try to enable some cgroup controllers first. Like > > # echo +cpu > /sys/fs/cgroup/AAA/cgroup.subtree_control > # echo +cpu > /sys/fs/cgroup/BBB/cgroup.subtree_control [root@quaco cgroup]# echo +cpu > /sys/fs/cgroup/AAA/cgroup.subtree_control [root@quaco cgroup]# echo +cpu > /sys/fs/cgroup/BBB/cgroup.subtree_control [root@quaco cgroup]# perf bench sched pipe -G AAA,BBB # Running 'sched/pipe' benchmark: cannot enter to cgroup: AAA (written=-1, len=6, errno=Operation not supported) cannot enter to cgroup: BBB (written=-1, len=6, errno=Operation not supported) # Executed 1000000 pipe operations between two processes Total time: 6.267 [sec] 6.267680 usecs/op 159548 ops/sec [root@quaco cgroup]# cat /sys/fs/cgroup/AAA/cgroup.subtree_control cpu [root@quaco cgroup]# cat /sys/fs/cgroup/BBB/cgroup.subtree_control cpu [root@quaco cgroup]# uname -a Linux quaco 6.5.6-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct 6 19:02:35 UTC 2023 x86_64 GNU/Linux [root@quaco cgroup]#