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]
Date:   Wed, 7 Nov 2018 11:38:49 +0000
From:   Patrick Bellasi <patrick.bellasi@....com>
To:     linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Tejun Heo <tj@...nel.org>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Paul Turner <pjt@...gle.com>,
        Quentin Perret <quentin.perret@....com>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Todd Kjos <tkjos@...gle.com>,
        Joel Fernandes <joelaf@...gle.com>,
        Steve Muckle <smuckle@...gle.com>,
        Suren Baghdasaryan <surenb@...gle.com>
Subject: Re: [PATCH v5 09/15] sched/cpufreq: uclamp: add utilization clamping
 for FAIR tasks

On 29-Oct 18:33, Patrick Bellasi wrote:

[...]

> +#ifdef CONFIG_UCLAMP_TASK
> +/**
> + * clamp_util: clamp a utilization value for a specified CPU
> + * @rq: the CPU's RQ to get the clamp values from
> + * @util: the utilization signal to clamp
> + *
> + * Each CPU tracks util_{min,max} clamp values depending on the set of its
> + * currently RUNNABLE tasks. Given a utilization signal, i.e a signal in
> + * the [0..SCHED_CAPACITY_SCALE] range, this function returns a clamped
> + * utilization signal considering the current clamp values for the
> + * specified CPU.
> + *
> + * Return: a clamped utilization signal for a given CPU.
> + */
> +static inline unsigned int uclamp_util(struct rq *rq, unsigned int util)
> +{
> +	unsigned int min_util = rq->uclamp.value[UCLAMP_MIN];
> +	unsigned int max_util = rq->uclamp.value[UCLAMP_MAX];

Just notice here we can have an issue.

For each scheduling entity, we always ensure that:

    util_min <= util_max

However, since CPU's {min,max}_util clamps are always MAX aggregated
considering the corresponding clamps of RUNNABLE tasks with
_different_ clamps, we can end up with CPU clamps where:

    util_min > util_max

Thus, we need to add the following sanity check here:

+       if (unlikely(min_util > max_util))
+               return min_util;

> +
> +	return clamp(util, min_util, max_util);
> +}

-- 
#include <best/regards.h>

Patrick Bellasi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ