lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] cgroup: make per-cgroup pressure stall tracking configurable
On Thu, May 13, 2021 at 10:53:49AM -0700, Suren Baghdasaryan wrote:

> +bool cgroup_psi_enabled(void)
> +{
> + return (cgroup_feature_disable_mask & (1 << OPT_FEATURE_PRESSURE)) == 0;
> +}

> diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> index cc25a3cff41f..c73efd7d4fba 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -747,9 +747,12 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
> #ifdef CONFIG_CGROUPS
> struct cgroup *cgroup = NULL;
>
> - if (!*iter)
> + if (!*iter) {
> + /* Skip to psi_system if per-cgroup accounting is disabled */
> + if (!cgroup_psi_enabled())
> + goto update_sys;
> cgroup = task->cgroups->dfl_cgrp;
> - else if (*iter == &psi_system)
> + } else if (*iter == &psi_system)
> return NULL;
> else
> cgroup = cgroup_parent(*iter);
> @@ -758,6 +761,7 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
> *iter = cgroup;
> return cgroup_psi(cgroup);
> }
> +update_sys:
> #else
> if (*iter)
> return NULL;

I'm confused; shouldn't that do the same as that #else branch? Also, can
you pretty please make cgroup_psi_enabled() a static_key ?

\
 
 \ /
  Last update: 2021-05-14 13:42    [W:0.050 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site