Magellan Linux

Annotation of /trunk/kernel26-magellan/patches-2.6.20-r5/0014-2.6.20-sched-add-above-background-load-function.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 133 - (hide annotations) (download)
Fri Apr 27 15:25:13 2007 UTC (17 years, 1 month ago) by niro
File size: 1360 byte(s)
files for 2.6.20-r5

1 niro 133
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;