public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sched: Use do_div() for 64 bit division at power utilization calculation (putil)
@ 2013-05-23  8:34 Lukasz Majewski
  2013-05-23  8:34 ` [PATCH 2/2] sched:fix: Signed overflow prevention for vacancy calculation Lukasz Majewski
  2013-05-30  1:48 ` [PATCH 1/2] sched: Use do_div() for 64 bit division at power utilization calculation (putil) Alex Shi
  0 siblings, 2 replies; 5+ messages in thread
From: Lukasz Majewski @ 2013-05-23  8:34 UTC (permalink / raw)
  To: Alex Shi
  Cc: Linux PM list, Vincent Guittot, Lukasz Majewski, Jonghwa Lee,
	Myungjoo Ham, linux-kernel, Kyungmin Park

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

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-31  6:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23  8:34 [PATCH 1/2] sched: Use do_div() for 64 bit division at power utilization calculation (putil) Lukasz Majewski
2013-05-23  8:34 ` [PATCH 2/2] sched:fix: Signed overflow prevention for vacancy calculation Lukasz Majewski
2013-05-30  1:50   ` Alex Shi
2013-05-30  1:48 ` [PATCH 1/2] sched: Use do_div() for 64 bit division at power utilization calculation (putil) Alex Shi
2013-05-31  6:14   ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox