Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.21-r1/0007-2.6.21-sched-limit_policy_changes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 196 - (show annotations) (download)
Thu May 17 23:20:52 2007 UTC (16 years, 11 months ago) by niro
File size: 1532 byte(s)
-ver bump to 2.6.21-r1 using:
-linux-2.6.21.1
-2.6.21-ck2 patchset
-fbsplash-0.9.2-r5
-vesafb-tng-1.0-rc2
-squashfs-3.2-r2
-unionfs-2.0-u2
-suspend2-2.2.9.17
-linux-phc-0.2.10
-acpi-dsdt-0.8.4
-fuse-2.6.5
-reiser4-mm
-nvidia-drivers-1.0.9755
-ati-drivers-8.36.5
-ipw3945-1.2.1
- added a fix for sis900 oops on linux-2.6.21

1 Many applications explicitly set SCHED_NORMAL on threads thus undoing the
2 usefulness of the SCHED_ISO, SCHED_BATCH and SCHED_IDLEPRIO policies.
3
4 For unprivileged users:
5
6 Only allow non realtime policies to be downgraded from ISO->BATCH->IDLEPRIO
7 but not back to NORMAL.
8
9 Signed-off-by: Con Kolivas <kernel@kolivas.org>
10
11 ---
12 kernel/sched.c | 26 ++++++++++++++++++++++++++
13 1 file changed, 26 insertions(+)
14
15 Index: linux-2.6.21-ck2/kernel/sched.c
16 ===================================================================
17 --- linux-2.6.21-ck2.orig/kernel/sched.c 2007-05-14 19:30:31.000000000 +1000
18 +++ linux-2.6.21-ck2/kernel/sched.c 2007-05-14 19:30:31.000000000 +1000
19 @@ -4295,6 +4295,31 @@ recheck:
20 if (param->sched_priority > p->rt_priority &&
21 param->sched_priority > rlim_rtprio)
22 return -EPERM;
23 + } else {
24 + switch (p->policy) {
25 + /*
26 + * Can only downgrade policies but not back to
27 + * SCHED_NORMAL
28 + */
29 + case SCHED_ISO:
30 + if (policy == SCHED_ISO)
31 + goto out;
32 + if (policy == SCHED_NORMAL)
33 + return -EPERM;
34 + break;
35 + case SCHED_BATCH:
36 + if (policy == SCHED_BATCH)
37 + goto out;
38 + if (policy != SCHED_IDLEPRIO)
39 + return -EPERM;
40 + break;
41 + case SCHED_IDLEPRIO:
42 + if (policy == SCHED_IDLEPRIO)
43 + goto out;
44 + return -EPERM;
45 + default:
46 + break;
47 + }
48 }
49
50 /* can't change other user's priorities */
51 @@ -4351,6 +4376,7 @@ recheck:
52
53 rt_mutex_adjust_pi(p);
54
55 +out:
56 return 0;
57 }
58 EXPORT_SYMBOL_GPL(sched_setscheduler);