lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJ5iAvqAmIhzJRot@hirez.programming.kicks-ass.net>
Date:   Fri, 14 May 2021 13:41:54 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Suren Baghdasaryan <surenb@...gle.com>
Cc:     tj@...nel.org, hannes@...xchg.org, lizefan.x@...edance.com,
        mingo@...hat.com, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        minchan@...nel.org, corbet@....net, bristot@...hat.com,
        paulmck@...nel.org, rdunlap@...radead.org,
        akpm@...ux-foundation.org, tglx@...utronix.de, macro@...am.me.uk,
        viresh.kumar@...aro.org, mike.kravetz@...cle.com,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        cgroups@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [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 ?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ