Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp695670pxj; Fri, 14 May 2021 13:21:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXZnpFIEPUmSYp7w/aWZAcFmajQbT3SEO9lVNPm3AsoHnTCjP/CWIYlWwBYUCJyeeQUVkk X-Received: by 2002:a92:d7c3:: with SMTP id g3mr38897539ilq.114.1621023695314; Fri, 14 May 2021 13:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621023695; cv=none; d=google.com; s=arc-20160816; b=x4MBA9b0dCUIk3flI7quilVJrig8xPQXdymVW6etpTp5pFCCuJ/RKGBxVRIyjcOSc2 uVy2QQ665GdlbRisRTVs6kp7boh795PtVErkpW76jact6FtN87R1IeecybQEjRb1zByD Bol5DCa9P60O8OlZmzZWbRWZ5GDr54vytQSGBSSxx3QfwFwRjArjh50PzX/5q9dGnYJN BesbuaJmAq58KXy/p2ar5nkKafB1HLE3iQcdtKmzMff4cY78dCtbPW9sPG+AZARCOD14 Xr+jZGjsBB1D497FCMSZrlYL0Zbq6BGAJjHKVpcTOuOK6jp845w62npsJw+R55sHFgVP WSbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+muSPPrBFQS9BSc0XLvqjbGXmXt1qzS3v/wikaP3SFA=; b=d3ywmxh4hWu10ZQgFWyQovmRk2kZE9wPwGiilchOcLjsvlK7zCUnHu8nh506m+OwNQ jJ90uyfaTFc3CV8XDWXrHcDgVcbOv+iQdi7ZNdUaBXVU3FDifynyJ+fq0nzygmue/EV+ KxGK696HRUaWkgEhyA7GY9KuDiKiHHxsQLYE/v8Yq4Lqj1uFFz93IW39hoVoXvl9TE/U DKgVcHCPKo3geiN25rk+Orhe882OfLoCecAuYaWv366TQA+CdXXkiMC6vVvHGUse8Wlw GaZk7ioGvwwywJ0LBzL77Uzu3JEawJO4FKQJnPj9+bUbrVaCzCuKTOGv2AA0CqbbWKkr f4VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cwimqVsx; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x1si8387142ilp.54.2021.05.14.13.21.22; Fri, 14 May 2021 13:21:35 -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=@google.com header.s=20161025 header.b=cwimqVsx; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbhENSva (ORCPT + 99 others); Fri, 14 May 2021 14:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbhENSva (ORCPT ); Fri, 14 May 2021 14:51:30 -0400 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 555ADC061574 for ; Fri, 14 May 2021 11:50:18 -0700 (PDT) Received: by mail-yb1-xb31.google.com with SMTP id i4so336904ybe.2 for ; Fri, 14 May 2021 11:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+muSPPrBFQS9BSc0XLvqjbGXmXt1qzS3v/wikaP3SFA=; b=cwimqVsxRhMfLl3BUVdKOfBuVUWCAaEwy2N+oSpdJihUEyOv8KKE9wmrwBugETu4Cj kAd6i6KkaTWyq3+xAesgB78ZLsomdzHKjUXLyq8QjJWV699jE//SYZ5t+qj9oGmbQb+l /n4+uqQtvp119b5o+bzYd/ZXfdyUDJG+tfJgKObJvZlSWmIdFo+ClW8Zq1X1gXgYIiZO pvabe/l9/8HvLZVMbg6T53jeQfdupvP/ZLB10YmnZHUQm3ezR7yNEk1WsBfSTKa668k0 36W1W3jvk4s0ju35RM4z7N7RkN8ipSFlYIkFzc6G1ssd60DJm0j9WY1TXAmzJgNqcTeE 7m0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+muSPPrBFQS9BSc0XLvqjbGXmXt1qzS3v/wikaP3SFA=; b=ngDkO4ZApCdfKTCVnhTSjWLebJhKXjoSS5ALz/mWDBT52iOBtbCeCUkDY+RXCuec6Z ++E781LMutjAxhhXdFyS9vVpBSNpjUvH9VAX+5691JxWQ0KdCfRtBI+cKL0sk5Hbt3cI 64WnhVVayz8U7QMwohjCb6vWPjV1dLHjRMDY2K0zVJhHL0QPCsWsQ6h0XjZnRiOiYcFD /ffv5YDD3wNbzd7Ta3VmYi8mPrbJE5/p7NhBPMTsMx3eVhJuYC8KK+hZmj0TQWqws7Dl 7Pdl8lGo4CF96uA3J9qP4AZl6mBGNkkP5YLEIPQeOAcepQbmVgoiIuk7aV8HlZ3UttF1 PKiA== X-Gm-Message-State: AOAM530wWjx39HqKh9mz785tOPhMXPXSWyAWmSqmD9NXTXZmsrW7cb9f kzdzvnKSo1dqh4rVso4wfJyZmft5antAM86WYJnz4A== X-Received: by 2002:a25:bd7:: with SMTP id 206mr4989095ybl.23.1621018217331; Fri, 14 May 2021 11:50:17 -0700 (PDT) MIME-Version: 1.0 References: <20210513175349.959661-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Fri, 14 May 2021 11:50:06 -0700 Message-ID: Subject: Re: [PATCH 1/1] cgroup: make per-cgroup pressure stall tracking configurable To: Peter Zijlstra 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 11:20 AM Suren Baghdasaryan wrote: > > On Fri, May 14, 2021 at 10:52 AM Peter Zijlstra wrote: > > > > 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; > > } > > Hmm. Looks like the case when cgroup_psi_enabled()==true and > CONFIG_CGROUPS=n would miss the "if (*iter) return NULL;" condition. > Effectively with CONFIG_CGROUPS=n this becomes: > > if (cgroup_psi_enabled()) { <== assume this is true > #ifdef CONFIG_CGROUPS <== compiled out > #endif > } else { > if (*iter) <== this > statement will never execute > return NULL; > } > *iter = &psi_system; > return &psi_system; > Ah, sorry. I forgot that CONFIG_CGROUPS=n would force cgroup_psi_enabled()==false (the way function is defined in cgroup.h), so (CONFIG_CGROUPS=n && cgroup_psi_enabled()==true) is an invalid configuration. I think adding a comment to your suggestion would make it more clear. So your suggestion seems to work. I'll test it and include it in the next revision. Thanks! > > > > -- > > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. > >