From 559961ecbe247d785c13924379d757e83b59f016 Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Tue, 6 May 2014 19:46:50 +0100 Subject: [PATCH] sched: hmp: Change small task packing defaults for all platforms All platforms other than TC2 default to enabling packing. Since TC2 shows no performance or energy degradation with this feature enabled make it default enabled the same as everyone else. Likewise, vendors have been including TC2 support in multi-machine kernel builds so they expect the default thresholds to remain the same when the TC2 #ifdef is removed. Signed-off-by: Chris Redpath Signed-off-by: Jon Medhurst --- kernel/sched/fair.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e3651cb..f1c4dc0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4872,15 +4872,29 @@ unsigned int hmp_next_up_threshold = 4096; unsigned int hmp_next_down_threshold = 4096; #ifdef CONFIG_SCHED_HMP_LITTLE_PACKING -#ifndef CONFIG_ARCH_VEXPRESS_TC2 +/* + * Set the default packing threshold to try to keep little + * CPUs at no more than 80% of their maximum frequency if only + * packing a small number of small tasks. Bigger tasks will + * raise frequency as normal. + * In order to pack a task onto a CPU, the sum of the + * unweighted runnable_avg load of existing tasks plus the + * load of the new task must be less than hmp_full_threshold. + * + * This works in conjunction with frequency-invariant load + * and DVFS governors. Since most DVFS governors aim for 80% + * utilisation, we arrive at (0.8*0.8*(max_load=1024))=655 + * and use a value slightly lower to give a little headroom + * in the decision. + * Note that the most efficient frequency is different for + * each system so /sys/kernel/hmp/packing_limit should be + * configured at runtime for any given platform to achieve + * optimal energy usage. Some systems may not benefit from + * packing, so this feature can also be disabled at runtime + * with /sys/kernel/hmp/packing_enable + */ unsigned int hmp_packing_enabled = 1; -unsigned int hmp_full_threshold = (NICE_0_LOAD * 9) / 8; -#else -/* TC2 has a sharp consumption curve @ around 800Mhz, so - we aim to spread the load around that frequency. */ -unsigned int hmp_packing_enabled; -unsigned int hmp_full_threshold = 650; /* 80% of the 800Mhz freq * NICE_0_LOAD */ -#endif +unsigned int hmp_full_threshold = 650; #endif static unsigned int hmp_up_migration(int cpu, int *target_cpu, struct sched_entity *se); @@ -4977,8 +4991,8 @@ static inline unsigned int hmp_select_slower_cpu(struct task_struct *tsk, * Select the 'best' candidate little CPU to wake up on. * Implements a packing strategy which examines CPU in * logical CPU order, and selects the first which will - * have at least 10% capacity available, according to - * both tracked load of the runqueue and the task. + * be loaded less than hmp_full_threshold according to + * the sum of the tracked load of the runqueue and the task. */ static inline unsigned int hmp_best_little_cpu(struct task_struct *tsk, int cpu) { -- 2.7.4