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: <5515713C.3060509@arm.com>
Date:	Fri, 27 Mar 2015 15:03:24 +0000
From:	Dietmar Eggemann <dietmar.eggemann@....com>
To:	Sai Gurrappadi <sgurrappadi@...dia.com>,
	Morten Rasmussen <Morten.Rasmussen@....com>,
	"peterz@...radead.org" <peterz@...radead.org>,
	"mingo@...hat.com" <mingo@...hat.com>
CC:	"vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
	"yuyang.du@...el.com" <yuyang.du@...el.com>,
	"preeti@...ux.vnet.ibm.com" <preeti@...ux.vnet.ibm.com>,
	"mturquette@...aro.org" <mturquette@...aro.org>,
	"nico@...aro.org" <nico@...aro.org>,
	"rjw@...ysocki.net" <rjw@...ysocki.net>,
	Juri Lelli <Juri.Lelli@....com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Peter Boonstoppel <pboonstoppel@...dia.com>
Subject: Re: [RFCv3 PATCH 43/48] sched: Introduce energy awareness into detach_tasks

On 25/03/15 23:50, Sai Gurrappadi wrote:
> On 02/04/2015 10:31 AM, Morten Rasmussen wrote:
>> From: Dietmar Eggemann <dietmar.eggemann@....com>
>>   	while (!list_empty(tasks)) {
>> @@ -6121,6 +6121,20 @@ static int detach_tasks(struct lb_env *env)
>>   		if (!can_migrate_task(p, env))
>>   			goto next;
>>   
>> +		if (env->use_ea) {
>> +			struct energy_env eenv = {
>> +				.src_cpu = env->src_cpu,
>> +				.dst_cpu = env->dst_cpu,
>> +				.usage_delta = task_utilization(p),
>> +			};
>> +			int e_diff = energy_diff(&eenv);
>> +
>> +			if (e_diff >= 0)
>> +				goto next;
>> +
>> +			goto detach;
>> +		}
>> +
>>   		load = task_h_load(p);
>>   
>>   		if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed)
>> @@ -6129,6 +6143,7 @@ static int detach_tasks(struct lb_env *env)
>>   		if ((load / 2) > env->imbalance)
>>   			goto next;
>>   
>> +detach:
>>   		detach_task(p, env);
>>   		list_add(&p->se.group_node, &env->tasks);
> 
> Hi Morten, Dietmar,
> 
> Wouldn't the above energy_diff() use the 'old' value of dst_cpu's util?
> Tasks are detached/dequeued in this loop so they have their util
> contrib. removed from src_cpu but their contrib. hasn't been added to
> dst_cpu yet (happens in attach_tasks).

You're absolutely right Sai. Thanks for pointing this out! I guess I rather
have to accumulate the usage of tasks I've detached and add this to the
eenv::usage_delta of the energy_diff() call for the next task.

Something like this (only slightly tested):

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8d4cc72f4778..d0d0e965fd0c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6097,6 +6097,7 @@ static int detach_tasks(struct lb_env *env)
        struct task_struct *p;
        unsigned long load = 0;
        int detached = 0;
+       int usage_delta = 0;
 
        lockdep_assert_held(&env->src_rq->lock);
 
@@ -6122,16 +6123,19 @@ static int detach_tasks(struct lb_env *env)
                        goto next;
 
                if (env->use_ea) {
+                       int util = task_utilization(p);
                        struct energy_env eenv = {
                                .src_cpu = env->src_cpu,
                                .dst_cpu = env->dst_cpu,
-                               .usage_delta = task_utilization(p),
+                               .usage_delta = usage_delta + util,
                        };
                        int e_diff = energy_diff(&eenv);
 
                        if (e_diff >= 0)
                                goto next;
 
+                       usage_delta += util;
+
                        goto detach;
                }

[...]

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ