Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp689676pxj; Fri, 14 May 2021 13:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcuoCgXLfkKChRyjuwKPmq3WMVdNT8t7grOhlBlnUGMWz+XP31vcW9NdW+c0I+MqOmGehd X-Received: by 2002:a17:907:781a:: with SMTP id la26mr18053776ejc.435.1621023101790; Fri, 14 May 2021 13:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621023101; cv=none; d=google.com; s=arc-20160816; b=rxRQ6f26YQkt+P6vrE1wUgPuIyfyZSKJJAwdgf00Pp9ogSTOtsSvDhc1EhCE2Omvr0 kXqkU2OVUF0zz3SKGmh7ge1CejN0Ls2TuGyZOljy9tHHHR6Gq2u27qb/tGcMex3Ci+uP tIW9l2bHKqNBVh2T2kV2+at6dtagQwDbsrayQBzqfrA8wJpAX76/o0y0GX1FkpdebZsj Xcpa8FsylIQUvy9iU0lTAFq6WvLlJ/s31q0U2PnRX/mg0zJBAyWWvfHV/evVtqZgjneS ilJ6ee2D/PM1Jrh4LoPzpRGfho7SUR+IggSbVfHOwHaTiDPXunqay1l4cZyY5U4IcQUc emmQ== 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=HdZ+Rvb3VddDC+nVIUj42YinsKumWXhl2FsoYoSKcTw=; b=uLyP28rpDxVTkdg2ReowNIcEewAquaOmdyg4adnSW9J65A/V4eVtxodmf70c3EH3uc BtbtG6ha4BEe+aVsHaxqrzkyj8y7wnNwxSrcrgQvxfYKGe19eVONJNZ2ivP4vDoz9HUM 2bArOiAsvjzZ5+SzEfPEPkM3G6GVRBS8177hWTmr1hX07RSfbs455ScpzwgYhZKGuUSD R2SuJB81BqOPVdLNJuLIgzUu33703JZCL6YjrA7Z/s0atPXsGJufAURYRvcFMX/CYS5e PBMOjXCE4vI6nv3cQNxhVqbbevZiW7gqXbZF6N4rPK0fcOpQQYvUBou656rB0bZBsOEO GB6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MlhCqueT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si1407903edc.126.2021.05.14.13.11.18; Fri, 14 May 2021 13:11:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MlhCqueT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235281AbhENR4k (ORCPT + 99 others); Fri, 14 May 2021 13:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232283AbhENR4j (ORCPT ); Fri, 14 May 2021 13:56:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD54C061574; Fri, 14 May 2021 10:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HdZ+Rvb3VddDC+nVIUj42YinsKumWXhl2FsoYoSKcTw=; b=MlhCqueTaVBVJquCeH+yCh0mNn DWQa9KPy6TjpHwTVqGPctwkRkkm7WYcbTKbR3BnJnNQwRZm2C8UaQgPY522CQoRXLO6O+1pTV+mas dKpzpvYnQL+t4hdwCIYtN6cLPasFRXYO+UuH58XydP4dQ8L0yW79ol4kJsBmHQ5348JfDO9SSxpf8 0yeMNi8e254eAojsjvy+g1z52WWvIL3venwPje2pWY0s8kSNGvArS4VnB2jpLOoriOick18LHRkQP UuJzP9Q71riB+cDvdaQvzFEEcm1nOhmlVb9+DqMlCv6ANXJ+6XPSvnsRU9Jl0ohR2Zz9FmYy6R9+O LsYUevOQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lhbyp-00AakW-KA; Fri, 14 May 2021 17:52:22 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id EB3D6300223; Fri, 14 May 2021 19:52:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CE4732BA998D5; Fri, 14 May 2021 19:52:04 +0200 (CEST) Date: Fri, 14 May 2021 19:52:04 +0200 From: Peter Zijlstra To: Suren Baghdasaryan Cc: Tejun Heo , Johannes Weiner , lizefan.x@bytedance.com, Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Benjamin Segall , mgorman@suse.de, Minchan Kim , Jonathan Corbet , bristot@redhat.com, "Paul E . McKenney" , rdunlap@infradead.org, Andrew Morton , Thomas Gleixner , macro@orcam.me.uk, Viresh Kumar , mike.kravetz@oracle.com, linux-doc@vger.kernel.org, LKML , cgroups mailinglist , kernel-team Subject: Re: [PATCH 1/1] cgroup: make per-cgroup pressure stall tracking configurable Message-ID: References: <20210513175349.959661-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 08:54:47AM -0700, Suren Baghdasaryan wrote: > Correct, for this function CONFIG_CGROUPS=n and > cgroup_disable=pressure are treated the same. True, from the code it's > not very obvious. Do you have some refactoring in mind that would make > it more explicit? Does this make sense? --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -744,24 +744,26 @@ static void psi_group_change(struct psi_ static struct psi_group *iterate_groups(struct task_struct *task, void **iter) { + if (cgroup_psi_enabled()) { #ifdef CONFIG_CGROUPS - struct cgroup *cgroup = NULL; + struct cgroup *cgroup = NULL; - if (!*iter) - cgroup = task->cgroups->dfl_cgrp; - else if (*iter == &psi_system) - return NULL; - else - cgroup = cgroup_parent(*iter); + if (!*iter) + cgroup = task->cgroups->dfl_cgrp; + else if (*iter == &psi_system) + return NULL; + else + cgroup = cgroup_parent(*iter); - if (cgroup && cgroup_parent(cgroup)) { - *iter = cgroup; - return cgroup_psi(cgroup); - } -#else - if (*iter) - return NULL; + if (cgroup && cgroup_parent(cgroup)) { + *iter = cgroup; + return cgroup_psi(cgroup); + } #endif + } else { + if (*iter) + return NULL; + } *iter = &psi_system; return &psi_system; }