From: Suren Baghdasaryan <surenb@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>,
lizefan.x@bytedance.com, Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Benjamin Segall <bsegall@google.com>,
mgorman@suse.de, Minchan Kim <minchan@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
bristot@redhat.com, "Paul E . McKenney" <paulmck@kernel.org>,
rdunlap@infradead.org, Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
macro@orcam.me.uk, Viresh Kumar <viresh.kumar@linaro.org>,
mike.kravetz@oracle.com, linux-doc@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
cgroups mailinglist <cgroups@vger.kernel.org>,
kernel-team <kernel-team@android.com>
Subject: Re: [PATCH 1/1] cgroup: make per-cgroup pressure stall tracking configurable
Date: Fri, 14 May 2021 11:50:06 -0700 [thread overview]
Message-ID: <CAJuCfpH2X47_3VvfZXs_eWhYDziOh13qdUwcfxPJe=Zg_Nkvqw@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpGkj9HxbkXnYN58JXJp1j6kVkvQhqscnEfjyB5unKg1NQ@mail.gmail.com>
On Fri, May 14, 2021 at 11:20 AM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Fri, May 14, 2021 at 10:52 AM Peter Zijlstra <peterz@infradead.org> 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.
> >
next prev parent reply other threads:[~2021-05-14 18:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 17:53 [PATCH 1/1] cgroup: make per-cgroup pressure stall tracking configurable Suren Baghdasaryan
2021-05-14 11:41 ` Peter Zijlstra
2021-05-14 15:54 ` Suren Baghdasaryan
2021-05-14 17:52 ` Peter Zijlstra
2021-05-14 18:20 ` Suren Baghdasaryan
2021-05-14 18:50 ` Suren Baghdasaryan [this message]
2021-05-16 19:52 ` Suren Baghdasaryan
2021-05-17 18:31 ` Johannes Weiner
2021-05-17 20:02 ` Suren Baghdasaryan
2021-05-18 2:05 ` Suren Baghdasaryan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJuCfpH2X47_3VvfZXs_eWhYDziOh13qdUwcfxPJe=Zg_Nkvqw@mail.gmail.com' \
--to=surenb@google.com \
--cc=akpm@linux-foundation.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@android.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=macro@orcam.me.uk \
--cc=mgorman@suse.de \
--cc=mike.kravetz@oracle.com \
--cc=minchan@kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).