Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2774359rdg; Mon, 16 Oct 2023 14:44:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfTMXHlIcBDkJ1GZfTHbqVWEBu80cgp/L2N0X6/g6XUEpu4yQWZDbmN3THigtc/DlVPCZk X-Received: by 2002:a17:902:e484:b0:1c9:e378:3a82 with SMTP id i4-20020a170902e48400b001c9e3783a82mr469806ple.2.1697492690613; Mon, 16 Oct 2023 14:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697492690; cv=none; d=google.com; s=arc-20160816; b=e4kN82oe5JV6njkJkg4j4FytyIHMAMGH09stAbe2EerlMW0qrh6+lPi7wLq3Nirq0X kOOlVJCO47smk8JOjerkheNUWcuStycefayS7RS4OfsZC4NezJkp9CmR64OEDzHuUhxv aOrBZV9BiY1GZSYvSnFlEPs2xZ4H55oaVe2Fi1t8x44zJXMoFvpkoFWWfmXErM+EGXfI dWv9T6Zw8Sev4o780iy5vY0Fl9ZDWV9dT/zAvdB9O3uGaJBDktYvL4mYO1mNij6DUQMc tKOzEaXhXDsqdp2mxOsV/Ync/A7lMO/JI4rG71AZX3esUf62AuI6yjVbAcSXt9L96CJN WdVQ== 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=9PwywGNG7ETtw1m4eH13MJDyG4pErsAimlf+4x9s7tE=; fh=izocGAU1nM7M1rf5dMJ16Tj3T6c2XVO62x8skFOEWl8=; b=AoTgCJVbfj9ZXeeksgz9UTJH1zWxyyzbfR238RpxqGW3Nzptv+UR5IgfSgj/vvqc/s vXZgy2aj5z5SAYdQ6pq1z5y+DSJDYIGhphQPHhqKRaFwrO1tD5yXwkmPOnmOJ3dShjVX FdZQJ/iFfKmiSV5LQD1gzJagQRzdvEL5qzJ+2Uo5HLiXXdOrAaXKlu6IkCtewFO3FkkH vlLYQw5SXh4B+vfquauPk3B/4VhDUq3RKJ6C7SARiB1q+82Nipt+hgN0rsRAito8bm3f ylQblHnVm814lrySVJgbGDk1YLzz6uUBF1VViH0StFLZRSi4GtAsGNpuzdnLPcUxm/Qo Rxag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q5-20020a170902a3c500b001bd9e2b4b46si180250plb.601.2023.10.16.14.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 14:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id DDFFB80967AF; Mon, 16 Oct 2023 14:44:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233510AbjJPVoi convert rfc822-to-8bit (ORCPT + 99 others); Mon, 16 Oct 2023 17:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJPVoh (ORCPT ); Mon, 16 Oct 2023 17:44:37 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD390A2; Mon, 16 Oct 2023 14:44:35 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1c8a1541233so30643775ad.1; Mon, 16 Oct 2023 14:44:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697492675; x=1698097475; 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=Kkk29UbbJeUjUEXsSEVlDZ83lbWXtvn6d+sY/zRkICE=; b=seWmexfd9jD8lkjDGAqawgWowiaSP5pMOmMMW9jllI5tX3sUfMizGeYo8z1CaiGgJl 7PYHFXGZf2M8a3vAaCsGPHbvNwuLH2eHPIDalWmq71HHmSrZOf5poVzqBVM98ULeopjQ bXgBdBDyG7777n8lRJC8/fB0RrZcoDdRFcn9SEJgc5zJuEJXvlYuvkQrclIleVjfWIvb C9ATomiogHrbdl/ZIVLSPDMmZ/+LoraszpIP/U5t2qCXoiBvhvenTs0Um8dxdlaiMXKy RskCscEbcSVKsJPfNITJZ86XKKaG3cOZyMINqeP4CB2Gx7Pq6y1llli3txaGNGKMnTXE CE+Q== X-Gm-Message-State: AOJu0YyFsCX6scFJVzO5tcclDK8qpSPhJCV8FVw+oa74hbBqWSsBd+Br 1xaYeS/ykR6LscKCUGKujs6Vxme6cU691awjAtFzgIxG X-Received: by 2002:a17:90a:58:b0:27d:b22b:fb89 with SMTP id 24-20020a17090a005800b0027db22bfb89mr320452pjb.35.1697492675213; Mon, 16 Oct 2023 14:44:35 -0700 (PDT) MIME-Version: 1.0 References: <20231016044225.1125674-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Mon, 16 Oct 2023 14:44:23 -0700 Message-ID: Subject: Re: [PATCH v3] perf bench sched pipe: Add -G/--cgroups option To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 14:44:47 -0700 (PDT) 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. 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, Namhyung