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, 31 Oct 2018 19:45:27 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Patrick Bellasi <patrick.bellasi@....com>
Cc:     linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.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>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Aaron Lu <aaron.lu@...el.com>,
        Ye Xiaolong <xiaolong.ye@...el.com>,
        Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] sched/fair: util_est: fix cpu_util_wake for execl

On Tue, Oct 30, 2018 at 04:09:47PM +0000, Patrick Bellasi wrote:

> Let's fix this by ensuring to always discount the task estimated
> utilization from the CPU's estimated utilization when the task is also
> the current one. The same benchmark of the bug report, executed on a
> dual socket 40 CPUs Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz machine,
> reports these "Execl Throughput" figures (higher the better):

Before this we have:

	/* Discount task's blocked util from CPU's util */
	util -= min_t(unsigned int, util, task_util(p));

at the very least that comment is now inaccurate, since @p might not be
blocked.

> @@ -6258,8 +6267,17 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p)
>  	 * covered by the following code when estimated utilization is
>  	 * enabled.
>  	 */
> -	if (sched_feat(UTIL_EST))
> -		util = max(util, READ_ONCE(cfs_rq->avg.util_est.enqueued));
> +	if (sched_feat(UTIL_EST)) {
> +		unsigned int estimated =
> +			READ_ONCE(cfs_rq->avg.util_est.enqueued);
> +
> +		if (unlikely(current == p || task_on_rq_queued(p))) {

I'm confused by the need for 'current == p', afaict task_on_rq_queued(p)
is sufficient -- we've already established task_cpu(p) == cpu earlier.

> +			estimated -= min_t(unsigned int, estimated,
> +				(_task_util_est(p) | UTIL_AVG_UNCHANGED));
> +		}
> +
> +		util = max(util, estimated);
> +	}

Also, I think it is about time we find a suitable name for:

#define xxx(_var, _val) do { \
	typeof(_var) var = (_var); \
	typeof(_var) val = (_val); \
	typeof(_var) res = var - val; \
	if (res > var) \
		res = 0; \
	(_var) = res; \
} while (0)

Which is basically sub_positive() but without the READ_ONCE/WRITE_ONCE
stuff. We do that:

	var -= min_t(typeof(var), var, val);

pattern _all_ over.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ