Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1430952rdg; Sat, 14 Oct 2023 01:44:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgAGwyyvjA7p8dlgf6ex01xnSqBONYuzLTNik9PjuaKq8RXQTks8L7XB6VooLQLsz0EOJu X-Received: by 2002:a05:6808:156:b0:3ab:8574:e8ab with SMTP id h22-20020a056808015600b003ab8574e8abmr32123914oie.21.1697273064837; Sat, 14 Oct 2023 01:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697273064; cv=none; d=google.com; s=arc-20160816; b=onq0xyW4x+HtODHtnHsmEoopVdmeLmc0TfSMI/Dy4GgLP7ut2N3qec+ldyDRz5iR7N 1Jl7JwbO1Ms6C06HJRjOXu3DIF2dO2mhnz1DZlQLUEk59j/rsegx03ursIXRiniS6Ssa A97sULXlGzimAV8U+me75mWbRLu6XNlObdl2VjxP8yRSBDGmhHlJo5SjvxPVO3SKANCH SrdHrK2SDgccQPDHfZfyRip331wWrFCKxAcEHstaGZqw1Vx0vwD4J9PUS22IncI/3QkG HEBFhlOo0puARKLOthGhsUrfB7hD0cs6NPDNZLMVr/hadwixupvb0xft48g36Uxa7/VI MWCg== 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:sender:dkim-signature; bh=xfAieePA5vpkTsm3Lg9DT3eg6wz3q+Z/kvUk23qNav0=; fh=kWrbggM5dEwR9L3q7jplHUcZYzPbX2sPtVe5Lck/y6M=; b=pKGyzDdX7Pma8GkqOY8eWCsPUq/5NNtnN+fX5SpRN/qsrMz+eL8CtaRbMSrL1WzPuU WRV3t4wx/VthHMuQn4DYbuXxOPDvFJnCEliGgI5MApU+1dag87rvp4mj397Md9lDosj8 vfqds4P3WC5zBJdlrFq+Kg3batZc6/ojQDjfhl6k+D2AOVrJ0LyRRWZtmhiFz+7huXfF /FYVISh/IMfXYYUdvb5JxY77J4FAJ7krEmikRZcPZ3zH/7OsIm8NcEgDvxk92ZyS01OB 7HyHObPnzxQiBIcBQLrljWO4R53BlzY1fjMaCypq8ptq376XyvFlk7XgpFAWE3D71/Pc TzwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U3Hn33vx; 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 v10-20020a63610a000000b005ab2613a571si3356698pgb.495.2023.10.14.01.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 01:44:24 -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=@gmail.com header.s=20230601 header.b=U3Hn33vx; 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 909CC803DAF1; Sat, 14 Oct 2023 01:44:22 -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 S232981AbjJNIoQ (ORCPT + 99 others); Sat, 14 Oct 2023 04:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232750AbjJNIoP (ORCPT ); Sat, 14 Oct 2023 04:44:15 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF5F2BB; Sat, 14 Oct 2023 01:44:13 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-53df747cfe5so5165675a12.2; Sat, 14 Oct 2023 01:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697273052; x=1697877852; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=xfAieePA5vpkTsm3Lg9DT3eg6wz3q+Z/kvUk23qNav0=; b=U3Hn33vxApfL4089fjDVQZAr/zME6ZioR7bTXpE/vVYj3pRhUL5cDGXIi7VVKib9bI uuIgKL94wPUut8PfYp7FR8n9Da7EmAtADg7pBoWCHu/T+uno5bF90/QB/19oQmLgDyJa VagGTLXUlUJSSa3UGaSMGrbJkwn1+Svdcd9Owt+5sEm6aRrtJD68PSjFrmz1Oo0jtxU7 csAycMFk0xmDyW1wrmEzCb1ySa9b7qPOGqdI2ZKgLy3NfX7HqEC5Hey5jrcJph0kVHQe yyLDxh4+AdGWAM9LCZQgSg2iCdzP3pAeVA7aZiep2nD8irUR1oyMVdZ8Me9WZBTX2Z/Q 3GCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697273052; x=1697877852; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xfAieePA5vpkTsm3Lg9DT3eg6wz3q+Z/kvUk23qNav0=; b=Xk/JoljJAHYSfmXPIPOLkjLZWzLV5XGGT5lDuLhAjan/QsI5xT6GQbcbueEEiWpIYi YwtVFcPyJmHFGbXtBLFfm0xIVednb65oBVJ3pzbFFK9DohgQMYnQ0ouFk1E2Y3IE5gjX E7J+IzMWk0fQ5EUh4VeXGF+/nYdyCnWJ4XcZOMPhnT6ms9cs7DyXUnnTxQbopKQe3tUj 7sHqSqyCN38h9/NprPZ41cHHDULQlAsgSjVhPdGHbyP1ubySHGNzoM37J2iVVoLSDdCJ mp0WgTaL6dIHdW0WpRHqXB9BHlCKjUIwhOO1lOITuql2YGkJK2Jpr+kQXm7SYBpHCmSB /zvQ== X-Gm-Message-State: AOJu0YwkD7VVFClPwCm2a4drtmyMuZEGUwEbuVNz3AG4I5NT0FpLaroe ZdDBLu5D0Q8xjhFS98Mjhus= X-Received: by 2002:a17:906:1d:b0:9b2:9a0e:9972 with SMTP id 29-20020a170906001d00b009b29a0e9972mr26994917eja.13.1697273051953; Sat, 14 Oct 2023 01:44:11 -0700 (PDT) Received: from gmail.com (1F2EF7B2.nat.pool.telekom.hu. [31.46.247.178]) by smtp.gmail.com with ESMTPSA id o19-20020a17090637d300b009b65a698c16sm639989ejc.220.2023.10.14.01.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 01:44:11 -0700 (PDT) Sender: Ingo Molnar Date: Sat, 14 Oct 2023 10:44:09 +0200 From: Ingo Molnar To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , LKML , linux-perf-users@vger.kernel.org Subject: Re: [PATCH v2] perf bench sched pipe: Add -G/--cgroups option Message-ID: References: <20231013232435.1012585-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231013232435.1012585-1-namhyung@kernel.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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]); Sat, 14 Oct 2023 01:44:22 -0700 (PDT) * Namhyung Kim wrote: > + cgrp_send = cgroup__new(p, /*do_open=*/true); > + if (cgrp_send == NULL) { > + fprintf(stderr, "cannot open sender cgroup: %s", p); > + goto out; > + } Maybe in this case print out a small suggestion of how to create this particular cgroup? Most distro users and even kernel developers don't ever have to create new cgroups. Maybe even allow the creation of new cgroups for this testing, if they don't already exist? As long as we don't delete any cgroups I don't think much harm can be done - and the increase in usability is substantial. > +static void enter_cgroup(struct cgroup *cgrp) > +{ > + char buf[32]; > + int fd, len; > + pid_t pid; > + > + if (cgrp == NULL) > + return; > + > + if (threaded) > + pid = syscall(__NR_gettid); > + else > + pid = getpid(); > + > + snprintf(buf, sizeof(buf), "%d\n", pid); > + len = strlen(buf); > + > + /* try cgroup v2 interface first */ > + if (threaded) > + fd = openat(cgrp->fd, "cgroup.threads", O_WRONLY); > + else > + fd = openat(cgrp->fd, "cgroup.procs", O_WRONLY); > + > + /* try cgroup v1 if failed */ > + if (fd < 0) > + fd = openat(cgrp->fd, "tasks", O_WRONLY); > + > + if (fd < 0) { > + printf("failed to open cgroup file in %s\n", cgrp->name); > + return; > + } > + > + if (write(fd, buf, len) != len) > + printf("cannot enter to cgroup: %s\n", cgrp->name); The failures here should probably result in termination of the run with an error code, not just messages which are easy to skip in automated tests? Thanks, Ingo