* [PATCH]add an ifdef in sched.c
@ 2004-11-05 12:02 andyliu
2004-11-05 12:06 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: andyliu @ 2004-11-05 12:02 UTC (permalink / raw)
To: linux-kernel; +Cc: mingo, akpm
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]add an ifdef in sched.c
2004-11-05 12:02 [PATCH]add an ifdef in sched.c andyliu
@ 2004-11-05 12:06 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2004-11-05 12:06 UTC (permalink / raw)
To: andyliu; +Cc: linux-kernel, akpm
* andyliu <liudeyan@gmail.com> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-05 12:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-05 12:02 [PATCH]add an ifdef in sched.c andyliu
2004-11-05 12:06 ` 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.