All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] per-arch load balancing
@ 2002-08-26 20:04 Robert Love
  2002-08-26 20:11 ` Christoph Hellwig
  2002-08-26 21:22 ` Ingo Molnar
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Love @ 2002-08-26 20:04 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Linus,

The attached patch implements (optional) per-architecture load balancing
so we can cleanly implement specialized load balancing behavior for
NUMA, hyperthreading, etc.

The new method is "arch_load_balance()" and is defined (if available) in
asm/smp_balance.h - otherwise it defines away.  Currently, we call it
from "find_busiest_queue()".

This patch, against current BK, only implements the infrastructure and
not any particular new logic.  This is a similar implementation as found
in 2.4-ac.

Please, apply.

	Robert Love

diff -urN linux-2.5.31/include/linux/smp_balance.h linux/include/linux/smp_balance.h
--- linux-2.5.31/include/linux/smp_balance.h	Wed Dec 31 19:00:00 1969
+++ linux/include/linux/smp_balance.h	Sat Aug 24 22:10:00 2002
@@ -0,0 +1,14 @@
+#ifndef _LINUX_SMP_BALANCE_H
+#define _LINUX_SMP_BALANCE_H
+
+/*
+ * per-architecture load balancing logic, e.g. for hyperthreading
+ */
+
+#ifdef ARCH_HAS_SMP_BALANCE
+#include <asm/smp_balance.h>
+#else
+#define arch_load_balance(x, y)		(0)
+#endif
+
+#endif /* _LINUX_SMP_BALANCE_H */
diff -urN linux-2.5.31/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.31/kernel/sched.c	Sat Aug 10 21:41:24 2002
+++ linux/kernel/sched.c	Sat Aug 24 22:10:00 2002
@@ -630,6 +630,8 @@
 	return nr_running;
 }
 
+#include <linux/smp_balance.h>
+
 /*
  * find_busiest_queue - find the busiest runqueue.
  */
@@ -639,6 +641,12 @@
 	runqueue_t *busiest, *rq_src;
 
 	/*
+	 * Handle architecture-specific balancing, such as hyperthreading.
+	 */
+	if (arch_load_balance(this_cpu, idle))
+		return NULL;
+
+	/*
 	 * We search all runqueues to find the most busy one.
 	 * We do this lockless to reduce cache-bouncing overhead,
 	 * we re-check the 'best' source CPU later on again, with




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] per-arch load balancing
  2002-08-26 20:04 [PATCH] per-arch load balancing Robert Love
@ 2002-08-26 20:11 ` Christoph Hellwig
  2002-08-26 20:27   ` Robert Love
  2002-08-26 21:22 ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2002-08-26 20:11 UTC (permalink / raw)
  To: Robert Love; +Cc: torvalds, linux-kernel

On Mon, Aug 26, 2002 at 04:04:43PM -0400, Robert Love wrote:
> Linus,
> 
> The attached patch implements (optional) per-architecture load balancing
> so we can cleanly implement specialized load balancing behavior for
> NUMA, hyperthreading, etc.
> 
> The new method is "arch_load_balance()" and is defined (if available) in
> asm/smp_balance.h - otherwise it defines away.  Currently, we call it
> from "find_busiest_queue()".

Can we have a asm/sched.h instead?  especially if we might add additional
per-arch scheduler bits.  Also I think a asm-generic version is better than
linux/smp_balance.h + the ARCH_HAS_SMP_BALANCE hack.  I'd prefer if you
would move the #include ontop ot sched.c, too - includes in the middle of
a file are really messy.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] per-arch load balancing
  2002-08-26 20:11 ` Christoph Hellwig
@ 2002-08-26 20:27   ` Robert Love
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Love @ 2002-08-26 20:27 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: torvalds, linux-kernel

On Mon, 2002-08-26 at 16:11, Christoph Hellwig wrote:

> Can we have a asm/sched.h instead?  especially if we might add additional
> per-arch scheduler bits.  Also I think a asm-generic version is better than
> linux/smp_balance.h + the ARCH_HAS_SMP_BALANCE hack.  I'd prefer if you
> would move the #include ontop ot sched.c, too - includes in the middle of
> a file are really messy.

These are all good ideas.  Here we go again:

This patch implements per-arch scheduler support with specific support
(currently) for per-arch load balancing.  We implement an
asm-generic/sched.h with default methods.  Each architecture needs to
define its own asm/sched.h but by default it would just include
asm-generic/sched.h.

Better?

	Robert Love

diff -urN linux-2.5.31/include/asm-generic/sched.h linux/include/asm-generic/sched.h
--- linux-2.5.31/include/asm-generic/sched.h	Wed Dec 31 19:00:00 1969
+++ linux/include/asm-generic/sched.h	Mon Aug 26 16:20:50 2002
@@ -0,0 +1,14 @@
+#ifndef _LINUX_SCHED_H
+#define _LINUX_SCHED_H
+
+/*
+ * include/asm-generic/sched.h - generic and default versions of per-arch
+ * scheduler bits
+ */
+
+/*
+ * per-architecture load balancing logic, e.g. for hyperthreading
+ */
+#define arch_load_balance(x, y)		(0)
+
+#endif /* _LINUX_SCHED_H */
diff -urN linux-2.5.31/include/asm-i386/sched.h linux/include/asm-i386/sched.h
--- linux-2.5.31/include/asm-i386/sched.h	Wed Dec 31 19:00:00 1969
+++ linux/include/asm-i386/sched.h	Mon Aug 26 16:22:33 2002
@@ -0,0 +1,7 @@
+#ifndef _I386_SCHED_H
+#define _I386_SCHED_H
+
+/* nothing to see here, move along */
+#include <asm-generic/sched.h>
+
+#endif /* _I386_SCHED_H */
diff -urN linux-2.5.31/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.31/kernel/sched.c	Sat Aug 10 21:41:24 2002
+++ linux/kernel/sched.c	Mon Aug 26 16:21:35 2002
@@ -29,6 +29,7 @@
 #include <linux/security.h>
 #include <linux/notifier.h>
 #include <linux/delay.h>
+#include <asm/sched.h>
 
 /*
  * Convert user-nice values [ -20 ... 0 ... 19 ]
@@ -639,6 +640,12 @@
 	runqueue_t *busiest, *rq_src;
 
 	/*
+	 * Handle architecture-specific balancing, such as hyperthreading.
+	 */
+	if (arch_load_balance(this_cpu, idle))
+		return NULL;
+
+	/*
 	 * We search all runqueues to find the most busy one.
 	 * We do this lockless to reduce cache-bouncing overhead,
 	 * we re-check the 'best' source CPU later on again, with


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] per-arch load balancing
  2002-08-26 20:04 [PATCH] per-arch load balancing Robert Love
  2002-08-26 20:11 ` Christoph Hellwig
@ 2002-08-26 21:22 ` Ingo Molnar
  1 sibling, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2002-08-26 21:22 UTC (permalink / raw)
  To: Robert Love; +Cc: torvalds, linux-kernel


On 26 Aug 2002, Robert Love wrote:

> The attached patch implements (optional) per-architecture load balancing
> so we can cleanly implement specialized load balancing behavior for
> NUMA, hyperthreading, etc.

nope, this is not the right approach, at least not for hyperthreading -
i've got a generic approach in my tree, will post a patch soon (tm).

> Please, apply.

please dont ...

	Ingo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-26 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-26 20:04 [PATCH] per-arch load balancing Robert Love
2002-08-26 20:11 ` Christoph Hellwig
2002-08-26 20:27   ` Robert Love
2002-08-26 21:22 ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.