/[pkg-src]/trunk/kernel26-alx/patches-2.6.20-r6/0014-2.6.20-sched-add-above-background-load-function.patch |
Annotation of /trunk/kernel26-alx/patches-2.6.20-r6/0014-2.6.20-sched-add-above-background-load-function.patch
Parent Directory | Revision Log
Revision 1175 -
(hide annotations)
(download)
Thu Oct 14 12:15:46 2010 UTC (13 years, 11 months ago) by niro
File size: 1360 byte(s)
Thu Oct 14 12:15:46 2010 UTC (13 years, 11 months ago) by niro
File size: 1360 byte(s)
-2.6.20-alx-r6 new magellan 0.5.2 kernel
1 | niro | 1175 | |
2 | From: Con Kolivas <kernel@kolivas.org> | ||
3 | |||
4 | Add an above_background_load() function which can be used by other | ||
5 | subsystems to detect if there is anything besides niced tasks running. | ||
6 | Place it in sched.h to allow it to be compiled out if not used. | ||
7 | |||
8 | Signed-off-by: Con Kolivas <kernel@kolivas.org> | ||
9 | Acked-by: Ingo Molnar <mingo@elte.hu> | ||
10 | Cc: Peter Williams <pwil3058@bigpond.net.au> | ||
11 | Signed-off-by: Andrew Morton <akpm@osdl.org> | ||
12 | --- | ||
13 | |||
14 | include/linux/sched.h | 16 ++++++++++++++++ | ||
15 | 1 file changed, 16 insertions(+) | ||
16 | |||
17 | Index: linux-2.6.20-ck1/include/linux/sched.h | ||
18 | =================================================================== | ||
19 | --- linux-2.6.20-ck1.orig/include/linux/sched.h 2007-02-16 19:01:31.000000000 +1100 | ||
20 | +++ linux-2.6.20-ck1/include/linux/sched.h 2007-02-16 19:01:33.000000000 +1100 | ||
21 | @@ -753,6 +753,22 @@ extern unsigned int max_cache_size; | ||
22 | |||
23 | #endif /* CONFIG_SMP */ | ||
24 | |||
25 | +/* | ||
26 | + * A runqueue laden with a single nice 0 task scores a weighted_cpuload of | ||
27 | + * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a | ||
28 | + * task of nice 0 or enough lower priority tasks to bring up the | ||
29 | + * weighted_cpuload | ||
30 | + */ | ||
31 | +static inline int above_background_load(void) | ||
32 | +{ | ||
33 | + unsigned long cpu; | ||
34 | + | ||
35 | + for_each_online_cpu(cpu) { | ||
36 | + if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE) | ||
37 | + return 1; | ||
38 | + } | ||
39 | + return 0; | ||
40 | +} | ||
41 | |||
42 | struct io_context; /* See blkdev.h */ | ||
43 | struct cpuset; |