Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.20-r6/0004-2.6.20-sched-range.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1175 - (show annotations) (download)
Thu Oct 14 12:15:46 2010 UTC (13 years, 6 months ago) by niro
File size: 1724 byte(s)
-2.6.20-alx-r6 new magellan 0.5.2 kernel
1 Add SCHED_RANGE and SCHED_RT wrappers for easy policy management.
2
3 Signed-off-by: Con Kolivas <kernel@kolivas.org>
4
5 include/linux/sched.h | 6 +++++-
6 kernel/sched.c | 3 +--
7 2 files changed, 6 insertions(+), 3 deletions(-)
8
9 Index: linux-2.6.20-ck1/include/linux/sched.h
10 ===================================================================
11 --- linux-2.6.20-ck1.orig/include/linux/sched.h 2007-02-16 19:01:30.000000000 +1100
12 +++ linux-2.6.20-ck1/include/linux/sched.h 2007-02-16 19:01:30.000000000 +1100
13 @@ -37,6 +37,9 @@
14
15 #ifdef __KERNEL__
16
17 +#define SCHED_MAX SCHED_BATCH
18 +#define SCHED_RANGE(policy) ((policy) <= SCHED_MAX)
19 +
20 struct sched_param {
21 int sched_priority;
22 };
23 @@ -530,7 +533,8 @@ struct signal_struct {
24 #define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO)
25 #define rt_task(p) rt_prio((p)->prio)
26 #define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
27 -#define is_rt_policy(p) ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
28 +#define is_rt_policy(policy) ((policy) == SCHED_FIFO || \
29 + (policy) == SCHED_RR)
30 #define has_rt_policy(p) unlikely(is_rt_policy((p)->policy))
31
32 /*
33 Index: linux-2.6.20-ck1/kernel/sched.c
34 ===================================================================
35 --- linux-2.6.20-ck1.orig/kernel/sched.c 2007-02-16 19:01:30.000000000 +1100
36 +++ linux-2.6.20-ck1/kernel/sched.c 2007-02-16 19:01:30.000000000 +1100
37 @@ -3981,8 +3981,7 @@ recheck:
38 /* double check policy once rq lock held */
39 if (policy < 0)
40 policy = oldpolicy = p->policy;
41 - else if (policy != SCHED_FIFO && policy != SCHED_RR &&
42 - policy != SCHED_NORMAL && policy != SCHED_BATCH)
43 + else if (!SCHED_RANGE(policy))
44 return -EINVAL;
45 /*
46 * Valid priorities for SCHED_FIFO and SCHED_RR are