[RFC PATCH v2 6/7] sched: bias task wakeups to preferred semi-idle packages

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Vaidyanathan Srinivasan
Date: Monday, September 8, 2008 - 6:22 am

Preferred wakeup cpu (from a semi idle package) has been
nominated in find_busiest_group() in the previous patch.  Use
this information in sched_mc_preferred_wakeup_cpu in function
select_task_rq_fair() to bias task wakeups if the following
conditions are satisfied:
	- The present cpu that is trying to wakeup the process is
	  idle and waking the target process on this cpu will
	  potentially wakeup a completely idle package
	- The previous cpu on which the target process ran is
	  also idle and hence selecting the previous cpu may
	  wakeup a semi idle cpu package
	- The task being woken up is allowed to run in the
	  nominated cpu (cpu affinity and restrictions)

Basically if both the current cpu and the previous cpu on
which the task ran is idle, select the nominated cpu from semi
idle cpu package for running the new task that is waking up.

Cache hotness and system utilisation could also be considered
before the decision is made.  (Not currently implemented)

This technique will effectively move short running bursty jobs in
an mostly idle system.

Wakeup biasing for power savings gets automatically disabled if
system utilisation increases due to the fact that the probability
of finding both this_cpu and prev_cpu idle decreases.

Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---

 kernel/sched_fair.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index f1c96e3..1301521 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -73,6 +73,9 @@ unsigned int sysctl_sched_wakeup_granularity = 5000000UL;
 
 const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
 
+/* Preferred wakeup cpu nominated by sched_mc load balancing logic */
+extern unsigned int sched_mc_preferred_wakeup_cpu;
+
 /**************************************************************
  * CFS operations on generic schedulable entities:
  */
@@ -1232,6 +1235,16 @@ static int select_task_rq_fair(struct task_struct *p, int sync)
 		}
 	}
 
+	/*
+	 * At POWERSAVINGS_BALANCE_WAKEUP level, if both this_cpu and prev_cpu
+	 * are idle and this is not a kernel thread and this task's affinity
+	 * allows it to be moved to preferred cpu, then just move!
+	 */
+	if (sched_mc_power_savings >= POWERSAVINGS_BALANCE_WAKEUP &&
+		idle_cpu(prev_cpu) && idle_cpu(this_cpu) && p->mm &&
+		cpu_isset(sched_mc_preferred_wakeup_cpu, p->cpus_allowed))
+		return sched_mc_preferred_wakeup_cpu;
+
 	if (unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
 		goto out;
 

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Vaidyanathan Srinivasan, (Mon Sep 8, 6:14 am)
[RFC PATCH v2 1/7] sched: arch_reinit_sched_domains() must ..., Vaidyanathan Srinivasan, (Mon Sep 8, 6:16 am)
[RFC PATCH v2 2/7] sched: Fix __load_balance_iterator() fo ..., Vaidyanathan Srinivasan, (Mon Sep 8, 6:17 am)
[RFC PATCH v2 3/7] sched: Framework for sched_mc/smt_power ..., Vaidyanathan Srinivasan, (Mon Sep 8, 6:18 am)
[RFC PATCH v2 4/7] sched: favour lower logical cpu number ..., Vaidyanathan Srinivasan, (Mon Sep 8, 6:20 am)
[RFC PATCH v2 5/7] sched: nominate preferred wakeup cpu, Vaidyanathan Srinivasan, (Mon Sep 8, 6:21 am)
[RFC PATCH v2 6/7] sched: bias task wakeups to preferred s ..., Vaidyanathan Srinivasan, (Mon Sep 8, 6:22 am)
[RFC PATCH v2 7/7] sched: activate active load balancing i ..., Vaidyanathan Srinivasan, (Mon Sep 8, 6:23 am)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Peter Zijlstra, (Mon Sep 8, 6:25 am)
Re: [RFC PATCH v2 5/7] sched: nominate preferred wakeup cpu, Vaidyanathan Srinivasan, (Mon Sep 8, 6:43 am)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Vaidyanathan Srinivasan, (Mon Sep 8, 6:48 am)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Peter Zijlstra, (Mon Sep 8, 6:56 am)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Suresh Siddha, (Mon Sep 8, 6:20 pm)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Peter Zijlstra, (Mon Sep 8, 11:18 pm)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Peter Zijlstra, (Mon Sep 8, 11:54 pm)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Peter Zijlstra, (Tue Sep 9, 1:25 am)
Re: [RFC PATCH v2 0/7] Tunable sched_mc_power_savings=n, Vaidyanathan Srinivasan, (Wed Sep 10, 6:45 am)