Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1259372rdg; Fri, 13 Oct 2023 15:58:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLn00ALcYFyGGeU3K8Rt3GNaFwLRY3YVKr6wW30B527WbWN0W7Qth8Nf9H3Aj7AjV1YfhQ X-Received: by 2002:a05:6a21:819c:b0:169:535f:2687 with SMTP id pd28-20020a056a21819c00b00169535f2687mr24049515pzb.49.1697237882433; Fri, 13 Oct 2023 15:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697237882; cv=none; d=google.com; s=arc-20160816; b=HxYVgnYI3Tg61PAa+Ny4QvoU/o+QPsTHaU61SfqSMU8eU3VlgVV9dIb9iQLVz6lv0e jXdD+J9DsJJHttpwSCZTrSmnZKsKPaKqEl9Fv10Vq9CyaRV0CUcNWYTlnJGa/JRq6HYZ c+Wo5L7Z4HOBiloN6JFfh2ka2jJ+1YacZ4Bl9wC3WinWwPd/9JeQ69s3ee0E5hmzF/XO xyQBFdo4TEYVzJMV3aak4ZQB0iBC48BUMDkQV6LsSK3lG4G9qC8tBvNumldgLUF5QWfj G/TGEUOoX810Znu3SOZhZzK9K8Lx5Xxhlrj0G+6lLIoN4XPizBEDoXdlFjytyymgULq/ r3NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=EbzUiZFSGSL4mio3sbm1YgNzjuM0z7zc++/Qwc4RtyU=; fh=CeF/sjQ1/PrJQCA4zRbl8D8Nn/XbFr9/r1euVnuk+qw=; b=LS15mnYp8mxsM9NHYAlFGMw8UyvChvBCK9HSficoy9/xqMKDUJPDq9gRz0uTyzzW9i U5f9KtTpDwctCNBVZbcw8XwE10JX3m8whlGA/0W3xjasjyebiIiZFy9AUqrOaAjjNh9K rLc3zPAO+J8tiqi7d4TyT1RZcCXBn41yd7OolAX+molZbtrs0AAszPvwTGejnxFq6jmo Ei4nmZ1J/1tjllGkK9K3h//xpMQtuOvA7zjnYYBJgugGkkEOGMYnYN+Q8cjjTA4W/ZmL ilY7tjgy1g5ohYkVEqblslE/ih7xah0fCsF/wudSQOyCH+uJKhF1rJEXkRv0DacpgWlO Z95w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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. [23.128.96.32]) by mx.google.com with ESMTPS id r20-20020a6560d4000000b0055391572218si5077209pgv.26.2023.10.13.15.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 15:58:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 3CF6382F09A6; Fri, 13 Oct 2023 15:58:00 -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 S232433AbjJMW5m convert rfc822-to-8bit (ORCPT + 99 others); Fri, 13 Oct 2023 18:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbjJMW5l (ORCPT ); Fri, 13 Oct 2023 18:57:41 -0400 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715BFBE; Fri, 13 Oct 2023 15:57:39 -0700 (PDT) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-27d104fa285so2039182a91.2; Fri, 13 Oct 2023 15:57:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697237859; x=1697842659; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4rQJT81/yzbQzjWsAaHq+5H9Y0QP+lwQhpZXPD22nck=; b=pEcGRGcVIjcJY5VD9AAiE56TZLRWvi9RBPtwHE02ktWKDxsjFJSOT8+xKSHn1b6Oc2 ibmfI/Bkt2HMA1Fv41F8RvjbtiH97tyPdK2VX0Hh4aQxWqV6envjP0syMx71b+PXqvCd RWY9jnWQyPl6RNOB2mOthYNPVHjvyBJLa6RfH/FbwX6TIXe3raCoNx2pXqgcX9ayvjrp vZ7mNf05kg3KSEeVpuhmPRVqa3XdByP3mSozKSFILlUoVNfShBaz4pTGytgLBSvsizXl H9ViiakTkMxuCK1PPR99q425J2jtMUMyZDOWsl3CYF4IEPEJ6rUVSqiTh3jWXM8hS8by V2Yg== X-Gm-Message-State: AOJu0Yy3/zqYlkwxb6IrQq3PypzLmI6HOoyEUBnZ6yzgTzfnXtpQdghm exyScHed5m/b8Ym7XMLdcH8DUZhxaKJfEFaX/8Z0z4WLpZw= X-Received: by 2002:a17:90a:1089:b0:274:4161:b9dc with SMTP id c9-20020a17090a108900b002744161b9dcmr27158941pja.31.1697237858654; Fri, 13 Oct 2023 15:57:38 -0700 (PDT) MIME-Version: 1.0 References: <20231004204741.985422-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Fri, 13 Oct 2023 15:57:27 -0700 Message-ID: Subject: Re: [PATCH] perf bench sched pipe: Add -G/--cgroups option To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 15:58:00 -0700 (PDT) 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 Thanks, Namhyung