2004-11-05 12:02:11

by Andyliu

[permalink] [raw]
Subject: [PATCH]add an ifdef in sched.c

hi

I have found that in sched.c. the macro for_each_domain only useful
for the config
that has CONFIG_SMP defined. so i add an ifdef in sched.c.

below is the patch

--- linux-2.6.10-rc1/kernel/sched.c 2004-10-23 05:40:05.000000000 +0800
+++ linux-2.6.10-rc1-new/kernel/sched.c 2004-11-04 16:34:55.000000000 +0800
@@ -281,8 +281,10 @@

static DEFINE_PER_CPU(struct runqueue, runqueues);

-#define for_each_domain(cpu, domain) \
+#ifdef CONFIG_SMP
+# define for_each_domain(cpu, domain) \
for (domain = cpu_rq(cpu)->sd; domain; domain = domain->parent)
+#endif

#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
#define this_rq() (&__get_cpu_var(runqueues))




thanks for reading.
--
Yours andyliu


2004-11-05 12:05:49

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH]add an ifdef in sched.c


* andyliu <[email protected]> wrote:

> -#define for_each_domain(cpu, domain) \
> +#ifdef CONFIG_SMP
> +# define for_each_domain(cpu, domain) \
> for (domain = cpu_rq(cpu)->sd; domain; domain = domain->parent)
> +#endif

why? A macro hanging around does not cause any bigger code - and the
#ifdef certainly makes the code less readable.

Ingo