sched: Make initial SCHED_RR timeslace DEF_TIMESLICE
authorHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Thu, 16 Feb 2012 05:52:21 +0000 (14:52 +0900)
committerIngo Molnar <mingo@elte.hu>
Wed, 22 Feb 2012 11:28:29 +0000 (12:28 +0100)
Current the initial SCHED_RR timeslice of init_task is HZ, which means
1s, and is not same as the default SCHED_RR timeslice DEF_TIMESLICE.

Change that initial timeslice to the DEF_TIMESLICE.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
[ s/DEF_TIMESLICE/RR_TIMESLICE/g ]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/4F3C9995.3010800@ct.jp.nec.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/init_task.h
include/linux/sched.h
kernel/sched/rt.c
kernel/sched/sched.h

index 9c66b1ada9d7d6d3a97882168ba37ca9a0b9aa2f..f994d51f70f20cc7b1e1bd92ed8163e1e74454de 100644 (file)
@@ -149,7 +149,7 @@ extern struct cred init_cred;
        },                                                              \
        .rt             = {                                             \
                .run_list       = LIST_HEAD_INIT(tsk.rt.run_list),      \
-               .time_slice     = HZ,                                   \
+               .time_slice     = RR_TIMESLICE,                         \
                .nr_cpus_allowed = NR_CPUS,                             \
        },                                                              \
        .tasks          = LIST_HEAD_INIT(tsk.tasks),                    \
index 5dba2ad524315a6a918eddb6f3e4db3a4658ae6c..eb5de466f09943f89411a16f8ad129ec05eea738 100644 (file)
@@ -1234,6 +1234,12 @@ struct sched_rt_entity {
 #endif
 };
 
+/*
+ * default timeslice is 100 msecs (used only for SCHED_RR tasks).
+ * Timeslices get refilled after they expire.
+ */
+#define RR_TIMESLICE           (100 * HZ / 1000)
+
 struct rcu_node;
 
 enum perf_event_task_context {
index f42ae7fb5ec555a42fe0b63376891aaf8b756af5..f70206c2c802cf29b37d5d48ddd11a50d9155b79 100644 (file)
@@ -1972,7 +1972,7 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued)
        if (--p->rt.time_slice)
                return;
 
-       p->rt.time_slice = DEF_TIMESLICE;
+       p->rt.time_slice = RR_TIMESLICE;
 
        /*
         * Requeue to the end of queue if we are not the only element
@@ -2000,7 +2000,7 @@ static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task)
         * Time slice is 0 for SCHED_FIFO tasks
         */
        if (task->policy == SCHED_RR)
-               return DEF_TIMESLICE;
+               return RR_TIMESLICE;
        else
                return 0;
 }
index 8a2c768d2f9803e76d3310665092fea5d5dedf8f..c0660a1a0cd16c5dfafd4098a360be789cc3a12f 100644 (file)
@@ -36,11 +36,7 @@ extern __read_mostly int scheduler_running;
 
 /*
  * These are the 'tuning knobs' of the scheduler:
- *
- * default timeslice is 100 msecs (used only for SCHED_RR tasks).
- * Timeslices get refilled after they expire.
  */
-#define DEF_TIMESLICE          (100 * HZ / 1000)
 
 /*
  * single value that denotes runtime == period, ie unlimited time.