aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-15 11:00:03 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:03 -0400
commite59c80c5bbc0d3d6b0772edb347ce2dd303121b3 (patch)
tree4c8f2553ae73f4a5d2777933801369b429828f66 /kernel
parent429d43bcc026b92b9dfaccd3577fec290f6a67ce (diff)
sched: simplify SCHED_FEAT_* code
Peter Zijlstra suggested to simplify SCHED_FEAT_* checks via the sched_feat(x) macro. No code changed: text data bss dec hex filename 38895 3550 24 42469 a5e5 sched.o.before 38895 3550 24 42469 a5e5 sched.o.after Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Mike Galbraith <efault@gmx.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched_fair.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 74d47e65b9ea..2488f6f3ffad 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -105,6 +105,8 @@ const_debug unsigned int sysctl_sched_features =
105 SCHED_FEAT_START_DEBIT *1 | 105 SCHED_FEAT_START_DEBIT *1 |
106 SCHED_FEAT_SKIP_INITIAL *0; 106 SCHED_FEAT_SKIP_INITIAL *0;
107 107
108#define sched_feat(x) (sysctl_sched_features & SCHED_FEAT_##x)
109
108extern struct sched_class fair_sched_class; 110extern struct sched_class fair_sched_class;
109 111
110/************************************************************** 112/**************************************************************
@@ -541,14 +543,14 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se,
541 if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit)) 543 if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit))
542 return; 544 return;
543 545
544 if (sysctl_sched_features & SCHED_FEAT_SLEEPER_LOAD_AVG) 546 if (sched_feat(SLEEPER_LOAD_AVG))
545 load = rq_of(cfs_rq)->cpu_load[2]; 547 load = rq_of(cfs_rq)->cpu_load[2];
546 548
547 /* 549 /*
548 * Fix up delta_fair with the effect of us running 550 * Fix up delta_fair with the effect of us running
549 * during the whole sleep period: 551 * during the whole sleep period:
550 */ 552 */
551 if (sysctl_sched_features & SCHED_FEAT_SLEEPER_AVG) 553 if (sched_feat(SLEEPER_AVG))
552 delta_fair = div64_likely32((u64)delta_fair * load, 554 delta_fair = div64_likely32((u64)delta_fair * load,
553 load + se->load.weight); 555 load + se->load.weight);
554 556
@@ -572,7 +574,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
572 unsigned long delta_fair; 574 unsigned long delta_fair;
573 575
574 if ((entity_is_task(se) && tsk->policy == SCHED_BATCH) || 576 if ((entity_is_task(se) && tsk->policy == SCHED_BATCH) ||
575 !(sysctl_sched_features & SCHED_FEAT_FAIR_SLEEPERS)) 577 !sched_feat(FAIR_SLEEPERS))
576 return; 578 return;
577 579
578 delta_fair = (unsigned long)min((u64)(2*sysctl_sched_runtime_limit), 580 delta_fair = (unsigned long)min((u64)(2*sysctl_sched_runtime_limit),
@@ -1158,14 +1160,14 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
1158 * The first wait is dominated by the child-runs-first logic, 1160 * The first wait is dominated by the child-runs-first logic,
1159 * so do not credit it with that waiting time yet: 1161 * so do not credit it with that waiting time yet:
1160 */ 1162 */
1161 if (sysctl_sched_features & SCHED_FEAT_SKIP_INITIAL) 1163 if (sched_feat(SKIP_INITIAL))
1162 se->wait_start_fair = 0; 1164 se->wait_start_fair = 0;
1163 1165
1164 /* 1166 /*
1165 * The statistical average of wait_runtime is about 1167 * The statistical average of wait_runtime is about
1166 * -granularity/2, so initialize the task with that: 1168 * -granularity/2, so initialize the task with that:
1167 */ 1169 */
1168 if (sysctl_sched_features & SCHED_FEAT_START_DEBIT) 1170 if (sched_feat(START_DEBIT))
1169 se->wait_runtime = -(sched_granularity(cfs_rq) / 2); 1171 se->wait_runtime = -(sched_granularity(cfs_rq) / 2);
1170 1172
1171 __enqueue_entity(cfs_rq, se); 1173 __enqueue_entity(cfs_rq, se);