Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d02c7a8cf208eb80a3ccbff40a6bebe8902af35a
Commit:     d02c7a8cf208eb80a3ccbff40a6bebe8902af35a
Parent:     b762f3ffb797c1281a38a1c82194534055fba5ec
Author:     Con Kolivas <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 26 13:40:43 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Thu Jul 26 13:40:43 2007 +0200

    [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 <[EMAIL PROTECTED]>
    Cc: Peter Williams <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 include/linux/sched.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7a4de87..2e49027 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -786,6 +786,22 @@ extern int partition_sched_domains(cpumask_t *partition1,
 
 #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 */
 struct cpuset;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to