aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorCon Kolivas <kernel@kolivas.org>2007-07-26 07:40:43 -0400
committerIngo Molnar <mingo@elte.hu>2007-07-26 07:40:43 -0400
commitd02c7a8cf208eb80a3ccbff40a6bebe8902af35a (patch)
treeb6e2a0393bf917e5e04be955d6c6d5384caa4dfa /include/linux/sched.h
parentb762f3ffb797c1281a38a1c82194534055fba5ec (diff)
[PATCH] sched: add above_background_load() function
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. Unused for now, but it is a useful hint to the IO scheduler and to swap-prefetch. Signed-off-by: Con Kolivas <kernel@kolivas.org> Cc: Peter Williams <pwil3058@bigpond.net.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7a4de8768748..2e490271acf6 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -786,6 +786,22 @@ extern int partition_sched_domains(cpumask_t *partition1,
786 786
787#endif /* CONFIG_SMP */ 787#endif /* CONFIG_SMP */
788 788
789/*
790 * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
791 * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
792 * task of nice 0 or enough lower priority tasks to bring up the
793 * weighted_cpuload
794 */
795static inline int above_background_load(void)
796{
797 unsigned long cpu;
798
799 for_each_online_cpu(cpu) {
800 if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
801 return 1;
802 }
803 return 0;
804}
789 805
790struct io_context; /* See blkdev.h */ 806struct io_context; /* See blkdev.h */
791struct cpuset; 807struct cpuset;