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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 23 May 2013 10:34:23 +0200
From:	Lukasz Majewski <l.majewski@...sung.com>
To:	Alex Shi <alex.shi@...el.com>
Cc:	Linux PM list <linux-pm@...r.kernel.org>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Lukasz Majewski <l.majewski@...sung.com>,
	Jonghwa Lee <jonghwa3.lee@...sung.com>,
	Myungjoo Ham <myungjoo.ham@...sung.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Kyungmin Park <kyungmin.park@...sung.com>
Subject: [PATCH 1/2] sched: Use do_div() for 64 bit division at power
 utilization calculation (putil)

Now explicit casting is done when power usage variable (putil) is calculated

Signed-off-by: Lukasz Majewski <l.majewski@...sung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@...sung.com>
---
This patch was developed on top of the following Alex's repository:
https://github.com/alexshi/power-scheduling/commits/power-scheduling
---
 kernel/sched/fair.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f0ead38..14d29b3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3471,8 +3471,10 @@ find_leader_cpu(struct sched_group *group, struct task_struct *p, int this_cpu,
 	int leader_cpu = -1;
 	int i;
 	/* percentage of the task's util */
-	unsigned putil = (u64)(p->se.avg.runnable_avg_sum << SCHED_POWER_SHIFT)
-				/ (p->se.avg.runnable_avg_period + 1);
+	unsigned putil;
+	u64 tmp = (u64) p->se.avg.runnable_avg_sum << SCHED_POWER_SHIFT;
+	do_div(tmp, (p->se.avg.runnable_avg_period + 1));
+	putil = (unsigned) tmp;
 
 	/* bias toward local cpu */
 	if (cpumask_test_cpu(this_cpu, tsk_cpus_allowed(p)) &&
-- 
1.7.10.4

--
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