aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-10-22 03:25:26 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-22 04:01:52 -0400
commit4ce72a2c063a7fa8e42a9435440ae3364115a58d (patch)
tree427b25960945524a205c7d8ed20ed5f02325175e
parent0c4b83da58ec2e96ce9c44c211d6eac5f9dae478 (diff)
sched: add CONFIG_SMP consistency
a patch from Henrik Austad did this: >> Do not declare select_task_rq as part of sched_class when CONFIG_SMP is >> not set. Peter observed: > While a proper cleanup, could you do it by re-arranging the methods so > as to not create an additional ifdef? Do not declare select_task_rq and some other methods as part of sched_class when CONFIG_SMP is not set. Also gather those methods to avoid CONFIG_SMP mess. Idea-by: Henrik Austad <henrik.austad@gmail.com> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Henrik Austad <henrik@austad.us> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/sched.h12
-rw-r--r--kernel/sched_fair.c5
-rw-r--r--kernel/sched_idletask.c5
-rw-r--r--kernel/sched_rt.c5
4 files changed, 13 insertions, 14 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4f59c8e8597d..c05b45faef18 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -897,7 +897,6 @@ struct sched_class {
897 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); 897 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
898 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 898 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
899 void (*yield_task) (struct rq *rq); 899 void (*yield_task) (struct rq *rq);
900 int (*select_task_rq)(struct task_struct *p, int sync);
901 900
902 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); 901 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync);
903 902
@@ -905,6 +904,8 @@ struct sched_class {
905 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 904 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
906 905
907#ifdef CONFIG_SMP 906#ifdef CONFIG_SMP
907 int (*select_task_rq)(struct task_struct *p, int sync);
908
908 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, 909 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
909 struct rq *busiest, unsigned long max_load_move, 910 struct rq *busiest, unsigned long max_load_move,
910 struct sched_domain *sd, enum cpu_idle_type idle, 911 struct sched_domain *sd, enum cpu_idle_type idle,
@@ -916,16 +917,17 @@ struct sched_class {
916 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 917 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
917 void (*post_schedule) (struct rq *this_rq); 918 void (*post_schedule) (struct rq *this_rq);
918 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 919 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
919#endif
920 920
921 void (*set_curr_task) (struct rq *rq);
922 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
923 void (*task_new) (struct rq *rq, struct task_struct *p);
924 void (*set_cpus_allowed)(struct task_struct *p, 921 void (*set_cpus_allowed)(struct task_struct *p,
925 const cpumask_t *newmask); 922 const cpumask_t *newmask);
926 923
927 void (*rq_online)(struct rq *rq); 924 void (*rq_online)(struct rq *rq);
928 void (*rq_offline)(struct rq *rq); 925 void (*rq_offline)(struct rq *rq);
926#endif
927
928 void (*set_curr_task) (struct rq *rq);
929 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
930 void (*task_new) (struct rq *rq, struct task_struct *p);
929 931
930 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 932 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
931 int running); 933 int running);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index a0aa38b10fdd..8de48a5da354 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1593,9 +1593,6 @@ static const struct sched_class fair_sched_class = {
1593 .enqueue_task = enqueue_task_fair, 1593 .enqueue_task = enqueue_task_fair,
1594 .dequeue_task = dequeue_task_fair, 1594 .dequeue_task = dequeue_task_fair,
1595 .yield_task = yield_task_fair, 1595 .yield_task = yield_task_fair,
1596#ifdef CONFIG_SMP
1597 .select_task_rq = select_task_rq_fair,
1598#endif /* CONFIG_SMP */
1599 1596
1600 .check_preempt_curr = check_preempt_wakeup, 1597 .check_preempt_curr = check_preempt_wakeup,
1601 1598
@@ -1603,6 +1600,8 @@ static const struct sched_class fair_sched_class = {
1603 .put_prev_task = put_prev_task_fair, 1600 .put_prev_task = put_prev_task_fair,
1604 1601
1605#ifdef CONFIG_SMP 1602#ifdef CONFIG_SMP
1603 .select_task_rq = select_task_rq_fair,
1604
1606 .load_balance = load_balance_fair, 1605 .load_balance = load_balance_fair,
1607 .move_one_task = move_one_task_fair, 1606 .move_one_task = move_one_task_fair,
1608#endif 1607#endif
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index dec4ccabe2f5..8a21a2e28c13 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -105,9 +105,6 @@ static const struct sched_class idle_sched_class = {
105 105
106 /* dequeue is not valid, we print a debug message there: */ 106 /* dequeue is not valid, we print a debug message there: */
107 .dequeue_task = dequeue_task_idle, 107 .dequeue_task = dequeue_task_idle,
108#ifdef CONFIG_SMP
109 .select_task_rq = select_task_rq_idle,
110#endif /* CONFIG_SMP */
111 108
112 .check_preempt_curr = check_preempt_curr_idle, 109 .check_preempt_curr = check_preempt_curr_idle,
113 110
@@ -115,6 +112,8 @@ static const struct sched_class idle_sched_class = {
115 .put_prev_task = put_prev_task_idle, 112 .put_prev_task = put_prev_task_idle,
116 113
117#ifdef CONFIG_SMP 114#ifdef CONFIG_SMP
115 .select_task_rq = select_task_rq_idle,
116
118 .load_balance = load_balance_idle, 117 .load_balance = load_balance_idle,
119 .move_one_task = move_one_task_idle, 118 .move_one_task = move_one_task_idle,
120#endif 119#endif
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index cdf5740ab03e..c9aa5bede226 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1502,9 +1502,6 @@ static const struct sched_class rt_sched_class = {
1502 .enqueue_task = enqueue_task_rt, 1502 .enqueue_task = enqueue_task_rt,
1503 .dequeue_task = dequeue_task_rt, 1503 .dequeue_task = dequeue_task_rt,
1504 .yield_task = yield_task_rt, 1504 .yield_task = yield_task_rt,
1505#ifdef CONFIG_SMP
1506 .select_task_rq = select_task_rq_rt,
1507#endif /* CONFIG_SMP */
1508 1505
1509 .check_preempt_curr = check_preempt_curr_rt, 1506 .check_preempt_curr = check_preempt_curr_rt,
1510 1507
@@ -1512,6 +1509,8 @@ static const struct sched_class rt_sched_class = {
1512 .put_prev_task = put_prev_task_rt, 1509 .put_prev_task = put_prev_task_rt,
1513 1510
1514#ifdef CONFIG_SMP 1511#ifdef CONFIG_SMP
1512 .select_task_rq = select_task_rq_rt,
1513
1515 .load_balance = load_balance_rt, 1514 .load_balance = load_balance_rt,
1516 .move_one_task = move_one_task_rt, 1515 .move_one_task = move_one_task_rt,
1517 .set_cpus_allowed = set_cpus_allowed_rt, 1516 .set_cpus_allowed = set_cpus_allowed_rt,