* [ckpatch][16/29] sched-add-above-background-load-function.patch
@ 2006-06-18 7:33 Con Kolivas
0 siblings, 0 replies; only message in thread
From: Con Kolivas @ 2006-06-18 7:33 UTC (permalink / raw)
To: linux list; +Cc: ck list
From: Con Kolivas <kernel@kolivas.org>
Add an above_background_load() function which can be used by other
subsystems to detect if there is anything besides niced tasks running.
Place it in sched.h to allow it to be compiled out if not used.
Signed-off-by: Con Kolivas <kernel@kolivas.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Peter Williams <pwil3058@bigpond.net.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
include/linux/sched.h | 16 ++++++++++++++++
1 files changed, 16 insertions(+)
Index: linux-ck-dev/include/linux/sched.h
===================================================================
--- linux-ck-dev.orig/include/linux/sched.h 2006-06-18 15:23:46.000000000 +1000
+++ linux-ck-dev/include/linux/sched.h 2006-06-18 15:24:45.000000000 +1000
@@ -653,6 +653,22 @@ extern unsigned int max_cache_size;
#endif /* CONFIG_SMP */
+/*
+ * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
+ * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
+ * task of nice 0 or enough lower priority tasks to bring up the
+ * weighted_cpuload
+ */
+static inline int above_background_load(void)
+{
+ unsigned long cpu;
+
+ for_each_online_cpu(cpu) {
+ if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
+ return 1;
+ }
+ return 0;
+}
struct io_context; /* See blkdev.h */
void exit_io_context(void);
--
-ck
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-06-18 7:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-18 7:33 [ckpatch][16/29] sched-add-above-background-load-function.patch Con Kolivas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox