Magellan Linux

Annotation of /trunk/kernel26-alx/patches-2.6.17-r5/0016-2.6.17-sched-add-above-background-load-function.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 199 - (hide annotations) (download)
Fri May 18 11:04:36 2007 UTC (17 years ago) by niro
File size: 1362 byte(s)
-import

1 niro 199
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 files changed, 16 insertions(+)
16    
17     Index: linux-ck-dev/include/linux/sched.h
18     ===================================================================
19     --- linux-ck-dev.orig/include/linux/sched.h 2006-06-18 15:23:46.000000000 +1000
20     +++ linux-ck-dev/include/linux/sched.h 2006-06-18 15:24:45.000000000 +1000
21     @@ -653,6 +653,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     void exit_io_context(void);