]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sched: isolate SMP balancing code a bit more
authorPeter Williams <pwil3058@bigpond.net.au>
Wed, 24 Oct 2007 16:23:51 +0000 (18:23 +0200)
committerIngo Molnar <mingo@elte.hu>
Wed, 24 Oct 2007 16:23:51 +0000 (18:23 +0200)
At the moment, a lot of load balancing code that is irrelevant to non
SMP systems gets included during non SMP builds.

This patch addresses this issue and reduces the binary size on non
SMP systems:

   text    data     bss     dec     hex filename
  10983      28    1192   12203    2fab sched.o.before
  10739      28    1192   11959    2eb7 sched.o.after

Signed-off-by: Peter Williams <pwil3058@bigpond.net.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/sched.h
kernel/sched.c
kernel/sched_fair.c
kernel/sched_idletask.c
kernel/sched_rt.c

index 639241f4f3d138b14a7e8d7f6319803caab53010..24e08d1d900db4782229adfd3e8adf90d0f209a6 100644 (file)
@@ -828,6 +828,7 @@ struct sched_class {
        struct task_struct * (*pick_next_task) (struct rq *rq);
        void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
+#ifdef CONFIG_SMP
        unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
                        struct rq *busiest, unsigned long max_load_move,
                        struct sched_domain *sd, enum cpu_idle_type idle,
@@ -836,6 +837,7 @@ struct sched_class {
        int (*move_one_task) (struct rq *this_rq, int this_cpu,
                              struct rq *busiest, struct sched_domain *sd,
                              enum cpu_idle_type idle);
+#endif
 
        void (*set_curr_task) (struct rq *rq);
        void (*task_tick) (struct rq *rq, struct task_struct *p);
index 8607795fad69b6dfc6fe22688943e153e459f6b3..b4fbbc440453c8d76c686128fad818939d70740e 100644 (file)
@@ -849,23 +849,6 @@ static int
 iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
                   struct sched_domain *sd, enum cpu_idle_type idle,
                   struct rq_iterator *iterator);
-#else
-static inline unsigned long
-balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-             unsigned long max_load_move, struct sched_domain *sd,
-             enum cpu_idle_type idle, int *all_pinned,
-             int *this_best_prio, struct rq_iterator *iterator)
-{
-       return 0;
-}
-
-static inline int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                  struct sched_domain *sd, enum cpu_idle_type idle,
-                  struct rq_iterator *iterator)
-{
-       return 0;
-}
 #endif
 
 #include "sched_stats.h"
index a90d0457d603b23b6db6c945feaa3a9154b32a37..9971831b560e966281b8ba4c70a7bd8f3dffafbc 100644 (file)
@@ -876,6 +876,7 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
        }
 }
 
+#ifdef CONFIG_SMP
 /**************************************************
  * Fair scheduling class load-balancing methods:
  */
@@ -1008,6 +1009,7 @@ move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 
        return 0;
 }
+#endif
 
 /*
  * scheduler tick hitting a task of our scheduling class:
@@ -1084,8 +1086,10 @@ static const struct sched_class fair_sched_class = {
        .pick_next_task         = pick_next_task_fair,
        .put_prev_task          = put_prev_task_fair,
 
+#ifdef CONFIG_SMP
        .load_balance           = load_balance_fair,
        .move_one_task          = move_one_task_fair,
+#endif
 
        .set_curr_task          = set_curr_task_fair,
        .task_tick              = task_tick_fair,
index 586b06ca30aa92d1c190fed9f97eaf2230b88267..bf9c25c15b8badfc340dabcb9067ff2437b6d431 100644 (file)
@@ -37,6 +37,7 @@ static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
 {
 }
 
+#ifdef CONFIG_SMP
 static unsigned long
 load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
                  unsigned long max_load_move,
@@ -52,6 +53,7 @@ move_one_task_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
 {
        return 0;
 }
+#endif
 
 static void task_tick_idle(struct rq *rq, struct task_struct *curr)
 {
@@ -76,8 +78,10 @@ const struct sched_class idle_sched_class = {
        .pick_next_task         = pick_next_task_idle,
        .put_prev_task          = put_prev_task_idle,
 
+#ifdef CONFIG_SMP
        .load_balance           = load_balance_idle,
        .move_one_task          = move_one_task_idle,
+#endif
 
        .set_curr_task          = set_curr_task_idle,
        .task_tick              = task_tick_idle,
index e9395b7119e6bd24f7a5ba1f252a957e43b1dc93..8abd752a0ebd9fa9d9bb8f9c61100923d5df17ac 100644 (file)
@@ -98,6 +98,7 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
        p->se.exec_start = 0;
 }
 
+#ifdef CONFIG_SMP
 /*
  * Load-balancing iterator. Note: while the runqueue stays locked
  * during the whole iteration, the current task might be
@@ -202,6 +203,7 @@ move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
        return iter_move_one_task(this_rq, this_cpu, busiest, sd, idle,
                                  &rt_rq_iterator);
 }
+#endif
 
 static void task_tick_rt(struct rq *rq, struct task_struct *p)
 {
@@ -245,8 +247,10 @@ const struct sched_class rt_sched_class = {
        .pick_next_task         = pick_next_task_rt,
        .put_prev_task          = put_prev_task_rt,
 
+#ifdef CONFIG_SMP
        .load_balance           = load_balance_rt,
        .move_one_task          = move_one_task_rt,
+#endif
 
        .set_curr_task          = set_curr_task_rt,
        .task_tick              = task_tick_rt,