From: Alexey Dobriyan on
On Thu, Mar 11, 2010 at 11:56:22PM +0900, Tejun Heo wrote:
> Lee Schermerhorn was trying to use percpu from slab.h and ran into a
> dependency loop. percpu.h was using slab.h for UP inline
> implementation which isn't a big deal in itself but it turns out that
> percpu.h ends up being included everywhere via module.h and sched.h.
> So, removing that implicit inclusion breaks a lot of files.
>
> The following git tree contains trial conversion on x86_64.
> allmodconfig builds fine on it but a lot of other archs are likely to
> break although fixing them up shouldn't be too hard.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git review-remove-implied-slab-inclusion
>
> This can be solved much easier by moving some of the stuff that's
> necessary for slab.h from percpu.h into percpu-defs.h which originally
> got separated so that it can be used by asm/percpu.h but it's hackish
> and for longer term, it would be better to have slab.h explicitly
> included where necessary.
>
> So, what do you guys think? Probably-the-right-thing-to-do >544 file
> patch or somewhat-ugly-but-let's-worry-about-it-tommorrow two file
> patch?

You can include slab.h only for UP case.

Since everyone tests on allmodconfig which has SMP=y, configuration
will be more strict wrt headers, and compile breakages amount
negligible.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on
Hello,

On 03/12/2010 02:48 AM, Alexey Dobriyan wrote:
>> So, what do you guys think? Probably-the-right-thing-to-do >544 file
>> patch or somewhat-ugly-but-let's-worry-about-it-tommorrow two file
>> patch?
>
> You can include slab.h only for UP case.
>
> Since everyone tests on allmodconfig which has SMP=y, configuration
> will be more strict wrt headers, and compile breakages amount
> negligible.

But that wouldn't change anything about having to do an oneshot huge
change, right? And, if we're gonna do that anyway, I think it would
be better to remove the implicit dependency for UP case too so that
for example slab.h in this case doesn't have to do ifdef on CONFIG_SMP
before using percpu accessors.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on
On 03/11/2010 11:56 PM, Tejun Heo wrote:
> So, what do you guys think? Probably-the-right-thing-to-do >544 file
> patch or somewhat-ugly-but-let's-worry-about-it-tommorrow two file
> patch?

Ping, any opinions?

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on
Hello, Ingo.

On 03/16/2010 03:17 PM, Ingo Molnar wrote:
> ( /me mumbles something about not having a patch in the email to review and
> pulling the tree. 200k patch is just fine for lkml - i've attached it below
> for easier review. percpu.h and percpu.c has the meat of the changes. )

I wanted to keep the discussion high level while giving a general idea
about the extent of necessary changes. I'll include the patch from
now on.

> i like the dependency reduction. Noticed one small detail:
>
> this new 2000-lines #ifdef block percpu.c:
>
> +#ifdef CONFIG_SMP
> +#else /* CONFIG_SMP */
> +#endif /* CONFIG_SMP */
>
> feels a bit lame. A separate percpu_up.c file would be nicer i suppose?

Sure.

> Also, why should we make this opt-in and expose a wide range of configs to
> build breakages? A more gradual approach would be to write a simple script
> that adds a slab.h include to all .c's that include percpu.h, directly or
> indirectly.
>
> You can map the pattern experimentally: the insertion pattern could be built
> from the x86 allmodconfig build you did [i.e. extend the pattern until you
> make it build on allmodconfig] - that would cover most cases in practice (not
> just allmodconfig) - and would cover most architectures as well.

I don't really get the 'experimental' part but if I count all the
files which ends up including percpu.h directly or indirectly on
allmodconfig it ends up including much more .c files than necessasry -
11203 to be exact, ~20 times more than necessary. Inclusions from .c
files definitely are much less troublesome so the situation would be
better than now but we'll still end up with a LOT of bogus inclusions
without any good way to eventually remove them.

Maybe a better way is to grab for slab API usages in .c files which
don't have slab.h inclusion. If breaking the dependency is the way to
go, I can definitely write up some scripts and do test builds on some
archs. There sure will be some fallouts but I think it won't be too
bad.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Pekka Enberg on
On Tue, Mar 16, 2010 at 8:17 AM, Ingo Molnar <mingo(a)elte.hu> wrote:
> Also, why should we make this opt-in and expose a wide range of configs to
> build breakages? A more gradual approach would be to write a simple script
> that adds a slab.h include to all .c's that include percpu.h, directly or
> indirectly.

I am all for untangling the #include mess in slab.h and friends and I
think Ingo's suggestion is probably the best way forward. We should
avoid creating tree-wide breakage for this kind of cleanups.

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