From: Con Kolivas <kernel@kolivas.org>
To: linux list <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
Peter Williams <pwil3058@bigpond.net.au>,
ck list <ck@vds.kolivas.org>
Subject: [PATCH][3/4] sched: add above background load function
Date: Mon, 13 Mar 2006 19:07:59 +1100 [thread overview]
Message-ID: <200603131908.00161.kernel@kolivas.org> (raw)
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>
---
include/linux/sched.h | 16 ++++++++++++++++
1 files changed, 16 insertions(+)
Index: linux-2.6.16-rc6-mm1/include/linux/sched.h
===================================================================
--- linux-2.6.16-rc6-mm1.orig/include/linux/sched.h 2006-03-13 17:05:14.000000000 +1100
+++ linux-2.6.16-rc6-mm1/include/linux/sched.h 2006-03-13 17:24:18.000000000 +1100
@@ -638,6 +638,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);
next reply other threads:[~2006-03-13 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-13 8:07 Con Kolivas [this message]
2006-03-13 9:07 ` [PATCH][3/4] sched: add above background load function Ingo Molnar
2006-03-13 23:14 ` Peter Williams
2006-03-13 23:38 ` Con Kolivas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200603131908.00161.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@osdl.org \
--cc=ck@vds.kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=pwil3058@bigpond.net.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox