From: Ingo Molnar <mingo@elte.hu>
To: Jeff Garzik <jeff@garzik.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
LKML <linux-kernel@vger.kernel.org>,
viro@zeniv.linux.org.uk,
Andrew Morton <akpm@linux-foundation.org>,
roland@redhat.com
Subject: Re: [PATCH 1/2] kernel/{sched,smp}.c: fix static decl prior to struct declaration
Date: Fri, 8 May 2009 21:13:55 +0200 [thread overview]
Message-ID: <20090508191355.GC12130@elte.hu> (raw)
In-Reply-To: <4A04833B.1010209@garzik.org>
* Jeff Garzik <jeff@garzik.org> wrote:
> Ingo Molnar wrote:
>> * Jeff Garzik <jeff@garzik.org> wrote:
>>
>>> According to C99 6.9.2p3, any declaration "static struct foo my_foo;"
>>> must follow the definition of struct foo.
>>>
>>> Apparently, gcc's lack of warning is a bug.
>>>
>>> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
>>
>> good spotting, i'll apply this fix, but:
>>
>>> */
>>> struct task_group root_task_group;
>>> -#ifdef CONFIG_FAIR_GROUP_SCHED
>>> -/* Default task group's sched entity on each cpu */
>>> -static DEFINE_PER_CPU(struct sched_entity, init_sched_entity);
>>> -/* Default task group's cfs_rq on each cpu */
>>> -static DEFINE_PER_CPU(struct cfs_rq, init_cfs_rq) ____cacheline_aligned_in_smp;
>>> -#endif /* CONFIG_FAIR_GROUP_SCHED */
>>> -
>>> -#ifdef CONFIG_RT_GROUP_SCHED
>>> -static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity);
>>> -static DEFINE_PER_CPU(struct rt_rq, init_rt_rq) ____cacheline_aligned_in_smp;
>>> -#endif /* CONFIG_RT_GROUP_SCHED */
>>> -#else /* !CONFIG_USER_SCHED */
>>> -#define root_task_group init_task_group
>>> -#endif /* CONFIG_USER_SCHED */
>>> -
>>> /* task_group_lock serializes add/remove of task groups and also changes to
>>
>> This block has a visible imbalance of preprocessor directives -
>> there's a #else you moved, without moving the outermost #ifdef. My
>> guess is that this will go down in a fireball with CONFIG_GROUP_SCHED
>> disabled?
>
> It seems you are correct, I missed it in my 'allmodconfig' and
> 'jeffs hw config' builds.
>
> Are you fixing this up, or should I regen the patch?
Please resend it. That area of the code is a bit of an #ifdef maze,
hard to move around. (And i'd rather let you mess it up than mess it
up myself - then i can blame it on you and bounce it back to you for
fixing ;-)
Also, a style cleanup there might help a bit: adding a bit more
geometric structure to the #ifdefs there might make the hierarchy
stand out a bit more:
# ifdef CONFIG_RT_GROUP_SCHED
static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity);
static DEFINE_PER_CPU(struct rt_rq, init_rt_rq) ____cacheline_aligned_in_smp;
# endif /* CONFIG_RT_GROUP_SCHED */
#else /* !CONFIG_USER_SCHED */
# define root_task_group init_task_group
#endif /* CONFIG_USER_SCHED */
in such a lineup it's more apparent at a glance when a piece of code
gets snatched in an incomplete way.
Thanks,
Ingo
next prev parent reply other threads:[~2009-05-08 19:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 18:48 [PATCH 1/2] kernel/{sched,smp}.c: fix static decl prior to struct declaration Jeff Garzik
2009-05-08 18:50 ` [RFC PATCH 2/2] kernel/sched.c: VLA in middle of struct Jeff Garzik
2009-05-08 19:09 ` Ingo Molnar
2009-05-10 8:49 ` Rusty Russell
2009-05-10 15:09 ` Jeff Garzik
2009-05-12 13:34 ` Rusty Russell
2009-05-12 14:03 ` Al Viro
2009-05-13 2:12 ` Rusty Russell
2009-05-13 2:31 ` Jeff Garzik
2009-05-13 5:36 ` Al Viro
2009-05-13 6:49 ` [PATCH] sched: avoid flexible array member inside struct (gcc extension) Rusty Russell
2009-05-13 13:51 ` [tip:sched/urgent] " tip-bot for Rusty Russell
2009-05-11 10:58 ` [RFC PATCH 2/2] kernel/sched.c: VLA in middle of struct Ingo Molnar
2009-05-11 20:43 ` Jeff Garzik
2009-05-11 20:49 ` Ingo Molnar
2009-05-12 2:24 ` Jeff Garzik
2009-05-12 8:54 ` Ingo Molnar
2009-05-08 19:04 ` [PATCH 1/2] kernel/{sched,smp}.c: fix static decl prior to struct declaration Ingo Molnar
2009-05-08 19:08 ` Jeff Garzik
2009-05-08 19:13 ` Ingo Molnar [this message]
2009-05-08 19:38 ` [PATCH 1/2 v2] " Jeff Garzik
2009-05-11 11:26 ` Ingo Molnar
2009-05-11 20:06 ` Jeff Garzik
2009-05-11 20:51 ` Ingo Molnar
2009-05-11 11:30 ` [tip:sched/core] kernel/{sched, smp}.c: " tip-bot for Jeff Garzik
2009-05-11 20:02 ` [PATCH 1/2 v3] kernel/{sched,smp}.c: " Jeff Garzik
2009-05-11 21:51 ` [tip:sched/urgent] kernel/{sched, smp}.c: " tip-bot for Jeff Garzik
2009-05-11 21:56 ` Ingo Molnar
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=20090508191355.GC12130@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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