Re: [RFC][PATCH 11/10] sched, fair: Reduce local_group logic

From: Peter Zijlstra
Date: Wed Aug 28 2013 - 04:57:25 EST



# ls -la defconfig-build/kernel/sched/fair.o*
-rw-r--r-- 1 root root 760688 Aug 28 10:53 defconfig-build/kernel/sched/fair.o
-rw-r--r-- 1 root root 758160 Aug 28 10:36 defconfig-build/kernel/sched/fair.o.orig

---
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4553,9 +4553,9 @@ static inline int sg_imbalanced(struct s
* @local_group: Does group contain this_cpu.
* @sgs: variable to hold the statistics for this group.
*/
-static inline void update_sg_lb_stats(struct lb_env *env,
+static void update_sg_lb_stats(struct lb_env *env,
struct sched_group *group, int load_idx,
- int local_group, struct sg_lb_stats *sgs)
+ int group_bias, struct sg_lb_stats *sgs)
{
unsigned long nr_running;
unsigned long load;
@@ -4568,8 +4568,7 @@ static inline void update_sg_lb_stats(st

nr_running = rq->nr_running;

- /* Bias balancing toward cpus of our domain */
- if (local_group)
+ if (group_bias)
load = target_load(i, load_idx);
else
load = source_load(i, load_idx);
@@ -4667,22 +4666,21 @@ static inline void update_sd_lb_stats(st

do {
struct sg_lb_stats *sgs = &tmp_sgs;
- int local_group;

- local_group = cpumask_test_cpu(env->dst_cpu, sched_group_cpus(sg));
- if (local_group) {
+ if (cpumask_test_cpu(env->dst_cpu, sched_group_cpus(sg))) {
sds->local = sg;
sgs = &sds->local_stat;

if (env->idle != CPU_NEWLY_IDLE ||
time_after_eq(jiffies, sg->sgp->next_update))
update_group_power(env->sd, env->dst_cpu);
- }
-
- update_sg_lb_stats(env, sg, load_idx, local_group, sgs);

- if (local_group)
+ /* Bias balancing toward cpus of our domain */
+ update_sg_lb_stats(env, sg, load_idx, 1, sgs);
goto next_group;
+ }
+
+ update_sg_lb_stats(env, sg, load_idx, 0, sgs);

/*
* In case the child domain prefers tasks go to siblings
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/