All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Suren Baghdasaryan <surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org,
	Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Juri Lelli <juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Vincent Guittot
	<vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Dietmar Eggemann <dietmar.eggemann-5wv7dgnIgG8@public.gmane.org>,
	Steven Rostedt <rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>,
	Benjamin Segall <bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	mgorman-l3A5Bk7waGM@public.gmane.org,
	Minchan Kim <minchan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>,
	bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	"Paul E . McKenney"
	<paulmck-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	macro-fOkVWZO6G+f10XsdtD+oqA@public.gmane.org,
	Viresh Kumar
	<viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	mike.kravetz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	cgroups mailinglist
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/1] cgroup: make per-cgroup pressure stall tracking configurable
Date: Fri, 14 May 2021 19:52:04 +0200	[thread overview]
Message-ID: <YJ64xHoogrowXTok@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAJuCfpHy+MknCepfjx9XYUA1j42Auauv7MFQbt+zOU-tA4gasA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.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;
 }

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Suren Baghdasaryan <surenb@google.com>
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 19:52:04 +0200	[thread overview]
Message-ID: <YJ64xHoogrowXTok@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAJuCfpHy+MknCepfjx9XYUA1j42Auauv7MFQbt+zOU-tA4gasA@mail.gmail.com>

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;
 }

  parent reply	other threads:[~2021-05-14 17:52 UTC|newest]

Thread overview: 19+ 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
     [not found] ` <20210513175349.959661-1-surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2021-05-14 11:41   ` Peter Zijlstra
2021-05-14 11:41     ` Peter Zijlstra
     [not found]     ` <YJ5iAvqAmIhzJRot-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2021-05-14 15:54       ` Suren Baghdasaryan
2021-05-14 15:54         ` Suren Baghdasaryan
     [not found]         ` <CAJuCfpHy+MknCepfjx9XYUA1j42Auauv7MFQbt+zOU-tA4gasA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-05-14 17:52           ` Peter Zijlstra [this message]
2021-05-14 17:52             ` Peter Zijlstra
2021-05-14 18:20             ` Suren Baghdasaryan
2021-05-14 18:20               ` Suren Baghdasaryan
     [not found]               ` <CAJuCfpGkj9HxbkXnYN58JXJp1j6kVkvQhqscnEfjyB5unKg1NQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-05-14 18:50                 ` Suren Baghdasaryan
2021-05-14 18:50                   ` Suren Baghdasaryan
     [not found]                   ` <CAJuCfpH2X47_3VvfZXs_eWhYDziOh13qdUwcfxPJe=Zg_Nkvqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-05-16 19:52                     ` Suren Baghdasaryan
2021-05-16 19:52                       ` Suren Baghdasaryan
2021-05-17 18:31                       ` Johannes Weiner
2021-05-17 18:31                         ` Johannes Weiner
2021-05-17 20:02                         ` Suren Baghdasaryan
2021-05-17 20:02                           ` Suren Baghdasaryan
2021-05-18  2:05                           ` 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=YJ64xHoogrowXTok@hirez.programming.kicks-ass.net \
    --to=peterz-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=corbet-T1hC0tSOHrs@public.gmane.org \
    --cc=dietmar.eggemann-5wv7dgnIgG8@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=macro-fOkVWZO6G+f10XsdtD+oqA@public.gmane.org \
    --cc=mgorman-l3A5Bk7waGM@public.gmane.org \
    --cc=mike.kravetz-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=minchan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=paulmck-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org \
    --cc=surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.