diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2012-02-16 00:52:21 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-02-22 06:28:29 -0500 |
commit | de5bdff7a72acc281219be2b8edeeca1fd81c542 (patch) | |
tree | 6a528beb1852e2fd7d444b47e8b4cc6e6be31108 | |
parent | 62f6536a630affe3176deb48554d27ee58b65077 (diff) |
sched: Make initial SCHED_RR timeslace DEF_TIMESLICE
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>
-rw-r--r-- | include/linux/init_task.h | 2 | ||||
-rw-r--r-- | include/linux/sched.h | 6 | ||||
-rw-r--r-- | kernel/sched/rt.c | 4 | ||||
-rw-r--r-- | kernel/sched/sched.h | 4 |
4 files changed, 9 insertions, 7 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9c66b1ada9d7..f994d51f70f2 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -149,7 +149,7 @@ extern struct cred init_cred; | |||
149 | }, \ | 149 | }, \ |
150 | .rt = { \ | 150 | .rt = { \ |
151 | .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ | 151 | .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ |
152 | .time_slice = HZ, \ | 152 | .time_slice = RR_TIMESLICE, \ |
153 | .nr_cpus_allowed = NR_CPUS, \ | 153 | .nr_cpus_allowed = NR_CPUS, \ |
154 | }, \ | 154 | }, \ |
155 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ | 155 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5dba2ad52431..eb5de466f099 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1234,6 +1234,12 @@ struct sched_rt_entity { | |||
1234 | #endif | 1234 | #endif |
1235 | }; | 1235 | }; |
1236 | 1236 | ||
1237 | /* | ||
1238 | * default timeslice is 100 msecs (used only for SCHED_RR tasks). | ||
1239 | * Timeslices get refilled after they expire. | ||
1240 | */ | ||
1241 | #define RR_TIMESLICE (100 * HZ / 1000) | ||
1242 | |||
1237 | struct rcu_node; | 1243 | struct rcu_node; |
1238 | 1244 | ||
1239 | enum perf_event_task_context { | 1245 | enum perf_event_task_context { |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index f42ae7fb5ec5..f70206c2c802 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -1972,7 +1972,7 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued) | |||
1972 | if (--p->rt.time_slice) | 1972 | if (--p->rt.time_slice) |
1973 | return; | 1973 | return; |
1974 | 1974 | ||
1975 | p->rt.time_slice = DEF_TIMESLICE; | 1975 | p->rt.time_slice = RR_TIMESLICE; |
1976 | 1976 | ||
1977 | /* | 1977 | /* |
1978 | * Requeue to the end of queue if we are not the only element | 1978 | * 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) | |||
2000 | * Time slice is 0 for SCHED_FIFO tasks | 2000 | * Time slice is 0 for SCHED_FIFO tasks |
2001 | */ | 2001 | */ |
2002 | if (task->policy == SCHED_RR) | 2002 | if (task->policy == SCHED_RR) |
2003 | return DEF_TIMESLICE; | 2003 | return RR_TIMESLICE; |
2004 | else | 2004 | else |
2005 | return 0; | 2005 | return 0; |
2006 | } | 2006 | } |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 8a2c768d2f98..c0660a1a0cd1 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -36,11 +36,7 @@ extern __read_mostly int scheduler_running; | |||
36 | 36 | ||
37 | /* | 37 | /* |
38 | * These are the 'tuning knobs' of the scheduler: | 38 | * These are the 'tuning knobs' of the scheduler: |
39 | * | ||
40 | * default timeslice is 100 msecs (used only for SCHED_RR tasks). | ||
41 | * Timeslices get refilled after they expire. | ||
42 | */ | 39 | */ |
43 | #define DEF_TIMESLICE (100 * HZ / 1000) | ||
44 | 40 | ||
45 | /* | 41 | /* |
46 | * single value that denotes runtime == period, ie unlimited time. | 42 | * single value that denotes runtime == period, ie unlimited time. |