Re: [RFC] Simple NUMA scheduler patch

Matthew Dobson (colpatch@us.ibm.com)
Wed, 02 Oct 2002 11:56:54 -0700


Christoph Hellwig wrote:
> On Tue, Oct 01, 2002 at 04:55:35PM -0700, Michael Hohnbaum wrote:
>>--- clean-2.5.40/kernel/sched.c Tue Oct 1 13:48:34 2002
>>+++ linux-2.5.40/kernel/sched.c Tue Oct 1 13:27:46 2002
>>@@ -30,6 +30,9 @@
>> #include <linux/notifier.h>
>> #include <linux/delay.h>
>> #include <linux/timer.h>
>>+#if CONFIG_NUMA
>>+#include <asm/topology.h>
>>+#endif
>
> Please make this inlcude unconditional, okay?
Agreed... The topology macros are designed to work for *any*
architecture, so there's no need to selectively include them.

>>+/*
>>+ * find_busiest_queue - find the busiest runqueue.
>>+ */
>>+static inline runqueue_t *find_busiest_queue(runqueue_t *this_rq, int this_cpu, int idle, int *imbalance)
>>+{
>>+ int nr_running, load, max_load_on_node, max_load_off_node, i;
>>+ runqueue_t *busiest, *busiest_on_node, *busiest_off_node, *rq_src;
>
> You're new find_busiest_queue is to 80 or 90% the same as the non-NUMA one.
> At least add the #ifdefs only where needed, but as cpu_to_node() optimizes
> away for the non-NUMA case I think you could just make it unconditional.
Looking over the code... I think I agree with Christoph here. I think
that most of the new code won't even get touched in the non-NUMA case.
Of course, let me know if I'm wrong! ;)

>>+ if (__cpu_to_node(i) == __cpu_to_node(this_cpu)) {
>
> I think it should be cpu_to_node, not __cpu_to_node.
Actually, the non-double-underbar versions are not in the kernel... I
have a patch for them, though... They just do some simple bound/error
checking as wrappers around the double-underbar versions. As long as
you aren't calling the macros with bizarre values (ie 0<=i<=NR_CPUS),
the double-underbar versions will work just fine, and will be mildly
quicker.

Other than that, it looks good to me!

Cheers!

-Matt

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/