2006-10-17 00:50:27

by Al Viro

[permalink] [raw]
Subject: [RFC] typechecking for get_unaligned/put_unaligned

What kind of typechecking do we want for those?

AFAICS, current constraints are
* {put,get}_unaligned() should be passed a pointer to object; void *
is not acceptable
* sizeof(*ptr) should be one of 1, 2, 4, 8
* assignment of val to *ptr should be valid C.

Questions:
a) do we want all of the above to be enforced on all targets?
b) do we really want to allow use of that when sizeof(*ptr) is 1?
It's almost certainly a sloppy code (and I don't see any instances in
the tree), but I might be missing some potentially valid use in macros.
c) how about gradually switching to linux/unaligned.h? In this
case we can do it nicely; start with mutual #include in asm/unaligned.h
and linux/unaligned.h (in the beginning of each), then switch users
and once they'd been all gone for a while, have asm/unaligned.h contain
#ifndef __LINUX_UNALGINED_H__
#error include linux/unaligned.h instead
#endif
instead of
#include <linux/unaligned.h>
d) any objections to having asm/unaligned.h defining
__{get,put}_unaligned{2,4,8} and linux/unaligned.h doing __builtin_choose_expr()
to pick the right one? AFAICS, that should not have any bad effects on the
generated code and it would allow to put all typechecking in one place.
Helpers in question would take pointers to u{16,32,64} and value of the
same type. Even the targets doing a simple assignment in all cases would
get the same code generated, AFAICS...


2006-10-17 01:51:09

by Linus Torvalds

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned



On Tue, 17 Oct 2006, Al Viro wrote:
>
> What kind of typechecking do we want for those?
>
> AFAICS, current constraints are
> * {put,get}_unaligned() should be passed a pointer to object; void *
> is not acceptable
> * sizeof(*ptr) should be one of 1, 2, 4, 8
> * assignment of val to *ptr should be valid C.

Have we ever really had any problems with this?

I think that as far as typing, we should just make sure that
[get|put]_unaligned() has the same behaviour as a dereference. Sure,
checking the size might be worth it, but it doesn't sound like we'd
actually find any real bugs (ie wrong sizes should just result in compile
or link errors on architectures where you need special code for it).

> c) how about gradually switching to linux/unaligned.h?

I'd prefer not to, if only because it's an unnecessary compile-time
overhead for nice sane architectures like x86, which don't need any of the
unaligned crap.

Since x86[-64] is clearly the main architecture, dis-optimizing for that
one sounds like a bad idea.

Linus

2006-10-17 04:37:28

by Al Viro

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned

On Mon, Oct 16, 2006 at 06:50:54PM -0700, Linus Torvalds wrote:

> > c) how about gradually switching to linux/unaligned.h?
>
> I'd prefer not to, if only because it's an unnecessary compile-time
> overhead for nice sane architectures like x86, which don't need any of the
> unaligned crap.
>
> Since x86[-64] is clearly the main architecture, dis-optimizing for that
> one sounds like a bad idea.

Hrm... I'm not sure that I buy that argument - we have relatively few
callers of these suckers and I doubt that it will affect compile time
in a measurable way. FWIW, that reminds me - I ought to resurrect the
patchset killing bogus dependencies; I modified sparse to collect stats
on how many times each #include actually pulls a header during build,
added those to data on dependencies (from .cmd.*) and got interesting results.

There are several #includes with very high impact; the worst happens
to be module.h -> sched.h, followed by several includes of fs.h. These
turned out to be easy to kill (i.e. few places actually needed compensatory
#include added) and that had seriously cut down on total dependencies.
The patches will need to be redone due to bitrot, but they are not
hard to reproduce. The really interesting observation is that such
high-impact includes exist and can be found by this technics...

As for get_unaligned() and friends... Dunno. The thing is, most of
the targets have them with piss-poor type safety (e.g. asm-generic
put_unaligned() starts with casting val to __u64; there goes any chance
to get any useful warnings from cc(1) *and* we get fun warnings from
sparse every bloody time we use it on __be32, etc.).

I can fix those one by one, but I still think that it would be better
to keep the typechecking in one place...

PS: while a few hundreds of callers per allmodconfig build are minor noise
in compile time, the noise from a few hundreds of bogus warnings is
quite considerable ;-)

2006-10-17 09:04:42

by David Howells

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned

Al Viro <[email protected]> wrote:

> * sizeof(*ptr) should be one of 1, 2, 4, 8

Should we give an error if someone tries passing a 1-byte-sized memory location
to get/put_unaligned()? I suspect it might be best to reduce to a trivial
direct assignment in that case.

David

2006-10-17 15:13:52

by Ray Lehtiniemi

[permalink] [raw]
Subject: Bogus deps checking (was Re: [RFC] typechecking for get_unaligned/put_unaligned)

On Monday 16 October 2006 22:37, Al Viro wrote:
> FWIW, that reminds me - I ought to resurrect the
> patchset killing bogus dependencies; I modified sparse to collect stats
> on how many times each #include actually pulls a header during build,
> added those to data on dependencies (from .cmd.*) and got interesting
> results.

are these modifications publically available? i would be interested to see
them. i've been grovelling over the header files with perl...


> There are several #includes with very high impact; the worst happens
> to be module.h -> sched.h, followed by several includes of fs.h. These
> turned out to be easy to kill (i.e. few places actually needed compensatory
> #include added) and that had seriously cut down on total dependencies.
> The patches will need to be redone due to bitrot, but they are not
> hard to reproduce. The really interesting observation is that such
> high-impact includes exist and can be found by this technics...

i noticed another potential source of unneccessary dependencies:
<linux/prefetch.h> includes <asm/processor.h> for a total of ~49
dependencies. it appears that the prefetch() concept could be moved into a
separate <asm/prefetch.h> file with much smaller dependency footprint, for a
pretty hefty reduction in total dependencies throughout the system.

another potential win: a good chunk of <linux/kernel.h> (which has ~24
dependencies) actually has nothing to do with the kernel per se. i'm
thinking of basic C language idioms (container_of(), typecheck(), etc) and
constants (INT_MAX). a fair number of files seem to include <linux/kernel.h>
just for these items. moving that stuff into a separate file (<linux/c.h>?)
could eliminate 20 or more bogus deps from many locations.


ray

2006-10-17 15:25:08

by Linus Torvalds

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned



On Tue, 17 Oct 2006, Al Viro wrote:
>
> Hrm... I'm not sure that I buy that argument - we have relatively few
> callers of these suckers and I doubt that it will affect compile time
> in a measurable way.

I was more worried that it's getting included from other include files,
and that the overhead is just the compiler front-end, whether used or not.

But you're right, it seems like this is one of the well-behaved header
files that isn't unnecessarily included everywhere ;)

So I have no real arguments in that case.

> FWIW, that reminds me - I ought to resurrect the patchset killing bogus
> dependencies; I modified sparse to collect stats on how many times each
> #include actually pulls a header during build, added those to data on
> dependencies (from .cmd.*) and got interesting results.

Yeah, we tend to include a _ton_ of stuff that we probably don't need to.

Linus

2006-10-17 15:29:09

by Linus Torvalds

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned



On Tue, 17 Oct 2006, David Howells wrote:

> Al Viro <[email protected]> wrote:
>
> > * sizeof(*ptr) should be one of 1, 2, 4, 8
>
> Should we give an error if someone tries passing a 1-byte-sized memory location
> to get/put_unaligned()? I suspect it might be best to reduce to a trivial
> direct assignment in that case.

Note that in some cases, you have different architectures having different
sizes, and it could potentially be the case that one architecture has a
1-byte thing, and another has a 2-byte thing.

It's unlikely to be an issue for single-byte cases, but it definitely
happens for other equivalent things (ie "get_user()" often has 2 vs 4-byte
accesses, and obviously the 4- vs 8-byte thing through 32/64-bit values
depending on the size of the machine).

So at least in _theory_ it's quite possible that a single-byte access can
make sense, simply because the size might depend on a config option.

Linus

2006-10-18 04:40:57

by Al Viro

[permalink] [raw]
Subject: dealing with excessive includes

On Tue, Oct 17, 2006 at 08:24:55AM -0700, Linus Torvalds wrote:
> > FWIW, that reminds me - I ought to resurrect the patchset killing bogus
> > dependencies; I modified sparse to collect stats on how many times each
> > #include actually pulls a header during build, added those to data on
> > dependencies (from .cmd.*) and got interesting results.
>
> Yeah, we tend to include a _ton_ of stuff that we probably don't need to.

See ftp://ftp.linux.org.uk/pub/people/viro/counts for some fun current stats;
there I've put the number of files depending on given header (all stats for
amd64 allmodconfig). It's too long to post, but here are some observations:
* look at the distribution of headers by the number of
depenendencies; it's very suggestive. We have

10 in range 4360--4369
4 in range 4350--4359
25 in range 4340--4349
31 in range 4330--4339
30 in range 4320--4329
5 in range 4310--4319
55 in range 4300--4309
2 in range 4280--4289
1 in range 3910--3919
2 in range 3900--3909
7 in range 3890--3899
2 in range 3790--3799
1 in range 3780--3789
5 in range 3740--3749
11 in range 3730--3739
2 in range 3300--3309
5 in range 3290--3299
1 in range 3180--3189

Note the huge gaps *and* very high local concentrations. It actually
gets even more impressive if we look in finer details: in range 4300--4309
the distribution is
4305: 37
4306: 2
4307: 6
4308: 13
Now, every widely included header is going to pull a tail in that
distribution; that is expected. However, the large number hitting exact
same spot is not. That's where the things get really interesting; let's
take a look at the pile at 4305:
4305 include/asm/signal.h
4305 include/asm/siginfo.h
4305 include/asm/sembuf.h
4305 include/asm/seccomp.h
4305 include/asm/resource.h
4305 include/asm/ipcbuf.h
4305 include/asm/cputime.h
4305 include/asm/auxvec.h
4305 include/linux/unistd.h
4305 include/linux/uio.h
4305 include/linux/signal.h
4305 include/linux/sem.h
4305 include/linux/securebits.h
4305 include/linux/seccomp.h
4305 include/linux/sched.h
4305 include/linux/rtmutex.h
4305 include/linux/resource.h
4305 include/linux/rbtree.h
4305 include/linux/pid.h
4305 include/linux/param.h
4305 include/linux/ktime.h
4305 include/linux/ipc.h
4305 include/linux/hrtimer.h
4305 include/linux/futex.h
4305 include/linux/fs_struct.h
4305 include/linux/completion.h
4305 include/linux/capability.h
4305 include/linux/auxvec.h
4305 include/linux/aio_abi.h
4305 include/linux/aio.h
4305 include/asm-generic/signal.h
4305 include/asm-generic/siginfo.h
4305 include/asm-generic/resource.h
4305 include/asm-generic/cputime.h

There is an obvious candidate in creators of that pile: linux/sched.h. It's
(a) very high in distribution and (b) pulls quite a few headers itself.

Now, the next question is how much of that pile is pulled by linux/sched.h.
The answer is "all of them". It certainly means that something's badly
wrong. In particular, there is not a single C file that would pull signal.h
but not sched.h; *all* information about the real use of that signal.h is
drowned. And 4305 is very high; the top of list is
4369 include/asm/types.h
4368 include/linux/compiler.h
4366 include/linux/compiler-gcc4.h
4366 include/linux/compiler-gcc.h
4365 include/asm/linkage.h
4365 include/linux/linkage.h
4361 include/asm/posix_types.h
4361 include/linux/types.h
4361 include/linux/stddef.h
4361 include/linux/posix_types.h
and those are pulled practically by everything.

So which #include is responsible for that mess? Apriori we might just
have it directly pulled all over the place. However, the situation turns
out to be very different. Top pullers are:
4305 include/linux/futex.h
3918 include/asm/compat.h
3892 include/linux/module.h
3739 include/linux/radix-tree.h
3738 include/linux/fs.h
3295 include/linux/mm.h
3173 include/asm/uaccess.h
2644 include/linux/smp_lock.h
2300 include/linux/interrupt.h

Now, futex.h is simply mutual pull with sched.h. Odd idea, of course, but
it doesn't affect the picture unless we have tons of independent pulls of
futex.h. Unlikely.

asm/compat.h is curious one. Main puller of that bugger is asm/elf.h.
AFAICS, it has no reason whatsoever to pull compat.h, let alone sched.h.

asm/elf.h is a member of a cluster similar to sched.h one. Here it is:
3918 include/asm/compat.h
3906 include/asm/user.h
3902 include/linux/elf-em.h
3895 include/asm/elf.h
3894 include/linux/elf.h
3893 include/linux/moduleparam.h
3892 include/asm/module.h
3892 include/asm/local.h
3892 include/linux/module.h
3892 include/linux/kmod.h
and module.h is the obvious leader (the next above is
4282 include/linux/stat.h
and below we have
3791 include/asm/ioctl.h
). BTW, radix-tree.h is also in a cluster - fs.h one...

So the natural plan of attack would be
* try to kill asm-x86_64/elf.h -> asm-x86_64/compat.h
* try to kill linux/module.h -> linux/sched.h
* see what falls out.
The first one is simply killable. No problems arise from its removal.
That drives the count of asm/compat.h from 3918 to 266 (which is already
something), but doesn't affect anything else.

module.h is trickier. First of all, we want extern for wake_up_process().
And unlike the first severed include, we *do* have files that need something
from sched.h and rely on pulling it implicitly via module.h. Fortunately,
there are few of those. For amd64 allmodconfig we only need to touch includes
in
arch/i386/kernel/cpu/mcheck/therm_throt.c
drivers/hwmon/abituguru.c
drivers/leds/ledtrig-ide-disk.c
drivers/leds/ledtrig-timer.c
drivers/scsi/scsi_transport_sas.c
drivers/w1/slaves/w1_therm.c
include/linux/phy.h
kernel/latency.c
and in almost all cases we are actually missing jiffies.h, not sched.h.
However, at that point we really need to look at other targets; they
do add several extra places, but again not much. Below is what I've got
from my usual mix of cross-builds; for resulting dependeny counts (again,
amd64 allmodconfig) see ftp://ftp.linux.org.uk/pub/people/viro/counts-after.
Not too bad for a trivial patch, IMO.

The next obvious targets for sched.h are fs.h and mm.h, but that's going
to be trickier.

diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 28ab806..e7f7322 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -1,4 +1,5 @@
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include <asm/alternative.h>
diff --git a/arch/i386/kernel/cpu/mcheck/therm_throt.c b/arch/i386/kernel/cpu/mcheck/therm_throt.c
index 2d8703b..bad8b44 100644
--- a/arch/i386/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/i386/kernel/cpu/mcheck/therm_throt.c
@@ -20,6 +20,7 @@ #include <linux/sysdev.h>
#include <linux/cpu.h>
#include <asm/cpu.h>
#include <linux/notifier.h>
+#include <linux/jiffies.h>
#include <asm/therm_throt.h>

/* How long to wait between reporting thermal events */
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 4bef76a..1f745f1 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -5,6 +5,7 @@
#include <linux/sysdev.h>
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/sched.h>
#include <linux/cpu.h>
#include <linux/topology.h>
#include <linux/device.h>
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index e5cb0fd..b1dc63e 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -21,6 +21,7 @@
etc voltage & frequency control is not supported!
*/
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
diff --git a/drivers/leds/ledtrig-ide-disk.c b/drivers/leds/ledtrig-ide-disk.c
index fa65188..54b155c 100644
--- a/drivers/leds/ledtrig-ide-disk.c
+++ b/drivers/leds/ledtrig-ide-disk.c
@@ -12,6 +12,7 @@
*/

#include <linux/module.h>
+#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/timer.h>
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index 179c287..2f9e3ba 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -12,6 +12,7 @@
*/

#include <linux/module.h>
+#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/list.h>
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index b5b0c2c..5c0b75b 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -25,6 +25,7 @@

#include <linux/init.h>
#include <linux/module.h>
+#include <linux/jiffies.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/string.h>
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 5372cfc..b022fff 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -24,6 +24,7 @@ #include <asm/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/sched.h>
#include <linux/device.h>
#include <linux/types.h>
#include <linux/delay.h>
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index a406fcb..6d24ea7 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -45,7 +45,6 @@ #define ELF_ARCH EM_X86_64

#ifdef __KERNEL__
#include <asm/processor.h>
-#include <asm/compat.h>

/*
* This is used to ensure we don't load something for the wrong architecture.
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 0496d1f..302eb72 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -119,6 +119,7 @@ #ifdef __KERNEL__
#ifdef CONFIG_BSD_PROCESS_ACCT
struct vfsmount;
struct super_block;
+struct pacct_struct;
extern void acct_auto_close_mnt(struct vfsmount *m);
extern void acct_auto_close(struct super_block *sb);
extern void acct_init_pacct(struct pacct_struct *pacct);
diff --git a/include/linux/module.h b/include/linux/module.h
index d1d00ce..007a865 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -6,7 +6,6 @@ #define _LINUX_MODULE_H
* Rewritten by Richard Henderson <[email protected]> Dec 1996
* Rewritten again by Rusty Russell, 2002
*/
-#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/stat.h>
@@ -410,6 +409,8 @@ static inline int try_module_get(struct
return ret;
}

+extern int FASTCALL(wake_up_process(struct task_struct * tsk));
+
static inline void module_put(struct module *module)
{
if (module) {
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9447a57..f7c2dca 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -20,6 +20,8 @@ #define __PHY_H

#include <linux/spinlock.h>
#include <linux/device.h>
+#include <linux/workqueue.h>
+#include <linux/timer.h>

#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
SUPPORTED_10baseT_Full | \
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 401192e..efa7385 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -25,6 +25,8 @@ #define LIBISCSI_H

#include <linux/types.h>
#include <linux/mutex.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
#include <scsi/iscsi_proto.h>
#include <scsi/iscsi_if.h>

diff --git a/kernel/latency.c b/kernel/latency.c
index 258f255..e63fcac 100644
--- a/kernel/latency.c
+++ b/kernel/latency.c
@@ -36,6 +36,7 @@ #include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/notifier.h>
+#include <linux/jiffies.h>
#include <asm/atomic.h>

struct latency_info {
diff --git a/kernel/module.c b/kernel/module.c
index 67009bd..c7945b7 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -34,10 +34,10 @@ #include <linux/errno.h>
#include <linux/err.h>
#include <linux/vermagic.h>
#include <linux/notifier.h>
+#include <linux/sched.h>
#include <linux/stop_machine.h>
#include <linux/device.h>
#include <linux/string.h>
-#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/unwind.h>
#include <asm/uaccess.h>

2006-10-18 05:42:52

by Dave Jones

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned

On Tue, Oct 17, 2006 at 05:37:26AM +0100, Al Viro wrote:

> There are several #includes with very high impact; the worst happens
> to be module.h -> sched.h

I gave up fighting to get that fixed a year and a half ago..
http://lkml.org/lkml/2005/1/26/11

rediffing trees with lots of include file juggling gets boring real fast.

At one point, this was actually a noticable compile time win.

The other problem with things like this is they have a tendancy to
creep back in when no-one is specifically looking for them.

Dave

--
http://www.codemonkey.org.uk

2006-10-18 06:05:08

by Al Viro

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned

On Wed, Oct 18, 2006 at 01:42:42AM -0400, Dave Jones wrote:
> On Tue, Oct 17, 2006 at 05:37:26AM +0100, Al Viro wrote:
>
> > There are several #includes with very high impact; the worst happens
> > to be module.h -> sched.h
>
> I gave up fighting to get that fixed a year and a half ago..
> http://lkml.org/lkml/2005/1/26/11
>
> rediffing trees with lots of include file juggling gets boring real fast.

I don't see a lot of files touched by that one...
arch/i386/kernel/alternative.c | 1 +
arch/i386/kernel/cpu/mcheck/therm_throt.c | 1 +
drivers/base/cpu.c | 1 +
drivers/hwmon/abituguru.c | 1 +
drivers/leds/ledtrig-ide-disk.c | 1 +
drivers/leds/ledtrig-timer.c | 1 +
drivers/scsi/scsi_transport_sas.c | 1 +
drivers/w1/slaves/w1_therm.c | 1 +
include/asm-x86_64/elf.h | 1 -
include/linux/acct.h | 1 +
include/linux/module.h | 3 ++-
include/linux/phy.h | 2 ++
include/scsi/libiscsi.h | 2 ++
kernel/latency.c | 1 +
kernel/module.c | 2 +-
is hardly a lot.

That's the point, actually - apparently we have several high-impact includes
that are easy to sever and that are really worth being severed. The part
that was not aproiri obvious:
* there are clusters of headers around certain dependency
counts.
* such clusters tend to have leaders - header that pulls the
rest and even though other headers are apparently independently included,
all such includes end up being hidden by includes of the leader.
* gaps between the clusters are pretty large.
* dependency graph *on* *clusters* is worth being studied; includes
of cluster leader from cluster around slightly smaller dependency count
are prime targets for severing.

That is the new part here. Not just "dependency graph is a mess and ought
to be cleaned up" - _that_ is neither new nor particulary useful...

2006-10-18 09:20:06

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: dealing with excessive includes

> module.h is trickier. First of all, we want extern for wake_up_process().

When I came up with this to l-k, Nick and Christoph told me that duplicate
proto sucks. So module.h/sched.h is
a) uninline module_put()
b) remove #include <linux/sched.h>

> And unlike the first severed include, we *do* have files that need something
> from sched.h and rely on pulling it implicitly via module.h. Fortunately,
> there are few of those. For amd64 allmodconfig we only need to touch includes
> in
> arch/i386/kernel/cpu/mcheck/therm_throt.c
> drivers/hwmon/abituguru.c
> drivers/leds/ledtrig-ide-disk.c
> drivers/leds/ledtrig-timer.c
> drivers/scsi/scsi_transport_sas.c
> drivers/w1/slaves/w1_therm.c
> include/linux/phy.h
> kernel/latency.c
> and in almost all cases we are actually missing jiffies.h, not sched.h.
> However, at that point we really need to look at other targets; they
> do add several extra places, but again not much. Below is what I've got
> from my usual mix of cross-builds; for resulting dependeny counts (again,
> amd64 allmodconfig) see ftp://ftp.linux.org.uk/pub/people/viro/counts-after.

> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -6,7 +6,6 @@ #define _LINUX_MODULE_H
> * Rewritten by Richard Henderson <[email protected]> Dec 1996
> * Rewritten again by Rusty Russell, 2002
> */
> -#include <linux/sched.h>
> #include <linux/spinlock.h>
> #include <linux/list.h>
> #include <linux/stat.h>
> @@ -410,6 +409,8 @@ static inline int try_module_get(struct
> return ret;
> }
>
> +extern int FASTCALL(wake_up_process(struct task_struct * tsk));
> +
> static inline void module_put(struct module *module)
> {
> if (module) {

2006-10-18 09:31:29

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 01:19:44PM +0400, Alexey Dobriyan wrote:
> > module.h is trickier. First of all, we want extern for wake_up_process().
>
> When I came up with this to l-k, Nick and Christoph told me that duplicate
> proto sucks. So module.h/sched.h is
> a) uninline module_put()
> b) remove #include <linux/sched.h>

Works for me... OTOH, wake_up_process() is not likely to change
prototype, so I'm not sure how strong that argument actually is.

Anyway, that patch is obviously preliminary - at the very least
it needs be checked on more configs (and more targets - e.g. mips and
parisc hadn't been checked at all). Probably worth putting in -mm for
a while, too, or we'll get fun breakage on the next big merge from -mm.

I'm finishing testing of the next one, BTW - fs.h+radix-tree.h ->
sched.h. Again, very preliminary - on some targets in my setup it's still
going through the build; current delta follows:

diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c
index 20563e5..4664b55 100644
--- a/arch/i386/kernel/acpi/cstate.c
+++ b/arch/i386/kernel/acpi/cstate.c
@@ -11,6 +11,7 @@ #include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/cpu.h>
+#include <linux/sched.h>

#include <acpi/processor.h>
#include <asm/acpi.h>
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 578b99b..bf5b79e 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -27,6 +27,7 @@ #include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/notifier.h>
+#include <linux/jiffies.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 154a81d..b8c9417 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -36,6 +36,7 @@ #include <linux/hw_random.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/delay.h>
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 050ced2..bb9a43c 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -22,6 +22,7 @@ #include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/io.h>
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index 26be4ea..e8ef62b 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -33,6 +33,7 @@ #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/timer.h>
#include <linux/dmi.h>
+#include <linux/jiffies.h>
#include <asm/io.h>

#define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 39d9b20..c2f601f 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -23,6 +23,7 @@ #include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/parport.h>

+#include <linux/sched.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/spi/flash.h>
diff --git a/fs/9p/conv.c b/fs/9p/conv.c
index 56d88c1..a3ed571 100644
--- a/fs/9p/conv.c
+++ b/fs/9p/conv.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>
#include <asm/uaccess.h>
#include "debug.h"
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c
index 8556097..dc336a6 100644
--- a/fs/9p/fcall.c
+++ b/fs/9p/fcall.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>

#include "debug.h"
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 70492cc..2750720 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -23,6 +23,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>

#include "debug.h"
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 0f62804..0b96fae 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/parser.h>
#include <linux/idr.h>

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index e32d597..905c882 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -30,6 +30,7 @@ #include <linux/file.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
+#include <linux/sched.h>
#include <linux/inet.h>
#include <linux/idr.h>

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index c3c47ed..79e6f9c 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/file.h>
#include <linux/stat.h>
#include <linux/string.h>
diff --git a/fs/inotify.c b/fs/inotify.c
index 723836a..f5099d8 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -27,6 +27,7 @@ #include <linux/spinlock.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/writeback.h>
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 0ae3cd1..73f0d60 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/time.h>
#include <linux/crc32.h>
#include <linux/jffs2.h>
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index b9b7007..7070730 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -19,6 +19,7 @@ #include <linux/mtd/mtd.h>
#include <linux/crc32.h>
#include <linux/mtd/nand.h>
#include <linux/jiffies.h>
+#include <linux/sched.h>

#include "nodelist.h"

diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 37db524..ed814b1 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -9,6 +9,7 @@ #include <linux/fs.h>
#include <linux/ctype.h>
#include <linux/capability.h>
#include <linux/time.h>
+#include <linux/sched.h>
#include <asm/current.h>
#include <asm/uaccess.h>

diff --git a/fs/sync.c b/fs/sync.c
index 1de747b..865f32b 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -6,6 +6,7 @@ #include <linux/kernel.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/writeback.h>
#include <linux/syscalls.h>
#include <linux/linkage.h>
diff --git a/fs/utimes.c b/fs/utimes.c
index 1bcd852..99cf2cb 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -2,6 +2,7 @@ #include <linux/compiler.h>
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/namei.h>
+#include <linux/sched.h>
#include <linux/utime.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed..c36ef4f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -276,7 +276,7 @@ #include <linux/list.h>
#include <linux/radix-tree.h>
#include <linux/prio_tree.h>
#include <linux/init.h>
-#include <linux/sched.h>
+#include <linux/pid.h>
#include <linux/mutex.h>

#include <asm/atomic.h>
@@ -970,36 +970,24 @@ enum {
#define vfs_check_frozen(sb, level) \
wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))

-static inline void get_fs_excl(void)
-{
- atomic_inc(&current->fs_excl);
-}
-
-static inline void put_fs_excl(void)
-{
- atomic_dec(&current->fs_excl);
-}
-
-static inline int has_fs_excl(void)
-{
- return atomic_read(&current->fs_excl);
-}
-
+#define get_fs_excl() atomic_inc(&current->fs_excl)
+#define put_fs_excl() atomic_dec(&current->fs_excl)
+#define has_fs_excl() atomic_read(&current->fs_excl)

/*
* Superblock locking.
*/
-static inline void lock_super(struct super_block * sb)
-{
- get_fs_excl();
- mutex_lock(&sb->s_lock);
-}
-
-static inline void unlock_super(struct super_block * sb)
-{
- put_fs_excl();
- mutex_unlock(&sb->s_lock);
-}
+#define lock_super(x) do { \
+ struct super_block *sb = x; \
+ get_fs_excl(); \
+ mutex_lock(&sb->s_lock); \
+} while(0)
+
+#define unlock_super(x) do { \
+ struct super_block *sb = x; \
+ put_fs_excl(); \
+ mutex_unlock(&sb->s_lock); \
+} while(0)

/*
* VFS helper functions..
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9158a68..cbfa115 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -19,7 +19,6 @@
#ifndef _LINUX_RADIX_TREE_H
#define _LINUX_RADIX_TREE_H

-#include <linux/sched.h>
#include <linux/preempt.h>
#include <linux/types.h>

2006-10-18 10:01:17

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 10:31:26AM +0100, Al Viro wrote:
> On Wed, Oct 18, 2006 at 01:19:44PM +0400, Alexey Dobriyan wrote:
> > > module.h is trickier. First of all, we want extern for wake_up_process().
> >
> > When I came up with this to l-k, Nick and Christoph told me that duplicate
> > proto sucks. So module.h/sched.h is
> > a) uninline module_put()
> > b) remove #include <linux/sched.h>
>
> Works for me... OTOH, wake_up_process() is not likely to change
> prototype, so I'm not sure how strong that argument actually is.

Actually, it's pretty good argument. module_put() is not on hot paths
and duplicate prototypes tend to diverge.

> Anyway, that patch is obviously preliminary - at the very least
> it needs be checked on more configs (and more targets - e.g. mips and
> parisc hadn't been checked at all).

configs. Is ftp://ftp.linux.org.uk/pub/people/viro/config/ still
relevant? Or can you just post ls $CONFIGDIR ?

2006-10-18 15:04:38

by Linus Torvalds

[permalink] [raw]
Subject: Re: dealing with excessive includes



On Wed, 18 Oct 2006, Al Viro wrote:
>
> +#define lock_super(x) do { \
> + struct super_block *sb = x; \
> + get_fs_excl(); \
> + mutex_lock(&sb->s_lock); \
> +} while(0)

Don't do this. The "x" passed in may be "sb", and then you end up with
bogus code.

I think the solution to these kinds of things is either
- just bite the bullet, and make it out-of-line. A function call isn't
that expensive, and is sometimes actually cheaper due to I$ issues.
- have a separate trivial header file, and only include it for people who
actually need these things (very few files, actually - it's usually
just one file per filesystem)

In this case, since it's _so_ simple, and since it's _so_ specialized, I
think #2 is the right one. Normally, uninlining would be.

Linus

2006-10-18 15:13:23

by Matthew Wilcox

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 08:04:24AM -0700, Linus Torvalds wrote:
> On Wed, 18 Oct 2006, Al Viro wrote:
> >
> > +#define lock_super(x) do { \
> > + struct super_block *sb = x; \
> > + get_fs_excl(); \
> > + mutex_lock(&sb->s_lock); \
> > +} while(0)
>
> Don't do this. The "x" passed in may be "sb", and then you end up with
> bogus code.

For this one, I see a third way:

#define lock_super(sb) do { \
get_fs_excl(); \
mutex_lock(&(sb)->s_lock); \
} while (0)

It does have the disadvantage that you can pass *anything* that has
an s_lock field in ... but I don't think that's a very likely thing
to happen.

Or you could use _sb as the local variable, since it's a reserved
identifier.

2006-10-18 16:06:13

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 08:04:24AM -0700, Linus Torvalds wrote:
>
>
> On Wed, 18 Oct 2006, Al Viro wrote:
> >
> > +#define lock_super(x) do { \
> > + struct super_block *sb = x; \
> > + get_fs_excl(); \
> > + mutex_lock(&sb->s_lock); \
> > +} while(0)
>
> Don't do this. The "x" passed in may be "sb", and then you end up with
> bogus code.

*duh*

> I think the solution to these kinds of things is either
> - just bite the bullet, and make it out-of-line. A function call isn't
> that expensive, and is sometimes actually cheaper due to I$ issues.
> - have a separate trivial header file, and only include it for people who
> actually need these things (very few files, actually - it's usually
> just one file per filesystem)
>
> In this case, since it's _so_ simple, and since it's _so_ specialized, I
> think #2 is the right one. Normally, uninlining would be.

Actually, after reading that code I suspect that get_fs_excl() in there
is the wrong thing to do. Why? Because the logics is all wrong.

Look what we do under lock_super(). There are two things: ->remount_fs()
and ->write_super(). Plus whatever low-level filesystems are using
lock_super() for.

I would argue that we want to move get_fs_excl() down to the places in
->write_super() that actually want to do something deserving it. And
to be honest, I'm not at all sure that lock_super() should survive
at upper layers, but that's a longer story...

2006-10-18 16:18:30

by Jan Engelhardt

[permalink] [raw]
Subject: Re: dealing with excessive includes


>> +#define lock_super(x) do { \
>> + struct super_block *sb = x; \
>> + get_fs_excl(); \
>> + mutex_lock(&sb->s_lock); \
>> +} while(0)
>
>Don't do this. The "x" passed in may be "sb", and then you end up with
>bogus code.

So how about:

static inline void lock_super(struct super_block *sb)
{
get_fs_excl();
mutex_lock(&sb->s_lock);
return;
}

which avoids any naming issue.


-`J'
--

2006-10-18 16:21:16

by Matthew Wilcox

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 06:15:27PM +0200, Jan Engelhardt wrote:
> So how about:
>
> static inline void lock_super(struct super_block *sb)

Please start again at the top of the thread. Thanks.

2006-10-18 16:32:22

by Linus Torvalds

[permalink] [raw]
Subject: Re: dealing with excessive includes



On Wed, 18 Oct 2006, Al Viro wrote:
>
> Actually, after reading that code I suspect that get_fs_excl() in there
> is the wrong thing to do. Why? Because the logics is all wrong.
>
> Look what we do under lock_super(). There are two things: ->remount_fs()
> and ->write_super(). Plus whatever low-level filesystems are using
> lock_super() for.

I think this all boils down to the fact that "lock_super()" really is a
very old and broken interface. It pretty much harks back to the original
filesystem code, and yes, every "lock_super()" _should_ probably be
replaced by a lower-level lock.

I think ext2 was already fixed to use its own spinlocks for bitmap
accesses, although it looks like somebody re-introduced "lock_super()"
there for xattr handling.

[ Which in turn is probably just a bug, since nothing else uses it, so
having a single lock_user() in all of ext2 is almost certainly totally
pointless - there is nothing that it actually _protects_ against. I
guess it protects against "sync()", but that's pretty much it. ]

That said, I'd rather do any lock_super() cleanup totally _independently_
of a include file cleanup.

So since it's clearly not performance-critical, how about just making it
be out-of-line in fs/super.c, and turn the header file into just a
declaration?

Linus

2006-10-18 17:43:00

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 02:00:57PM +0400, Alexey Dobriyan wrote:
> > Anyway, that patch is obviously preliminary - at the very least
> > it needs be checked on more configs (and more targets - e.g. mips and
> > parisc hadn't been checked at all).
>
> configs. Is ftp://ftp.linux.org.uk/pub/people/viro/config/ still
> relevant?

Updated. Changes since the last time:
ARCH=ppc targets dropped
a couple of weird ones (sun3 and sun4 ;-) added
drift in Kconfig required more explicit option disabling in some
cases

2006-10-18 17:44:40

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 09:32:08AM -0700, Linus Torvalds wrote:
> [ Which in turn is probably just a bug, since nothing else uses it, so
> having a single lock_user() in all of ext2 is almost certainly totally
> pointless - there is nothing that it actually _protects_ against. I
> guess it protects against "sync()", but that's pretty much it. ]

My guess would be "remount". Still bogus...

> That said, I'd rather do any lock_super() cleanup totally _independently_
> of a include file cleanup.

Oh, definitely.

> So since it's clearly not performance-critical, how about just making it
> be out-of-line in fs/super.c, and turn the header file into just a
> declaration?

Yup. OK, here's the latest radix-tree.h+fs.h patch; still fairly small.
Deps counts after it are on ftp.linux.org.uk/pub/people/viro/counts-after2

diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c
index 20563e5..4664b55 100644
--- a/arch/i386/kernel/acpi/cstate.c
+++ b/arch/i386/kernel/acpi/cstate.c
@@ -11,6 +11,7 @@ #include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/cpu.h>
+#include <linux/sched.h>

#include <acpi/processor.h>
#include <asm/acpi.h>
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 578b99b..bf5b79e 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -27,6 +27,7 @@ #include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/notifier.h>
+#include <linux/jiffies.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 154a81d..b8c9417 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -36,6 +36,7 @@ #include <linux/hw_random.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/delay.h>
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 050ced2..bb9a43c 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -22,6 +22,7 @@ #include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/io.h>
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index 26be4ea..e8ef62b 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -33,6 +33,7 @@ #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/timer.h>
#include <linux/dmi.h>
+#include <linux/jiffies.h>
#include <asm/io.h>

#define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 39d9b20..c2f601f 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -23,6 +23,7 @@ #include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/parport.h>

+#include <linux/sched.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/spi/flash.h>
diff --git a/fs/9p/conv.c b/fs/9p/conv.c
index 56d88c1..a3ed571 100644
--- a/fs/9p/conv.c
+++ b/fs/9p/conv.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>
#include <asm/uaccess.h>
#include "debug.h"
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c
index 8556097..dc336a6 100644
--- a/fs/9p/fcall.c
+++ b/fs/9p/fcall.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>

#include "debug.h"
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 70492cc..2750720 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -23,6 +23,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>

#include "debug.h"
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 0f62804..0b96fae 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/parser.h>
#include <linux/idr.h>

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index e32d597..905c882 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -30,6 +30,7 @@ #include <linux/file.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
+#include <linux/sched.h>
#include <linux/inet.h>
#include <linux/idr.h>

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index c3c47ed..79e6f9c 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/file.h>
#include <linux/stat.h>
#include <linux/string.h>
diff --git a/fs/inotify.c b/fs/inotify.c
index 723836a..f5099d8 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -27,6 +27,7 @@ #include <linux/spinlock.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/writeback.h>
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 0ae3cd1..73f0d60 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/time.h>
#include <linux/crc32.h>
#include <linux/jffs2.h>
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index b9b7007..7070730 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -19,6 +19,7 @@ #include <linux/mtd/mtd.h>
#include <linux/crc32.h>
#include <linux/mtd/nand.h>
#include <linux/jiffies.h>
+#include <linux/sched.h>

#include "nodelist.h"

diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 37db524..ed814b1 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -9,6 +9,7 @@ #include <linux/fs.h>
#include <linux/ctype.h>
#include <linux/capability.h>
#include <linux/time.h>
+#include <linux/sched.h>
#include <asm/current.h>
#include <asm/uaccess.h>

diff --git a/fs/proc/root.c b/fs/proc/root.c
index ffe66c3..64d242b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -13,6 +13,7 @@ #include <linux/time.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
+#include <linux/sched.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/smp_lock.h>
diff --git a/fs/super.c b/fs/super.c
index 47e554c..84c320f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -221,6 +221,24 @@ static int grab_super(struct super_block
}

/*
+ * Superblock locking. We really ought to get rid of these two.
+ */
+void lock_super(struct super_block * sb)
+{
+ get_fs_excl();
+ mutex_lock(&sb->s_lock);
+}
+
+void unlock_super(struct super_block * sb)
+{
+ put_fs_excl();
+ mutex_unlock(&sb->s_lock);
+}
+
+EXPORT_SYMBOL(lock_super);
+EXPORT_SYMBOL(unlock_super);
+
+/*
* Write out and wait upon all dirty data associated with this
* superblock. Filesystem data as well as the underlying block
* device. Takes the superblock lock. Requires a second blkdev
diff --git a/fs/sync.c b/fs/sync.c
index 1de747b..865f32b 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -6,6 +6,7 @@ #include <linux/kernel.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/writeback.h>
#include <linux/syscalls.h>
#include <linux/linkage.h>
diff --git a/fs/utimes.c b/fs/utimes.c
index 1bcd852..99cf2cb 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -2,6 +2,7 @@ #include <linux/compiler.h>
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/namei.h>
+#include <linux/sched.h>
#include <linux/utime.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed..2eadd84 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -276,7 +276,7 @@ #include <linux/list.h>
#include <linux/radix-tree.h>
#include <linux/prio_tree.h>
#include <linux/init.h>
-#include <linux/sched.h>
+#include <linux/pid.h>
#include <linux/mutex.h>

#include <asm/atomic.h>
@@ -970,36 +970,13 @@ enum {
#define vfs_check_frozen(sb, level) \
wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))

-static inline void get_fs_excl(void)
-{
- atomic_inc(&current->fs_excl);
-}
-
-static inline void put_fs_excl(void)
-{
- atomic_dec(&current->fs_excl);
-}
-
-static inline int has_fs_excl(void)
-{
- return atomic_read(&current->fs_excl);
-}
+#define get_fs_excl() atomic_inc(&current->fs_excl)
+#define put_fs_excl() atomic_dec(&current->fs_excl)
+#define has_fs_excl() atomic_read(&current->fs_excl)

-
-/*
- * Superblock locking.
- */
-static inline void lock_super(struct super_block * sb)
-{
- get_fs_excl();
- mutex_lock(&sb->s_lock);
-}
-
-static inline void unlock_super(struct super_block * sb)
-{
- put_fs_excl();
- mutex_unlock(&sb->s_lock);
-}
+/* not quite ready to be deprecated, but... */
+extern void lock_super(struct super_block *);
+extern void unlock_super(struct super_block *);

/*
* VFS helper functions..
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9158a68..cbfa115 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -19,7 +19,6 @@
#ifndef _LINUX_RADIX_TREE_H
#define _LINUX_RADIX_TREE_H

-#include <linux/sched.h>
#include <linux/preempt.h>
#include <linux/types.h>

2006-10-18 21:48:53

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 06:42:57PM +0100, Al Viro wrote:
> On Wed, Oct 18, 2006 at 02:00:57PM +0400, Alexey Dobriyan wrote:
> > > Anyway, that patch is obviously preliminary - at the very least
> > > it needs be checked on more configs (and more targets - e.g. mips and
> > > parisc hadn't been checked at all).
> >
> > configs. Is ftp://ftp.linux.org.uk/pub/people/viro/config/ still
> > relevant?
>
> Updated.

Thank you!

This is needed on parisc when sched.h is going out of module.h

lib/random32.c:119: error: `jiffies' undeclared (first use in this function)

--- a/lib/random32.c
+++ b/lib/random32.c
@@ -37,6 +37,7 @@ #include <linux/types.h>
#include <linux/percpu.h>
#include <linux/module.h>
#include <linux/random.h>
+#include <linux/jiffies.h>

struct rnd_state {
u32 s1, s2, s3;

2006-10-19 16:23:17

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 09:32:08AM -0700, Linus Torvalds wrote:
> That said, I'd rather do any lock_super() cleanup totally _independently_
> of a include file cleanup.
>
> So since it's clearly not performance-critical, how about just making it
> be out-of-line in fs/super.c, and turn the header file into just a
> declaration?

Next fun question on strategy: we have a very good bunch of candidates on
killable includes in skbuff.h - highmem.h, mm.h and poll.h. I've done
preliminary variants on amd64 and they give nice reductions of deps
counts with small patches. The tricky part is a couple of helpers -
k{un,}map_skb_frag(). They require highmem.h; nothing else in skbuff.h
does. Only two places are using them - net/core/skbuff.c and
net/appletalk/ddp.c (the latter in one function - dealing with Apple's
take on checksums[1]).

Possible variants:
* turn into macros. Works for a test run, not nice for final
variant.
* new header just for those two in include/net
* new header in net/core, with ddp.c including ../core/skb_kmap.h
* inline in net/core/skbuff.h, extern in ddp.c; then normal paths
get it inlined and appletalk can live with uninlined version.

Preferences?

[1] appletalk: the proof that Vogon neuroanatomy was not entirely fictional.

2006-10-19 16:54:38

by Denys Vlasenko

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned

On Wednesday 18 October 2006 08:05, Al Viro wrote:
> That's the point, actually - apparently we have several high-impact includes
> that are easy to sever and that are really worth being severed. The part
> that was not aproiri obvious:
> * there are clusters of headers around certain dependency
> counts.
> * such clusters tend to have leaders - header that pulls the
> rest and even though other headers are apparently independently included,
> all such includes end up being hidden by includes of the leader.
> * gaps between the clusters are pretty large.
> * dependency graph *on* *clusters* is worth being studied; includes
> of cluster leader from cluster around slightly smaller dependency count
> are prime targets for severing.
>
> That is the new part here. Not just "dependency graph is a mess and ought
> to be cleaned up" - _that_ is neither new nor particulary useful...

Well, logically for any given .config a set of all kernel header files
define a set of typedefs, structs, functions and so on.
If only we can read and parse them just once, and then reuse
already parsed information when we compile each .c file -
that will give you the biggest time savings.

gcc has some facility for that ("precompiled headers")
http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html

I don't know how hard it will be to adapt build system to using that
and there is a danger that using this thing will increase
recompile times when you change just a few CONFIG_XXXs.
--
vda

2006-10-19 16:58:42

by Al Viro

[permalink] [raw]
Subject: Re: [RFC] typechecking for get_unaligned/put_unaligned

On Thu, Oct 19, 2006 at 06:52:50PM +0200, Denis Vlasenko wrote:
> Well, logically for any given .config a set of all kernel header files
> define a set of typedefs, structs, functions and so on.
> If only we can read and parse them just once, and then reuse
> already parsed information when we compile each .c file -
> that will give you the biggest time savings.
>
> gcc has some facility for that ("precompiled headers")
> http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
>
> I don't know how hard it will be to adapt build system to using that
> and there is a danger that using this thing will increase
> recompile times when you change just a few CONFIG_XXXs.

Or when you touch a single header. A brialliant idea, that.

2006-10-19 18:23:14

by Andreas Gruenbacher

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wednesday 18 October 2006 18:32, Linus Torvalds wrote:
> I think ext2 was already fixed to use its own spinlocks for bitmap
> accesses, although it looks like somebody re-introduced "lock_super()"
> there for xattr handling.

I'll send a cleanup patch for that.

Thanks,
Andreas

2006-10-20 00:53:42

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, Oct 18, 2006 at 09:32:08AM -0700, Linus Torvalds wrote:
> guess it protects against "sync()", but that's pretty much it. ]
>
> That said, I'd rather do any lock_super() cleanup totally _independently_
> of a include file cleanup.
>
> So since it's clearly not performance-critical, how about just making it
> be out-of-line in fs/super.c, and turn the header file into just a
> declaration?

Done. Several more in followups.

---
arch/i386/kernel/acpi/cstate.c | 1 +
drivers/acpi/dock.c | 1 +
drivers/char/hw_random/core.c | 1 +
drivers/char/tpm/tpm.h | 1 +
drivers/hwmon/hdaps.c | 1 +
drivers/spi/spi_butterfly.c | 1 +
fs/9p/conv.c | 1 +
fs/9p/fcall.c | 1 +
fs/9p/fid.c | 1 +
fs/9p/v9fs.c | 1 +
fs/9p/vfs_dir.c | 1 +
fs/9p/vfs_file.c | 1 +
fs/inotify.c | 1 +
fs/jffs2/acl.c | 1 +
fs/jffs2/wbuf.c | 1 +
fs/jfs/ioctl.c | 1 +
fs/proc/root.c | 1 +
fs/super.c | 18 ++++++++++++++++++
fs/sync.c | 1 +
fs/utimes.c | 1 +
include/linux/fs.h | 37 +++++++------------------------------
include/linux/radix-tree.h | 1 -
22 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c
index 20563e5..4664b55 100644
--- a/arch/i386/kernel/acpi/cstate.c
+++ b/arch/i386/kernel/acpi/cstate.c
@@ -11,6 +11,7 @@ #include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/cpu.h>
+#include <linux/sched.h>

#include <acpi/processor.h>
#include <asm/acpi.h>
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 578b99b..bf5b79e 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -27,6 +27,7 @@ #include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/notifier.h>
+#include <linux/jiffies.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 154a81d..b8c9417 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -36,6 +36,7 @@ #include <linux/hw_random.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/delay.h>
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 050ced2..bb9a43c 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -22,6 +22,7 @@ #include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/io.h>
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index 26be4ea..e8ef62b 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -33,6 +33,7 @@ #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/timer.h>
#include <linux/dmi.h>
+#include <linux/jiffies.h>
#include <asm/io.h>

#define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 39d9b20..c2f601f 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -23,6 +23,7 @@ #include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/parport.h>

+#include <linux/sched.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/spi/flash.h>
diff --git a/fs/9p/conv.c b/fs/9p/conv.c
index 56d88c1..a3ed571 100644
--- a/fs/9p/conv.c
+++ b/fs/9p/conv.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>
#include <asm/uaccess.h>
#include "debug.h"
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c
index 8556097..dc336a6 100644
--- a/fs/9p/fcall.c
+++ b/fs/9p/fcall.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>

#include "debug.h"
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 70492cc..2750720 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -23,6 +23,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/idr.h>

#include "debug.h"
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 0f62804..0b96fae 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/parser.h>
#include <linux/idr.h>

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index e32d597..905c882 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -30,6 +30,7 @@ #include <linux/file.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
+#include <linux/sched.h>
#include <linux/inet.h>
#include <linux/idr.h>

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index c3c47ed..79e6f9c 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/file.h>
#include <linux/stat.h>
#include <linux/string.h>
diff --git a/fs/inotify.c b/fs/inotify.c
index 723836a..f5099d8 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -27,6 +27,7 @@ #include <linux/spinlock.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/writeback.h>
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 0ae3cd1..73f0d60 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include <linux/time.h>
#include <linux/crc32.h>
#include <linux/jffs2.h>
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index b9b7007..7070730 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -19,6 +19,7 @@ #include <linux/mtd/mtd.h>
#include <linux/crc32.h>
#include <linux/mtd/nand.h>
#include <linux/jiffies.h>
+#include <linux/sched.h>

#include "nodelist.h"

diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 37db524..ed814b1 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -9,6 +9,7 @@ #include <linux/fs.h>
#include <linux/ctype.h>
#include <linux/capability.h>
#include <linux/time.h>
+#include <linux/sched.h>
#include <asm/current.h>
#include <asm/uaccess.h>

diff --git a/fs/proc/root.c b/fs/proc/root.c
index ffe66c3..64d242b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -13,6 +13,7 @@ #include <linux/time.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
+#include <linux/sched.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/smp_lock.h>
diff --git a/fs/super.c b/fs/super.c
index 47e554c..84c320f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -221,6 +221,24 @@ static int grab_super(struct super_block
}

/*
+ * Superblock locking. We really ought to get rid of these two.
+ */
+void lock_super(struct super_block * sb)
+{
+ get_fs_excl();
+ mutex_lock(&sb->s_lock);
+}
+
+void unlock_super(struct super_block * sb)
+{
+ put_fs_excl();
+ mutex_unlock(&sb->s_lock);
+}
+
+EXPORT_SYMBOL(lock_super);
+EXPORT_SYMBOL(unlock_super);
+
+/*
* Write out and wait upon all dirty data associated with this
* superblock. Filesystem data as well as the underlying block
* device. Takes the superblock lock. Requires a second blkdev
diff --git a/fs/sync.c b/fs/sync.c
index 1de747b..865f32b 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -6,6 +6,7 @@ #include <linux/kernel.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/writeback.h>
#include <linux/syscalls.h>
#include <linux/linkage.h>
diff --git a/fs/utimes.c b/fs/utimes.c
index 1bcd852..99cf2cb 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -2,6 +2,7 @@ #include <linux/compiler.h>
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/namei.h>
+#include <linux/sched.h>
#include <linux/utime.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed..2eadd84 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -276,7 +276,7 @@ #include <linux/list.h>
#include <linux/radix-tree.h>
#include <linux/prio_tree.h>
#include <linux/init.h>
-#include <linux/sched.h>
+#include <linux/pid.h>
#include <linux/mutex.h>

#include <asm/atomic.h>
@@ -970,36 +970,13 @@ enum {
#define vfs_check_frozen(sb, level) \
wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))

-static inline void get_fs_excl(void)
-{
- atomic_inc(&current->fs_excl);
-}
-
-static inline void put_fs_excl(void)
-{
- atomic_dec(&current->fs_excl);
-}
-
-static inline int has_fs_excl(void)
-{
- return atomic_read(&current->fs_excl);
-}
+#define get_fs_excl() atomic_inc(&current->fs_excl)
+#define put_fs_excl() atomic_dec(&current->fs_excl)
+#define has_fs_excl() atomic_read(&current->fs_excl)

-
-/*
- * Superblock locking.
- */
-static inline void lock_super(struct super_block * sb)
-{
- get_fs_excl();
- mutex_lock(&sb->s_lock);
-}
-
-static inline void unlock_super(struct super_block * sb)
-{
- put_fs_excl();
- mutex_unlock(&sb->s_lock);
-}
+/* not quite ready to be deprecated, but... */
+extern void lock_super(struct super_block *);
+extern void unlock_super(struct super_block *);

/*
* VFS helper functions..
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9158a68..cbfa115 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -19,7 +19,6 @@
#ifndef _LINUX_RADIX_TREE_H
#define _LINUX_RADIX_TREE_H

-#include <linux/sched.h>
#include <linux/preempt.h>
#include <linux/types.h>

--
1.4.2.GIT

2006-10-20 00:57:41

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

That's just a dead weight these days
---
include/asm-x86_64/uaccess.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 19f9917..d5dbc87 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -6,7 +6,6 @@ #define __X86_64_UACCESS_H
*/
#include <linux/compiler.h>
#include <linux/errno.h>
-#include <linux/sched.h>
#include <linux/prefetch.h>
#include <asm/page.h>

--
1.4.2.GIT

2006-10-20 00:58:41

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

More interesting: skbuff -> highmem. That's a preliminary patch, needs
testing on more targets.

---
drivers/infiniband/ulp/iser/iser_memory.c | 1 +
drivers/net/sun3lance.c | 1 +
fs/compat.c | 1 +
include/linux/skbuff.h | 19 -------------------
kernel/auditsc.c | 1 +
net/appletalk/ddp.c | 1 +
net/core/kmap_skb.h | 19 +++++++++++++++++++
net/core/skbuff.c | 3 ++-
net/core/sock.c | 1 +
net/ipv4/ip_output.c | 1 +
net/packet/af_packet.c | 1 +
11 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index 0606744..5e12250 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -35,6 +35,7 @@ #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mm.h>
+#include <linux/highmem.h>
#include <asm/io.h>
#include <asm/scatterlist.h>
#include <linux/scatterlist.h>
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index d353ddc..c62e85d 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -38,6 +38,7 @@ #include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/bitops.h>

+#include <asm/cacheflush.h>
#include <asm/setup.h>
#include <asm/irq.h>
#include <asm/io.h>
diff --git a/fs/compat.c b/fs/compat.c
index 50624d4..0f06acb 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -45,6 +45,7 @@ #include <linux/nfsd/syscall.h>
#include <linux/personality.h>
#include <linux/rwsem.h>
#include <linux/tsacct_kern.h>
+#include <linux/highmem.h>
#include <linux/mm.h>

#include <net/sock.h> /* siocdevprivate_ioctl */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 85577a4..c9c83ae 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -23,7 +23,6 @@ #include <asm/atomic.h>
#include <asm/types.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
-#include <linux/highmem.h>
#include <linux/poll.h>
#include <linux/net.h>
#include <linux/textsearch.h>
@@ -1293,24 +1292,6 @@ static inline int pskb_trim_rcsum(struct
return __pskb_trim(skb, len);
}

-static inline void *kmap_skb_frag(const skb_frag_t *frag)
-{
-#ifdef CONFIG_HIGHMEM
- BUG_ON(in_irq());
-
- local_bh_disable();
-#endif
- return kmap_atomic(frag->page, KM_SKB_DATA_SOFTIRQ);
-}
-
-static inline void kunmap_skb_frag(void *vaddr)
-{
- kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
-#ifdef CONFIG_HIGHMEM
- local_bh_enable();
-#endif
-}
-
#define skb_queue_walk(queue, skb) \
for (skb = (queue)->next; \
prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 42f2f11..ab97e51 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -64,6 +64,7 @@ #include <linux/list.h>
#include <linux/tty.h>
#include <linux/selinux.h>
#include <linux/binfmts.h>
+#include <linux/highmem.h>
#include <linux/syscalls.h>

#include "audit.h"
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 708e2e0..a5b0f1a 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -61,6 +61,7 @@ #include <net/sock.h>
#include <net/tcp_states.h>
#include <net/route.h>
#include <linux/atalk.h>
+#include "../core/kmap_skb.h"

struct datalink_proto *ddp_dl, *aarp_dl;
static const struct proto_ops atalk_dgram_ops;
diff --git a/net/core/kmap_skb.h b/net/core/kmap_skb.h
new file mode 100644
index 0000000..283c2b9
--- /dev/null
+++ b/net/core/kmap_skb.h
@@ -0,0 +1,19 @@
+#include <linux/highmem.h>
+
+static inline void *kmap_skb_frag(const skb_frag_t *frag)
+{
+#ifdef CONFIG_HIGHMEM
+ BUG_ON(in_irq());
+
+ local_bh_disable();
+#endif
+ return kmap_atomic(frag->page, KM_SKB_DATA_SOFTIRQ);
+}
+
+static inline void kunmap_skb_frag(void *vaddr)
+{
+ kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
+#ifdef CONFIG_HIGHMEM
+ local_bh_enable();
+#endif
+}
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3c23760..12e0c04 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -56,7 +56,6 @@ #include <linux/skbuff.h>
#include <linux/cache.h>
#include <linux/rtnetlink.h>
#include <linux/init.h>
-#include <linux/highmem.h>

#include <net/protocol.h>
#include <net/dst.h>
@@ -67,6 +66,8 @@ #include <net/xfrm.h>
#include <asm/uaccess.h>
#include <asm/system.h>

+#include "kmap_skb.h"
+
static kmem_cache_t *skbuff_head_cache __read_mostly;
static kmem_cache_t *skbuff_fclone_cache __read_mostly;

diff --git a/net/core/sock.c b/net/core/sock.c
index b77e155..591c252 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -111,6 +111,7 @@ #include <linux/interrupt.h>
#include <linux/poll.h>
#include <linux/tcp.h>
#include <linux/init.h>
+#include <linux/highmem.h>

#include <asm/uaccess.h>
#include <asm/system.h>
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index fc195a4..fb1b21f 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -53,6 +53,7 @@ #include <linux/sched.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
+#include <linux/highmem.h>

#include <linux/socket.h>
#include <linux/sockios.h>
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index f4ccb90..6c2313c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -71,6 +71,7 @@ #include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
#include <asm/page.h>
+#include <asm/cacheflush.h>
#include <asm/io.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
--
1.4.2.GIT

2006-10-20 00:59:22

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

Another preliminary: skbuff -> poll

---
fs/compat.c | 1 +
fs/gfs2/locking/dlm/plock.c | 1 +
include/linux/skbuff.h | 1 -
include/net/inet_connection_sock.h | 1 +
include/net/udp.h | 1 +
5 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 0f06acb..1c3e9a6 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -46,6 +46,7 @@ #include <linux/personality.h>
#include <linux/rwsem.h>
#include <linux/tsacct_kern.h>
#include <linux/highmem.h>
+#include <linux/poll.h>
#include <linux/mm.h>

#include <net/sock.h> /* siocdevprivate_ioctl */
diff --git a/fs/gfs2/locking/dlm/plock.c b/fs/gfs2/locking/dlm/plock.c
index 7365aec..3799f19 100644
--- a/fs/gfs2/locking/dlm/plock.c
+++ b/fs/gfs2/locking/dlm/plock.c
@@ -8,6 +8,7 @@

#include <linux/miscdevice.h>
#include <linux/lock_dlm_plock.h>
+#include <linux/poll.h>

#include "lock_dlm.h"

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c9c83ae..6aa8b11 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -23,7 +23,6 @@ #include <asm/atomic.h>
#include <asm/types.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
-#include <linux/poll.h>
#include <linux/net.h>
#include <linux/textsearch.h>
#include <net/checksum.h>
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 0bcf9f2..4167a24 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -18,6 +18,7 @@ #define _INET_CONNECTION_SOCK_H
#include <linux/compiler.h>
#include <linux/string.h>
#include <linux/timer.h>
+#include <linux/poll.h>

#include <net/inet_sock.h>
#include <net/request_sock.h>
diff --git a/include/net/udp.h b/include/net/udp.h
index db0c05f..e287df5 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -27,6 +27,7 @@ #include <net/inet_sock.h>
#include <net/sock.h>
#include <net/snmp.h>
#include <linux/seq_file.h>
+#include <linux/poll.h>

#define UDP_HTABLE_SIZE 128

--
1.4.2.GIT

2006-10-20 01:02:08

by Al Viro

[permalink] [raw]
Subject: Re: dealing with excessive includes

And one more preliminary: skbuff -> mm. New stats on
ftp.linux.org.uk/pub/people/viro/counts-after3; note reductions for
sched.h, fs.h and mm.h clusters.

---
drivers/isdn/divert/isdn_divert.c | 2 ++
drivers/net/ehea/ehea_qmr.c | 1 +
drivers/net/lance.c | 1 +
drivers/net/ne3210.c | 1 +
drivers/net/sk98lin/skge.c | 2 ++
drivers/net/starfire.c | 1 +
drivers/net/sungem.c | 1 +
drivers/net/sunhme.c | 1 +
drivers/net/typhoon.c | 1 +
include/linux/igmp.h | 1 +
include/linux/kernelcapi.h | 1 +
include/linux/netdevice.h | 1 +
include/linux/netfilter_ipv4/ip_conntrack.h | 1 +
include/linux/skbuff.h | 1 -
include/net/irda/timer.h | 1 +
include/net/netlink.h | 1 +
include/net/sock.h | 1 +
net/ieee80211/ieee80211_crypt_tkip.c | 1 +
net/ieee80211/ieee80211_crypt_wep.c | 1 +
net/ipv4/ipvs/ip_vs_lblc.c | 1 +
net/ipv4/ipvs/ip_vs_lblcr.c | 1 +
net/ipv4/netfilter/ipt_hashlimit.c | 1 +
net/irda/discovery.c | 1 +
net/irda/iriap.c | 1 +
net/irda/irttp.c | 1 +
net/netfilter/x_tables.c | 1 +
26 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/drivers/isdn/divert/isdn_divert.c b/drivers/isdn/divert/isdn_divert.c
index 1f5ebe9..03319ea 100644
--- a/drivers/isdn/divert/isdn_divert.c
+++ b/drivers/isdn/divert/isdn_divert.c
@@ -10,6 +10,8 @@
*/

#include <linux/proc_fs.h>
+#include <linux/timer.h>
+#include <linux/jiffies.h>

#include "isdn_divert.h"

diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 3e18623..01c21b7 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -26,6 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

+#include <linux/mm.h>
#include "ehea.h"
#include "ehea_phyp.h"
#include "ehea_qmr.h"
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index 947b20b..a384332 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -57,6 +57,7 @@ #include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
+#include <linux/mm.h>
#include <linux/bitops.h>

#include <asm/io.h>
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c
index d663289..1a6fed7 100644
--- a/drivers/net/ne3210.c
+++ b/drivers/net/ne3210.c
@@ -36,6 +36,7 @@ #include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/mm.h>

#include <asm/io.h>
#include <asm/system.h>
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index d4913c3..96bdbb7 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -113,6 +113,8 @@ #include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/ip.h>
+#include <linux/mm_types.h>
+#include <asm/page.h>

#include "h/skdrv1st.h"
#include "h/skdrv2nd.h"
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 7a0aee6..bf873ea 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -41,6 +41,7 @@ #include <linux/crc32.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
+#include <linux/mm.h>
#include <asm/processor.h> /* Processor type for cache alignment. */
#include <asm/uaccess.h>
#include <asm/io.h>
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 253e96e..d1c07ea 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -56,6 +56,7 @@ #include <linux/workqueue.h>
#include <linux/if_vlan.h>
#include <linux/bitops.h>
#include <linux/mutex.h>
+#include <linux/mm.h>

#include <asm/system.h>
#include <asm/io.h>
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 9d7cd13..204b94e 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -32,6 +32,7 @@ #include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
+#include <linux/mm.h>
#include <linux/bitops.h>

#include <asm/system.h>
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 3bf9e63..467b10f 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -117,6 +117,7 @@ #include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
+#include <linux/mm.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/ethtool.h>
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 03f43e2..014940e 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -127,6 +127,7 @@ #define IGMP_LOCAL_GROUP_MASK htonl(0xFF

#ifdef __KERNEL__
#include <linux/skbuff.h>
+#include <linux/timer.h>
#include <linux/in.h>

extern int sysctl_igmp_max_memberships;
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 891bb2c..f8a0ff8 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -47,6 +47,7 @@ #ifdef __KERNEL__

#include <linux/list.h>
#include <linux/skbuff.h>
+#include <linux/workqueue.h>

#define KCI_CONTRUP 0 /* arg: struct capi_profile */
#define KCI_CONTRDOWN 1 /* arg: NULL */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9264139..5c55676 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -30,6 +30,7 @@ #include <linux/if_ether.h>
#include <linux/if_packet.h>

#ifdef __KERNEL__
+#include <linux/timer.h>
#include <asm/atomic.h>
#include <asm/cache.h>
#include <asm/byteorder.h>
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 64e8680..9657019 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -9,6 +9,7 @@ #include <linux/bitops.h>
#include <linux/compiler.h>
#include <asm/atomic.h>

+#include <linux/timer.h>
#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6aa8b11..60be90a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -22,7 +22,6 @@ #include <linux/cache.h>
#include <asm/atomic.h>
#include <asm/types.h>
#include <linux/spinlock.h>
-#include <linux/mm.h>
#include <linux/net.h>
#include <linux/textsearch.h>
#include <net/checksum.h>
diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h
index 2c5d886..cb61568 100644
--- a/include/net/irda/timer.h
+++ b/include/net/irda/timer.h
@@ -28,6 +28,7 @@ #ifndef TIMER_H
#define TIMER_H

#include <linux/timer.h>
+#include <linux/jiffies.h>

#include <asm/param.h> /* for HZ */

diff --git a/include/net/netlink.h b/include/net/netlink.h
index ce5cba1..6798847 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -3,6 +3,7 @@ #define __NET_NETLINK_H

#include <linux/types.h>
#include <linux/netlink.h>
+#include <linux/jiffies.h>

/* ========================================================================
* Netlink Messages and Attributes Interface (As Seen On TV)
diff --git a/include/net/sock.h b/include/net/sock.h
index 40bb90e..fb5fb0c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -47,6 +47,7 @@ #include <linux/module.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h> /* struct sk_buff */
+#include <linux/mm.h>
#include <linux/security.h>

#include <linux/filter.h>
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 4200ec5..fc1f99a 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -16,6 +16,7 @@ #include <linux/slab.h>
#include <linux/random.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/mm.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <asm/string.h>
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c
index 1b2efff..7a95c3d 100644
--- a/net/ieee80211/ieee80211_crypt_wep.c
+++ b/net/ieee80211/ieee80211_crypt_wep.c
@@ -15,6 +15,7 @@ #include <linux/init.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/skbuff.h>
+#include <linux/mm.h>
#include <asm/string.h>

#include <net/ieee80211.h>
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c
index 524751e..a4385a2 100644
--- a/net/ipv4/ipvs/ip_vs_lblc.c
+++ b/net/ipv4/ipvs/ip_vs_lblc.c
@@ -45,6 +45,7 @@ #include <linux/ip.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
+#include <linux/jiffies.h>

/* for sysctl */
#include <linux/fs.h>
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index 0899019..fe1af5d 100644
--- a/net/ipv4/ipvs/ip_vs_lblcr.c
+++ b/net/ipv4/ipvs/ip_vs_lblcr.c
@@ -43,6 +43,7 @@ #include <linux/ip.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
+#include <linux/jiffies.h>

/* for sysctl */
#include <linux/fs.h>
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c
index 33ccdbf..906eda8 100644
--- a/net/ipv4/netfilter/ipt_hashlimit.c
+++ b/net/ipv4/netfilter/ipt_hashlimit.c
@@ -31,6 +31,7 @@ #include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/list.h>
+#include <linux/mm.h>

#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_hashlimit.h>
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index 3fefc82..89fd2a2 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -32,6 +32,7 @@

#include <linux/string.h>
#include <linux/socket.h>
+#include <linux/fs.h>
#include <linux/seq_file.h>

#include <net/irda/irda.h>
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 415cf4e..d640889 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/types.h>
#include <linux/skbuff.h>
+#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/seq_file.h>
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 3c2e70b..6a56165 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -26,6 +26,7 @@

#include <linux/skbuff.h>
#include <linux/init.h>
+#include <linux/fs.h>
#include <linux/seq_file.h>

#include <asm/byteorder.h>
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 58522fc..8996584 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -21,6 +21,7 @@ #include <linux/seq_file.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/mutex.h>
+#include <linux/mm.h>

#include <linux/netfilter/x_tables.h>
#include <linux/netfilter_arp.h>
--
1.4.2.GIT

2006-10-20 04:34:14

by Randy Dunlap

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Fri, 20 Oct 2006 01:53:37 +0100 Al Viro wrote:

> Done. Several more in followups.

Here's about half of checking includers of linux/smp_lock.h to see
if they actually use any of its interfaces. (most don't)

Yet to do: fs/* and arch/*
Built only on x86_64.

---

From: Randy Dunlap <[email protected]>

Remove includes of <linux/smp_lock.h> where it is not used/needed.

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/acpi/osl.c | 1 -
drivers/block/acsi_slm.c | 1 -
drivers/block/umem.c | 1 -
drivers/char/ds1620.c | 1 -
drivers/char/dsp56k.c | 1 -
drivers/char/dtlk.c | 1 -
drivers/char/ec3104_keyb.c | 1 -
drivers/char/ftape/zftape/zftape-init.c | 1 -
drivers/char/hangcheck-timer.c | 1 -
drivers/char/ip27-rtc.c | 1 -
drivers/char/lp.c | 1 -
drivers/char/mem.c | 1 -
drivers/char/mxser.c | 1 -
drivers/char/ppdev.c | 1 -
drivers/char/sysrq.c | 1 -
drivers/char/vc_screen.c | 1 -
drivers/char/watchdog/omap_wdt.c | 1 -
drivers/char/watchdog/pcwd_usb.c | 1 -
drivers/i2c/busses/scx200_acb.c | 1 -
drivers/i2c/i2c-dev.c | 1 -
drivers/ieee1394/raw1394.c | 1 -
drivers/infiniband/ulp/iser/iser_verbs.c | 1 -
drivers/input/evdev.c | 1 -
drivers/input/input.c | 1 -
drivers/input/joydev.c | 1 -
drivers/input/misc/uinput.c | 1 -
drivers/input/mousedev.c | 1 -
drivers/input/tsdev.c | 1 -
drivers/isdn/capi/capi.c | 1 -
drivers/isdn/divert/divert_procfs.c | 1 -
drivers/isdn/hardware/eicon/capimain.c | 1 -
drivers/isdn/hardware/eicon/divamnt.c | 1 -
drivers/isdn/hardware/eicon/divasi.c | 1 -
drivers/isdn/hardware/eicon/divasmain.c | 1 -
drivers/isdn/hardware/eicon/platform.h | 1 -
drivers/isdn/hisax/hfc_usb.c | 1 -
drivers/macintosh/therm_adt746x.c | 1 -
drivers/macintosh/therm_pm72.c | 1 -
drivers/macintosh/windfarm_core.c | 1 -
drivers/media/dvb/bt8xx/dst_common.h | 1 -
drivers/media/dvb/ttpci/av7110_av.c | 1 -
drivers/media/dvb/ttpci/av7110_ca.c | 1 -
drivers/media/dvb/ttpci/av7110_hw.c | 1 -
drivers/media/dvb/ttpci/av7110_v4l.c | 1 -
drivers/media/radio/dsbr100.c | 1 -
drivers/media/video/cpia.h | 1 -
drivers/media/video/cpia_pp.c | 1 -
drivers/media/video/cx88/cx88-tvaudio.c | 1 -
drivers/media/video/dabusb.c | 1 -
drivers/media/video/ov511.h | 1 -
drivers/media/video/pvrusb2/pvrusb2-main.c | 1 -
drivers/media/video/saa7134/saa7134-tvaudio.c | 1 -
drivers/media/video/se401.h | 1 -
drivers/media/video/tvaudio.c | 1 -
drivers/media/video/usbvideo/usbvideo.c | 1 -
drivers/media/video/v4l1-compat.c | 1 -
drivers/media/video/v4l2-common.c | 1 -
drivers/media/video/videodev.c | 1 -
drivers/mfd/ucb1x00-ts.c | 1 -
drivers/net/irda/sir_dev.c | 1 -
drivers/net/irda/sir_dongle.c | 1 -
drivers/net/irda/vlsi_ir.c | 1 -
drivers/net/ns83820.c | 1 -
drivers/net/ppp_generic.c | 1 -
drivers/net/wan/cosa.c | 1 -
drivers/net/wireless/airo.c | 1 -
drivers/net/wireless/hostap/hostap_ioctl.c | 1 -
drivers/parisc/lba_pci.c | 1 -
drivers/pci/hotplug/acpiphp_core.c | 1 -
drivers/pci/hotplug/acpiphp_glue.c | 1 -
drivers/pci/hotplug/ibmphp_core.c | 1 -
drivers/pci/hotplug/ibmphp_hpc.c | 1 -
drivers/pci/hotplug/pci_hotplug_core.c | 1 -
drivers/pci/hotplug/rpaphp_core.c | 1 -
drivers/pci/hotplug/shpchp_ctrl.c | 1 -
drivers/pci/msi.c | 1 -
drivers/pci/proc.c | 1 -
drivers/sbus/char/bpp.c | 1 -
drivers/sbus/char/rtc.c | 1 -
drivers/sbus/char/vfc_dev.c | 1 -
drivers/scsi/aic7xxx/aic79xx_osm.h | 1 -
drivers/scsi/aic7xxx/aic7xxx_osm.h | 1 -
drivers/scsi/dpt_i2o.c | 1 -
drivers/scsi/scsi_debug.c | 1 -
drivers/scsi/sg.c | 1 -
drivers/serial/icom.c | 1 -
drivers/usb/atm/usbatm.c | 1 -
drivers/usb/class/cdc-acm.c | 1 -
drivers/usb/class/usblp.c | 1 -
drivers/usb/core/hub.c | 1 -
drivers/usb/core/inode.c | 1 -
drivers/usb/core/usb.c | 1 -
drivers/usb/gadget/at91_udc.c | 1 -
drivers/usb/gadget/dummy_hcd.c | 1 -
drivers/usb/gadget/ether.c | 1 -
drivers/usb/gadget/goku_udc.c | 1 -
drivers/usb/gadget/net2280.c | 1 -
drivers/usb/gadget/serial.c | 1 -
drivers/usb/gadget/zero.c | 1 -
drivers/usb/host/ehci-hcd.c | 1 -
drivers/usb/host/ohci-hcd.c | 1 -
drivers/usb/host/sl811-hcd.c | 1 -
drivers/usb/host/u132-hcd.c | 1 -
drivers/usb/image/mdc800.c | 1 -
drivers/usb/image/microtek.c | 1 -
drivers/usb/input/hid-core.c | 1 -
drivers/usb/input/hiddev.c | 1 -
drivers/usb/input/xpad.c | 1 -
drivers/usb/misc/idmouse.c | 1 -
drivers/usb/misc/legousbtower.c | 1 -
drivers/usb/misc/rio500.c | 1 -
drivers/usb/misc/sisusbvga/sisusb_con.c | 1 -
drivers/usb/mon/mon_main.c | 1 -
drivers/usb/serial/usb-serial.c | 1 -
drivers/usb/storage/usb.h | 1 -
drivers/video/sis/sis.h | 1 -
drivers/video/sis/sis_main.c | 1 -
ipc/sem.c | 1 -
ipc/util.c | 1 -
kernel/cpuset.c | 1 -
kernel/exit.c | 1 -
kernel/fork.c | 1 -
kernel/itimer.c | 1 -
kernel/kmod.c | 1 -
kernel/posix-timers.c | 1 -
kernel/power/process.c | 1 -
kernel/power/snapshot.c | 1 -
kernel/power/swap.c | 1 -
kernel/printk.c | 1 -
kernel/signal.c | 1 -
kernel/time.c | 1 -
kernel/uid16.c | 1 -
net/appletalk/ddp.c | 1 -
net/ax25/af_ax25.c | 1 -
net/bluetooth/bnep/core.c | 1 -
net/bridge/br_stp.c | 1 -
net/bridge/br_stp_if.c | 1 -
net/bridge/br_stp_timer.c | 1 -
net/core/netpoll.c | 1 -
net/core/pktgen.c | 1 -
net/ipv4/af_inet.c | 1 -
net/ipv4/tcp.c | 1 -
net/ipv4/tcp_output.c | 1 -
net/ipv6/af_inet6.c | 1 -
net/ipx/af_ipx.c | 1 -
net/irda/af_irda.c | 1 -
net/netlink/af_netlink.c | 1 -
net/unix/af_unix.c | 1 -
net/x25/af_x25.c | 1 -
security/capability.c | 1 -
security/commoncap.c | 1 -
security/selinux/hooks.c | 1 -
sound/core/control.c | 1 -
sound/core/hwdep.c | 1 -
sound/core/oss/mixer_oss.c | 1 -
sound/core/oss/pcm_oss.c | 1 -
sound/core/pcm_native.c | 1 -
sound/core/rawmidi.c | 1 -
sound/core/seq/oss/seq_oss.c | 1 -
sound/core/seq/seq_clientmgr.c | 1 -
sound/core/timer.c | 1 -
sound/oss/emu10k1/audio.c | 1 -
sound/oss/emu10k1/passthrough.c | 1 -
sound/oss/swarm_cs4297a.c | 1 -
sound/oss/trident.c | 1 -
sound/oss/via82cxxx_audio.c | 1 -
166 files changed, 166 deletions(-)

--- linux-2619-rc2g2.orig/ipc/sem.c
+++ linux-2619-rc2g2/ipc/sem.c
@@ -75,7 +75,6 @@
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/time.h>
-#include <linux/smp_lock.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/audit.h>
--- linux-2619-rc2g2.orig/ipc/util.c
+++ linux-2619-rc2g2/ipc/util.c
@@ -21,7 +21,6 @@
#include <linux/shm.h>
#include <linux/init.h>
#include <linux/msg.h>
-#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/capability.h>
--- linux-2619-rc2g2.orig/kernel/cpuset.c
+++ linux-2619-rc2g2/kernel/cpuset.c
@@ -42,7 +42,6 @@
#include <linux/seq_file.h>
#include <linux/security.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/stat.h>
#include <linux/string.h>
--- linux-2619-rc2g2.orig/kernel/exit.c
+++ linux-2619-rc2g2/kernel/exit.c
@@ -7,7 +7,6 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
-#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/capability.h>
#include <linux/completion.h>
--- linux-2619-rc2g2.orig/kernel/fork.c
+++ linux-2619-rc2g2/kernel/fork.c
@@ -14,7 +14,6 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/unistd.h>
-#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/completion.h>
--- linux-2619-rc2g2.orig/kernel/itimer.c
+++ linux-2619-rc2g2/kernel/itimer.c
@@ -7,7 +7,6 @@
/* These are all the functions necessary to implement itimers */

#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/syscalls.h>
#include <linux/time.h>
--- linux-2619-rc2g2.orig/kernel/kmod.c
+++ linux-2619-rc2g2/kernel/kmod.c
@@ -23,7 +23,6 @@
#include <linux/syscalls.h>
#include <linux/unistd.h>
#include <linux/kmod.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/namespace.h>
#include <linux/completion.h>
--- linux-2619-rc2g2.orig/kernel/posix-timers.c
+++ linux-2619-rc2g2/kernel/posix-timers.c
@@ -31,7 +31,6 @@
* POSIX clocks & timers
*/
#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/time.h>
--- linux-2619-rc2g2.orig/kernel/power/process.c
+++ linux-2619-rc2g2/kernel/power/process.c
@@ -8,7 +8,6 @@

#undef DEBUG

-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/suspend.h>
#include <linux/module.h>
--- linux-2619-rc2g2.orig/kernel/power/snapshot.c
+++ linux-2619-rc2g2/kernel/power/snapshot.c
@@ -14,7 +14,6 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/suspend.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/bitops.h>
#include <linux/spinlock.h>
--- linux-2619-rc2g2.orig/kernel/power/swap.c
+++ linux-2619-rc2g2/kernel/power/swap.c
@@ -12,7 +12,6 @@
*/

#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/file.h>
#include <linux/utsname.h>
#include <linux/version.h>
--- linux-2619-rc2g2.orig/kernel/printk.c
+++ linux-2619-rc2g2/kernel/printk.c
@@ -20,7 +20,6 @@
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
-#include <linux/smp_lock.h>
#include <linux/console.h>
#include <linux/init.h>
#include <linux/module.h>
--- linux-2619-rc2g2.orig/kernel/signal.c
+++ linux-2619-rc2g2/kernel/signal.c
@@ -12,7 +12,6 @@

#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/fs.h>
--- linux-2619-rc2g2.orig/kernel/time.c
+++ linux-2619-rc2g2/kernel/time.c
@@ -31,7 +31,6 @@
#include <linux/timex.h>
#include <linux/capability.h>
#include <linux/errno.h>
-#include <linux/smp_lock.h>
#include <linux/syscalls.h>
#include <linux/security.h>
#include <linux/fs.h>
--- linux-2619-rc2g2.orig/kernel/uid16.c
+++ linux-2619-rc2g2/kernel/uid16.c
@@ -6,7 +6,6 @@
#include <linux/mm.h>
#include <linux/utsname.h>
#include <linux/mman.h>
-#include <linux/smp_lock.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/prctl.h>
--- linux-2619-rc2g2.orig/security/capability.c
+++ linux-2619-rc2g2/security/capability.c
@@ -17,7 +17,6 @@
#include <linux/mman.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
-#include <linux/smp_lock.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/ptrace.h>
--- linux-2619-rc2g2.orig/security/commoncap.c
+++ linux-2619-rc2g2/security/commoncap.c
@@ -17,7 +17,6 @@
#include <linux/mman.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
-#include <linux/smp_lock.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/ptrace.h>
--- linux-2619-rc2g2.orig/security/selinux/hooks.c
+++ linux-2619-rc2g2/security/selinux/hooks.c
@@ -35,7 +35,6 @@
#include <linux/slab.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
-#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/syscalls.h>
#include <linux/file.h>
--- linux-2619-rc2g2.orig/net/appletalk/ddp.c
+++ linux-2619-rc2g2/net/appletalk/ddp.c
@@ -1839,7 +1839,6 @@ static const struct proto_ops SOCKOPS_WR
.sendpage = sock_no_sendpage,
};

-#include <linux/smp_lock.h>
SOCKOPS_WRAP(atalk_dgram, PF_APPLETALK);

static struct notifier_block ddp_notifier = {
--- linux-2619-rc2g2.orig/net/ax25/af_ax25.c
+++ linux-2619-rc2g2/net/ax25/af_ax25.c
@@ -23,7 +23,6 @@
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/string.h>
-#include <linux/smp_lock.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <net/ax25.h>
--- linux-2619-rc2g2.orig/net/bluetooth/bnep/core.c
+++ linux-2619-rc2g2/net/bluetooth/bnep/core.c
@@ -37,7 +37,6 @@
#include <linux/init.h>
#include <linux/wait.h>
#include <linux/errno.h>
-#include <linux/smp_lock.h>
#include <linux/net.h>
#include <net/sock.h>

--- linux-2619-rc2g2.orig/net/bridge/br_stp.c
+++ linux-2619-rc2g2/net/bridge/br_stp.c
@@ -13,7 +13,6 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/kernel.h>
-#include <linux/smp_lock.h>

#include "br_private.h"
#include "br_private_stp.h"
--- linux-2619-rc2g2.orig/net/bridge/br_stp_if.c
+++ linux-2619-rc2g2/net/bridge/br_stp_if.c
@@ -14,7 +14,6 @@
*/

#include <linux/kernel.h>
-#include <linux/smp_lock.h>
#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>

--- linux-2619-rc2g2.orig/net/bridge/br_stp_timer.c
+++ linux-2619-rc2g2/net/bridge/br_stp_timer.c
@@ -15,7 +15,6 @@

#include <linux/kernel.h>
#include <linux/times.h>
-#include <linux/smp_lock.h>

#include "br_private.h"
#include "br_private_stp.h"
--- linux-2619-rc2g2.orig/net/core/netpoll.c
+++ linux-2619-rc2g2/net/core/netpoll.c
@@ -9,7 +9,6 @@
* Copyright (C) 2002 Red Hat, Inc.
*/

-#include <linux/smp_lock.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/string.h>
--- linux-2619-rc2g2.orig/net/core/pktgen.c
+++ linux-2619-rc2g2/net/core/pktgen.c
@@ -117,7 +117,6 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/slab.h>
--- linux-2619-rc2g2.orig/net/ipv4/af_inet.c
+++ linux-2619-rc2g2/net/ipv4/af_inet.c
@@ -91,7 +91,6 @@
#include <asm/uaccess.h>
#include <asm/system.h>

-#include <linux/smp_lock.h>
#include <linux/inet.h>
#include <linux/igmp.h>
#include <linux/inetdevice.h>
--- linux-2619-rc2g2.orig/net/ipv4/tcp.c
+++ linux-2619-rc2g2/net/ipv4/tcp.c
@@ -252,7 +252,6 @@
#include <linux/fcntl.h>
#include <linux/poll.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/fs.h>
#include <linux/random.h>
#include <linux/bootmem.h>
--- linux-2619-rc2g2.orig/net/ipv4/tcp_output.c
+++ linux-2619-rc2g2/net/ipv4/tcp_output.c
@@ -40,7 +40,6 @@

#include <linux/compiler.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>

/* People can turn this off for buggy TCP's found in printers etc. */
int sysctl_tcp_retrans_collapse __read_mostly = 1;
--- linux-2619-rc2g2.orig/net/ipv6/af_inet6.c
+++ linux-2619-rc2g2/net/ipv6/af_inet6.c
@@ -43,7 +43,6 @@
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/icmpv6.h>
-#include <linux/smp_lock.h>
#include <linux/netfilter_ipv6.h>

#include <net/ip.h>
--- linux-2619-rc2g2.orig/net/ipx/af_ipx.c
+++ linux-2619-rc2g2/net/ipx/af_ipx.c
@@ -1952,7 +1952,6 @@ static const struct proto_ops SOCKOPS_WR
.sendpage = sock_no_sendpage,
};

-#include <linux/smp_lock.h>
SOCKOPS_WRAP(ipx_dgram, PF_IPX);

static struct packet_type ipx_8023_packet_type = {
--- linux-2619-rc2g2.orig/net/irda/af_irda.c
+++ linux-2619-rc2g2/net/irda/af_irda.c
@@ -2581,7 +2581,6 @@ static const struct proto_ops SOCKOPS_WR
};
#endif /* CONFIG_IRDA_ULTRA */

-#include <linux/smp_lock.h>
SOCKOPS_WRAP(irda_stream, PF_IRDA);
SOCKOPS_WRAP(irda_seqpacket, PF_IRDA);
SOCKOPS_WRAP(irda_dgram, PF_IRDA);
--- linux-2619-rc2g2.orig/net/netlink/af_netlink.c
+++ linux-2619-rc2g2/net/netlink/af_netlink.c
@@ -45,7 +45,6 @@
#include <linux/rtnetlink.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
-#include <linux/smp_lock.h>
#include <linux/notifier.h>
#include <linux/security.h>
#include <linux/jhash.h>
--- linux-2619-rc2g2.orig/net/unix/af_unix.c
+++ linux-2619-rc2g2/net/unix/af_unix.c
@@ -111,7 +111,6 @@
#include <net/scm.h>
#include <linux/init.h>
#include <linux/poll.h>
-#include <linux/smp_lock.h>
#include <linux/rtnetlink.h>
#include <linux/mount.h>
#include <net/checksum.h>
--- linux-2619-rc2g2.orig/net/x25/af_x25.c
+++ linux-2619-rc2g2/net/x25/af_x25.c
@@ -1576,7 +1576,6 @@ static const struct proto_ops SOCKOPS_WR
.sendpage = sock_no_sendpage,
};

-#include <linux/smp_lock.h>
SOCKOPS_WRAP(x25_proto, AF_X25);

static struct packet_type x25_packet_type = {
--- linux-2619-rc2g2.orig/sound/core/control.c
+++ linux-2619-rc2g2/sound/core/control.c
@@ -22,7 +22,6 @@
#include <sound/driver.h>
#include <linux/threads.h>
#include <linux/interrupt.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/time.h>
--- linux-2619-rc2g2.orig/sound/core/hwdep.c
+++ linux-2619-rc2g2/sound/core/hwdep.c
@@ -22,7 +22,6 @@
#include <sound/driver.h>
#include <linux/major.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/mutex.h>
--- linux-2619-rc2g2.orig/sound/core/oss/mixer_oss.c
+++ linux-2619-rc2g2/sound/core/oss/mixer_oss.c
@@ -21,7 +21,6 @@

#include <sound/driver.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/string.h>
--- linux-2619-rc2g2.orig/sound/core/oss/pcm_oss.c
+++ linux-2619-rc2g2/sound/core/oss/pcm_oss.c
@@ -28,7 +28,6 @@

#include <sound/driver.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/vmalloc.h>
--- linux-2619-rc2g2.orig/sound/core/pcm_native.c
+++ linux-2619-rc2g2/sound/core/pcm_native.c
@@ -21,7 +21,6 @@

#include <sound/driver.h>
#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/file.h>
#include <linux/slab.h>
#include <linux/time.h>
--- linux-2619-rc2g2.orig/sound/core/rawmidi.c
+++ linux-2619-rc2g2/sound/core/rawmidi.c
@@ -23,7 +23,6 @@
#include <sound/core.h>
#include <linux/major.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/time.h>
--- linux-2619-rc2g2.orig/sound/core/seq/oss/seq_oss.c
+++ linux-2619-rc2g2/sound/core/seq/oss/seq_oss.c
@@ -22,7 +22,6 @@

#include <sound/driver.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h>
--- linux-2619-rc2g2.orig/sound/core/seq/seq_clientmgr.c
+++ linux-2619-rc2g2/sound/core/seq/seq_clientmgr.c
@@ -23,7 +23,6 @@

#include <sound/driver.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/minors.h>
--- linux-2619-rc2g2.orig/sound/core/timer.c
+++ linux-2619-rc2g2/sound/core/timer.c
@@ -22,7 +22,6 @@
#include <sound/driver.h>
#include <linux/delay.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/mutex.h>
--- linux-2619-rc2g2.orig/sound/oss/emu10k1/audio.c
+++ linux-2619-rc2g2/sound/oss/emu10k1/audio.c
@@ -36,7 +36,6 @@
#include <linux/bitops.h>
#include <asm/io.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>

#include "hwaccess.h"
#include "cardwo.h"
--- linux-2619-rc2g2.orig/sound/oss/emu10k1/passthrough.c
+++ linux-2619-rc2g2/sound/oss/emu10k1/passthrough.c
@@ -35,7 +35,6 @@
#include <linux/bitops.h>
#include <asm/io.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>

#include "hwaccess.h"
#include "cardwo.h"
--- linux-2619-rc2g2.orig/sound/oss/swarm_cs4297a.c
+++ linux-2619-rc2g2/sound/oss/swarm_cs4297a.c
@@ -75,7 +75,6 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/poll.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>

#include <asm/byteorder.h>
--- linux-2619-rc2g2.orig/sound/oss/trident.c
+++ linux-2619-rc2g2/sound/oss/trident.c
@@ -207,7 +207,6 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/ac97_codec.h>
#include <linux/bitops.h>
#include <linux/proc_fs.h>
--- linux-2619-rc2g2.orig/sound/oss/via82cxxx_audio.c
+++ linux-2619-rc2g2/sound/oss/via82cxxx_audio.c
@@ -32,7 +32,6 @@
#include <linux/poll.h>
#include <linux/soundcard.h>
#include <linux/ac97_codec.h>
-#include <linux/smp_lock.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
--- linux-2619-rc2g2.orig/drivers/acpi/osl.c
+++ linux-2619-rc2g2/drivers/acpi/osl.c
@@ -30,7 +30,6 @@
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/pci.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/kmod.h>
#include <linux/delay.h>
--- linux-2619-rc2g2.orig/drivers/block/acsi_slm.c
+++ linux-2619-rc2g2/drivers/block/acsi_slm.c
@@ -65,7 +65,6 @@ not be guaranteed. There are several way
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>

#include <asm/pgtable.h>
#include <asm/system.h>
--- linux-2619-rc2g2.orig/drivers/block/umem.c
+++ linux-2619-rc2g2/drivers/block/umem.c
@@ -45,7 +45,6 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
-#include <linux/smp_lock.h>
#include <linux/timer.h>
#include <linux/pci.h>
#include <linux/slab.h>
--- linux-2619-rc2g2.orig/drivers/char/ds1620.c
+++ linux-2619-rc2g2/drivers/char/ds1620.c
@@ -5,7 +5,6 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/miscdevice.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/capability.h>
--- linux-2619-rc2g2.orig/drivers/char/dsp56k.c
+++ linux-2619-rc2g2/drivers/char/dsp56k.c
@@ -33,7 +33,6 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/device.h>

#include <asm/atarihw.h>
--- linux-2619-rc2g2.orig/drivers/char/dtlk.c
+++ linux-2619-rc2g2/drivers/char/dtlk.c
@@ -62,7 +62,6 @@
#include <linux/init.h> /* for __init, module_{init,exit} */
#include <linux/poll.h> /* for POLLIN, etc. */
#include <linux/dtlk.h> /* local header file for DoubleTalk values */
-#include <linux/smp_lock.h>

#ifdef TRACING
#define TRACE_TEXT(str) printk(str);
--- linux-2619-rc2g2.orig/drivers/char/ec3104_keyb.c
+++ linux-2619-rc2g2/drivers/char/ec3104_keyb.c
@@ -41,7 +41,6 @@
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <linux/kbd_kern.h>
-#include <linux/smp_lock.h>
#include <linux/bitops.h>

#include <asm/keyboard.h>
--- linux-2619-rc2g2.orig/drivers/char/ftape/zftape/zftape-init.c
+++ linux-2619-rc2g2/drivers/char/ftape/zftape/zftape-init.c
@@ -31,7 +31,6 @@
#include <linux/kmod.h>
#endif
#include <linux/fcntl.h>
-#include <linux/smp_lock.h>

#include <linux/zftape.h>
#include <linux/init.h>
--- linux-2619-rc2g2.orig/drivers/char/hangcheck-timer.c
+++ linux-2619-rc2g2/drivers/char/hangcheck-timer.c
@@ -44,7 +44,6 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/reboot.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
--- linux-2619-rc2g2.orig/drivers/char/ip27-rtc.c
+++ linux-2619-rc2g2/drivers/char/ip27-rtc.c
@@ -35,7 +35,6 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
-#include <linux/smp_lock.h>

#include <asm/m48t35.h>
#include <asm/sn/ioc3.h>
--- linux-2619-rc2g2.orig/drivers/char/lp.c
+++ linux-2619-rc2g2/drivers/char/lp.c
@@ -118,7 +118,6 @@
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/fcntl.h>
#include <linux/delay.h>
--- linux-2619-rc2g2.orig/drivers/char/mem.c
+++ linux-2619-rc2g2/drivers/char/mem.c
@@ -18,7 +18,6 @@
#include <linux/raw.h>
#include <linux/tty.h>
#include <linux/capability.h>
-#include <linux/smp_lock.h>
#include <linux/ptrace.h>
#include <linux/device.h>
#include <linux/highmem.h>
--- linux-2619-rc2g2.orig/drivers/char/mxser.c
+++ linux-2619-rc2g2/drivers/char/mxser.c
@@ -54,7 +54,6 @@
#include <linux/gfp.h>
#include <linux/ioport.h>
#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/pci.h>

--- linux-2619-rc2g2.orig/drivers/char/ppdev.c
+++ linux-2619-rc2g2/drivers/char/ppdev.c
@@ -66,7 +66,6 @@
#include <linux/poll.h>
#include <linux/major.h>
#include <linux/ppdev.h>
-#include <linux/smp_lock.h>
#include <linux/device.h>
#include <asm/uaccess.h>

--- linux-2619-rc2g2.orig/drivers/char/sysrq.c
+++ linux-2619-rc2g2/drivers/char/sysrq.c
@@ -24,7 +24,6 @@
#include <linux/sysrq.h>
#include <linux/kbd_kern.h>
#include <linux/quotaops.h>
-#include <linux/smp_lock.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/suspend.h>
--- linux-2619-rc2g2.orig/drivers/char/vc_screen.c
+++ linux-2619-rc2g2/drivers/char/vc_screen.c
@@ -33,7 +33,6 @@
#include <linux/selection.h>
#include <linux/kbd_kern.h>
#include <linux/console.h>
-#include <linux/smp_lock.h>
#include <linux/device.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
--- linux-2619-rc2g2.orig/drivers/char/watchdog/pcwd_usb.c
+++ linux-2619-rc2g2/drivers/char/watchdog/pcwd_usb.c
@@ -37,7 +37,6 @@
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/fs.h>
-#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
--- linux-2619-rc2g2.orig/drivers/char/watchdog/omap_wdt.c
+++ linux-2619-rc2g2/drivers/char/watchdog/omap_wdt.c
@@ -34,7 +34,6 @@
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/reboot.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
--- linux-2619-rc2g2.orig/drivers/i2c/busses/scx200_acb.c
+++ linux-2619-rc2g2/drivers/i2c/busses/scx200_acb.c
@@ -28,7 +28,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/i2c.h>
-#include <linux/smp_lock.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/mutex.h>
--- linux-2619-rc2g2.orig/drivers/i2c/i2c-dev.c
+++ linux-2619-rc2g2/drivers/i2c/i2c-dev.c
@@ -30,7 +30,6 @@
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/i2c.h>
--- linux-2619-rc2g2.orig/drivers/ieee1394/raw1394.c
+++ linux-2619-rc2g2/drivers/ieee1394/raw1394.c
@@ -35,7 +35,6 @@
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/cdev.h>
--- linux-2619-rc2g2.orig/drivers/infiniband/ulp/iser/iser_verbs.c
+++ linux-2619-rc2g2/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -35,7 +35,6 @@
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/version.h>

--- linux-2619-rc2g2.orig/drivers/input/evdev.c
+++ linux-2619-rc2g2/drivers/input/evdev.c
@@ -18,7 +18,6 @@
#include <linux/init.h>
#include <linux/input.h>
#include <linux/major.h>
-#include <linux/smp_lock.h>
#include <linux/device.h>
#include <linux/compat.h>

--- linux-2619-rc2g2.orig/drivers/input/input.c
+++ linux-2619-rc2g2/drivers/input/input.c
@@ -12,7 +12,6 @@

#include <linux/init.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/random.h>
--- linux-2619-rc2g2.orig/drivers/input/joydev.c
+++ linux-2619-rc2g2/drivers/input/joydev.c
@@ -24,7 +24,6 @@
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/device.h>

MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
--- linux-2619-rc2g2.orig/drivers/input/misc/uinput.c
+++ linux-2619-rc2g2/drivers/input/misc/uinput.c
@@ -34,7 +34,6 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
-#include <linux/smp_lock.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/uinput.h>
--- linux-2619-rc2g2.orig/drivers/input/mousedev.c
+++ linux-2619-rc2g2/drivers/input/mousedev.c
@@ -19,7 +19,6 @@
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/input.h>
-#include <linux/smp_lock.h>
#include <linux/random.h>
#include <linux/major.h>
#include <linux/device.h>
--- linux-2619-rc2g2.orig/drivers/input/tsdev.c
+++ linux-2619-rc2g2/drivers/input/tsdev.c
@@ -48,7 +48,6 @@
#include <linux/init.h>
#include <linux/input.h>
#include <linux/major.h>
-#include <linux/smp_lock.h>
#include <linux/random.h>
#include <linux/time.h>
#include <linux/device.h>
--- linux-2619-rc2g2.orig/drivers/isdn/capi/capi.c
+++ linux-2619-rc2g2/drivers/isdn/capi/capi.c
@@ -19,7 +19,6 @@
#include <linux/fs.h>
#include <linux/signal.h>
#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/timer.h>
#include <linux/wait.h>
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
--- linux-2619-rc2g2.orig/drivers/isdn/divert/divert_procfs.c
+++ linux-2619-rc2g2/drivers/isdn/divert/divert_procfs.c
@@ -11,7 +11,6 @@

#include <linux/module.h>
#include <linux/poll.h>
-#include <linux/smp_lock.h>
#ifdef CONFIG_PROC_FS
#include <linux/proc_fs.h>
#else
--- linux-2619-rc2g2.orig/drivers/isdn/hardware/eicon/capimain.c
+++ linux-2619-rc2g2/drivers/isdn/hardware/eicon/capimain.c
@@ -13,7 +13,6 @@
#include <linux/module.h>
#include <linux/init.h>
#include <asm/uaccess.h>
-#include <linux/smp_lock.h>
#include <linux/skbuff.h>

#include "os_capi.h"
--- linux-2619-rc2g2.orig/drivers/isdn/hardware/eicon/divamnt.c
+++ linux-2619-rc2g2/drivers/isdn/hardware/eicon/divamnt.c
@@ -14,7 +14,6 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <asm/uaccess.h>

--- linux-2619-rc2g2.orig/drivers/isdn/hardware/eicon/divasi.c
+++ linux-2619-rc2g2/drivers/isdn/hardware/eicon/divasi.c
@@ -14,7 +14,6 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
--- linux-2619-rc2g2.orig/drivers/isdn/hardware/eicon/divasmain.c
+++ linux-2619-rc2g2/drivers/isdn/hardware/eicon/divasmain.c
@@ -18,7 +18,6 @@
#include <linux/ioport.h>
#include <linux/workqueue.h>
#include <linux/pci.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/poll.h>
--- linux-2619-rc2g2.orig/drivers/isdn/hardware/eicon/platform.h
+++ linux-2619-rc2g2/drivers/isdn/hardware/eicon/platform.h
@@ -26,7 +26,6 @@
#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/interrupt.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/list.h>
#include <asm/types.h>
--- linux-2619-rc2g2.orig/drivers/isdn/hisax/hfc_usb.c
+++ linux-2619-rc2g2/drivers/isdn/hisax/hfc_usb.c
@@ -37,7 +37,6 @@
#include <linux/kernel_stat.h>
#include <linux/usb.h>
#include <linux/kernel.h>
-#include <linux/smp_lock.h>
#include <linux/sched.h>
#include "hisax.h"
#include "hisax_if.h"
--- linux-2619-rc2g2.orig/drivers/macintosh/therm_adt746x.c
+++ linux-2619-rc2g2/drivers/macintosh/therm_adt746x.c
@@ -19,7 +19,6 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/wait.h>
#include <linux/suspend.h>
#include <linux/kthread.h>
--- linux-2619-rc2g2.orig/drivers/macintosh/therm_pm72.c
+++ linux-2619-rc2g2/drivers/macintosh/therm_pm72.c
@@ -117,7 +117,6 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/wait.h>
#include <linux/reboot.h>
#include <linux/kmod.h>
--- linux-2619-rc2g2.orig/drivers/macintosh/windfarm_core.c
+++ linux-2619-rc2g2/drivers/macintosh/windfarm_core.c
@@ -27,7 +27,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/kthread.h>
#include <linux/jiffies.h>
#include <linux/reboot.h>
--- linux-2619-rc2g2.orig/drivers/media/dvb/bt8xx/dst_common.h
+++ linux-2619-rc2g2/drivers/media/dvb/bt8xx/dst_common.h
@@ -22,7 +22,6 @@
#ifndef DST_COMMON_H
#define DST_COMMON_H

-#include <linux/smp_lock.h>
#include <linux/dvb/frontend.h>
#include <linux/device.h>
#include <linux/mutex.h>
--- linux-2619-rc2g2.orig/drivers/media/dvb/ttpci/av7110_av.c
+++ linux-2619-rc2g2/drivers/media/dvb/ttpci/av7110_av.c
@@ -33,7 +33,6 @@
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/delay.h>
-#include <linux/smp_lock.h>
#include <linux/fs.h>

#include "av7110.h"
--- linux-2619-rc2g2.orig/drivers/media/dvb/ttpci/av7110_ca.c
+++ linux-2619-rc2g2/drivers/media/dvb/ttpci/av7110_ca.c
@@ -35,7 +35,6 @@
#include <linux/fs.h>
#include <linux/timer.h>
#include <linux/poll.h>
-#include <linux/smp_lock.h>

#include "av7110.h"
#include "av7110_hw.h"
--- linux-2619-rc2g2.orig/drivers/media/dvb/ttpci/av7110_hw.c
+++ linux-2619-rc2g2/drivers/media/dvb/ttpci/av7110_hw.c
@@ -34,7 +34,6 @@
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/delay.h>
-#include <linux/smp_lock.h>
#include <linux/fs.h>

#include "av7110.h"
--- linux-2619-rc2g2.orig/drivers/media/dvb/ttpci/av7110_v4l.c
+++ linux-2619-rc2g2/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -32,7 +32,6 @@
#include <linux/fs.h>
#include <linux/timer.h>
#include <linux/poll.h>
-#include <linux/smp_lock.h>

#include "av7110.h"
#include "av7110_hw.h"
--- linux-2619-rc2g2.orig/drivers/media/radio/dsbr100.c
+++ linux-2619-rc2g2/drivers/media/radio/dsbr100.c
@@ -79,7 +79,6 @@
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <linux/usb.h>
-#include <linux/smp_lock.h>

/*
* Version Information
--- linux-2619-rc2g2.orig/drivers/media/video/cpia.h
+++ linux-2619-rc2g2/drivers/media/video/cpia.h
@@ -47,7 +47,6 @@
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <linux/list.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>

struct cpia_camera_ops
--- linux-2619-rc2g2.orig/drivers/media/video/cpia_pp.c
+++ linux-2619-rc2g2/drivers/media/video/cpia_pp.c
@@ -34,7 +34,6 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
-#include <linux/smp_lock.h>
#include <linux/sched.h>

#include <linux/kmod.h>
--- linux-2619-rc2g2.orig/drivers/media/video/cx88/cx88-tvaudio.c
+++ linux-2619-rc2g2/drivers/media/video/cx88/cx88-tvaudio.c
@@ -50,7 +50,6 @@
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/kthread.h>

--- linux-2619-rc2g2.orig/drivers/media/video/dabusb.c
+++ linux-2619-rc2g2/drivers/media/video/dabusb.c
@@ -37,7 +37,6 @@
#include <asm/atomic.h>
#include <linux/delay.h>
#include <linux/usb.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>

#include "dabusb.h"
--- linux-2619-rc2g2.orig/drivers/media/video/ov511.h
+++ linux-2619-rc2g2/drivers/media/video/ov511.h
@@ -4,7 +4,6 @@
#include <asm/uaccess.h>
#include <linux/videodev.h>
#include <media/v4l2-common.h>
-#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/mutex.h>

--- linux-2619-rc2g2.orig/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ linux-2619-rc2g2/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -25,7 +25,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/videodev2.h>

--- linux-2619-rc2g2.orig/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ linux-2619-rc2g2/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -27,7 +27,6 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>
-#include <linux/smp_lock.h>
#include <asm/div64.h>

#include "saa7134-reg.h"
--- linux-2619-rc2g2.orig/drivers/media/video/se401.h
+++ linux-2619-rc2g2/drivers/media/video/se401.h
@@ -5,7 +5,6 @@
#include <asm/uaccess.h>
#include <linux/videodev.h>
#include <media/v4l2-common.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>

#define se401_DEBUG /* Turn on debug messages */
--- linux-2619-rc2g2.orig/drivers/media/video/tvaudio.c
+++ linux-2619-rc2g2/drivers/media/video/tvaudio.c
@@ -27,7 +27,6 @@
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/kthread.h>

#include <media/tvaudio.h>
--- linux-2619-rc2g2.orig/drivers/media/video/usbvideo/usbvideo.c
+++ linux-2619-rc2g2/drivers/media/video/usbvideo/usbvideo.c
@@ -20,7 +20,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/spinlock.h>
--- linux-2619-rc2g2.orig/drivers/media/video/v4l1-compat.c
+++ linux-2619-rc2g2/drivers/media/video/v4l1-compat.c
@@ -23,7 +23,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/file.h>
--- linux-2619-rc2g2.orig/drivers/media/video/v4l2-common.c
+++ linux-2619-rc2g2/drivers/media/video/v4l2-common.c
@@ -48,7 +48,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
--- linux-2619-rc2g2.orig/drivers/media/video/videodev.c
+++ linux-2619-rc2g2/drivers/media/video/videodev.c
@@ -31,7 +31,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
--- linux-2619-rc2g2.orig/drivers/mfd/ucb1x00-ts.c
+++ linux-2619-rc2g2/drivers/mfd/ucb1x00-ts.c
@@ -21,7 +21,6 @@
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include <linux/sched.h>
#include <linux/completion.h>
#include <linux/delay.h>
--- linux-2619-rc2g2.orig/drivers/net/irda/sir_dev.c
+++ linux-2619-rc2g2/drivers/net/irda/sir_dev.c
@@ -14,7 +14,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>

#include <net/irda/irda.h>
--- linux-2619-rc2g2.orig/drivers/net/irda/sir_dongle.c
+++ linux-2619-rc2g2/drivers/net/irda/sir_dongle.c
@@ -14,7 +14,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/kmod.h>
#include <linux/mutex.h>

--- linux-2619-rc2g2.orig/drivers/net/irda/vlsi_ir.c
+++ linux-2619-rc2g2/drivers/net/irda/vlsi_ir.c
@@ -44,7 +44,6 @@ MODULE_LICENSE("GPL");
#include <linux/time.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
-#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>

--- linux-2619-rc2g2.orig/drivers/net/ns83820.c
+++ linux-2619-rc2g2/drivers/net/ns83820.c
@@ -104,7 +104,6 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
-#include <linux/smp_lock.h>
#include <linux/workqueue.h>
#include <linux/init.h>
#include <linux/ip.h> /* for iph */
--- linux-2619-rc2g2.orig/drivers/net/ppp_generic.c
+++ linux-2619-rc2g2/drivers/net/ppp_generic.c
@@ -40,7 +40,6 @@
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/rwsem.h>
#include <linux/stddef.h>
#include <linux/device.h>
--- linux-2619-rc2g2.orig/drivers/net/wan/cosa.c
+++ linux-2619-rc2g2/drivers/net/wan/cosa.c
@@ -90,7 +90,6 @@
#include <linux/ioport.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/device.h>

#undef COSA_SLOW_IO /* for testing purposes only */
--- linux-2619-rc2g2.orig/drivers/net/wireless/airo.c
+++ linux-2619-rc2g2/drivers/net/wireless/airo.c
@@ -25,7 +25,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
-#include <linux/smp_lock.h>

#include <linux/sched.h>
#include <linux/ptrace.h>
--- linux-2619-rc2g2.orig/drivers/net/wireless/hostap/hostap_ioctl.c
+++ linux-2619-rc2g2/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -1,7 +1,6 @@
/* ioctl() (mostly Linux Wireless Extensions) routines for Host AP driver */

#include <linux/types.h>
-#include <linux/smp_lock.h>
#include <linux/ethtool.h>
#include <net/ieee80211_crypt.h>

--- linux-2619-rc2g2.orig/drivers/parisc/lba_pci.c
+++ linux-2619-rc2g2/drivers/parisc/lba_pci.c
@@ -38,7 +38,6 @@
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>

#include <asm/byteorder.h>
#include <asm/pdc.h>
--- linux-2619-rc2g2.orig/drivers/pci/hotplug/acpiphp_core.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/acpiphp_core.c
@@ -39,7 +39,6 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include "pci_hotplug.h"
#include "acpiphp.h"

--- linux-2619-rc2g2.orig/drivers/pci/hotplug/acpiphp_glue.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/acpiphp_glue.c
@@ -45,7 +45,6 @@

#include <linux/kernel.h>
#include <linux/pci.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>

#include "../pci.h"
--- linux-2619-rc2g2.orig/drivers/pci/hotplug/ibmphp_core.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/ibmphp_core.c
@@ -34,7 +34,6 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/wait.h>
-#include <linux/smp_lock.h>
#include "../pci.h"
#include "../../../arch/i386/pci/pci.h" /* for struct irq_routing_table */
#include "ibmphp.h"
--- linux-2619-rc2g2.orig/drivers/pci/hotplug/ibmphp_hpc.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/ibmphp_hpc.c
@@ -32,7 +32,6 @@
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/pci.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/mutex.h>

--- linux-2619-rc2g2.orig/drivers/pci/hotplug/pci_hotplug_core.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/pci_hotplug_core.c
@@ -34,7 +34,6 @@
#include <linux/list.h>
#include <linux/pagemap.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/mount.h>
#include <linux/namei.h>
--- linux-2619-rc2g2.orig/drivers/pci/hotplug/rpaphp_core.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/rpaphp_core.c
@@ -28,7 +28,6 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
#include <asm/eeh.h> /* for eeh_add_device() */
#include <asm/rtas.h> /* rtas_call */
--- linux-2619-rc2g2.orig/drivers/pci/hotplug/shpchp_ctrl.c
+++ linux-2619-rc2g2/drivers/pci/hotplug/shpchp_ctrl.c
@@ -30,7 +30,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
-#include <linux/smp_lock.h>
#include <linux/pci.h>
#include <linux/workqueue.h>
#include "../pci.h"
--- linux-2619-rc2g2.orig/drivers/pci/msi.c
+++ linux-2619-rc2g2/drivers/pci/msi.c
@@ -12,7 +12,6 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/ioport.h>
-#include <linux/smp_lock.h>
#include <linux/pci.h>
#include <linux/proc_fs.h>
#include <linux/msi.h>
--- linux-2619-rc2g2.orig/drivers/pci/proc.c
+++ linux-2619-rc2g2/drivers/pci/proc.c
@@ -11,7 +11,6 @@
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
-#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include <asm/byteorder.h>
--- linux-2619-rc2g2.orig/drivers/sbus/char/bpp.c
+++ linux-2619-rc2g2/drivers/sbus/char/bpp.c
@@ -15,7 +15,6 @@
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/ioport.h>
--- linux-2619-rc2g2.orig/drivers/sbus/char/rtc.c
+++ linux-2619-rc2g2/drivers/sbus/char/rtc.c
@@ -19,7 +19,6 @@
#include <linux/fcntl.h>
#include <linux/poll.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/mostek.h>
#include <asm/system.h>
--- linux-2619-rc2g2.orig/drivers/sbus/char/vfc_dev.c
+++ linux-2619-rc2g2/drivers/sbus/char/vfc_dev.c
@@ -21,7 +21,6 @@
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/fs.h>
-#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
--- linux-2619-rc2g2.orig/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ linux-2619-rc2g2/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -47,7 +47,6 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/pci.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/slab.h>
--- linux-2619-rc2g2.orig/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ linux-2619-rc2g2/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -64,7 +64,6 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/pci.h>
-#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/slab.h>
--- linux-2619-rc2g2.orig/drivers/scsi/dpt_i2o.c
+++ linux-2619-rc2g2/drivers/scsi/dpt_i2o.c
@@ -55,7 +55,6 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Dri
#include <linux/sched.h>
#include <linux/reboot.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/dma-mapping.h>

#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/scsi/scsi_debug.c
+++ linux-2619-rc2g2/drivers/scsi/scsi_debug.c
@@ -37,7 +37,6 @@
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
-#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <linux/moduleparam.h>

--- linux-2619-rc2g2.orig/drivers/scsi/sg.c
+++ linux-2619-rc2g2/drivers/scsi/sg.c
@@ -41,7 +41,6 @@ static int sg_version_num = 30534; /* 2
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/poll.h>
-#include <linux/smp_lock.h>
#include <linux/moduleparam.h>
#include <linux/cdev.h>
#include <linux/seq_file.h>
--- linux-2619-rc2g2.orig/drivers/serial/icom.c
+++ linux-2619-rc2g2/drivers/serial/icom.c
@@ -48,7 +48,6 @@
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/kobject.h>
#include <linux/firmware.h>
--- linux-2619-rc2g2.orig/drivers/video/sis/sis.h
+++ linux-2619-rc2g2/drivers/video/sis/sis.h
@@ -51,7 +51,6 @@
#include <linux/ioctl32.h>
#define SIS_OLD_CONFIG_COMPAT
#else
-#include <linux/smp_lock.h>
#define SIS_NEW_CONFIG_COMPAT
#endif
#endif /* CONFIG_COMPAT */
--- linux-2619-rc2g2.orig/drivers/video/sis/sis_main.c
+++ linux-2619-rc2g2/drivers/video/sis/sis_main.c
@@ -37,7 +37,6 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
-#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/string.h>
--- linux-2619-rc2g2.orig/drivers/usb/atm/usbatm.c
+++ linux-2619-rc2g2/drivers/usb/atm/usbatm.c
@@ -77,7 +77,6 @@
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/stat.h>
#include <linux/timer.h>
#include <linux/wait.h>
--- linux-2619-rc2g2.orig/drivers/usb/class/cdc-acm.c
+++ linux-2619-rc2g2/drivers/usb/class/cdc-acm.c
@@ -59,7 +59,6 @@
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
--- linux-2619-rc2g2.orig/drivers/usb/class/usblp.c
+++ linux-2619-rc2g2/drivers/usb/class/usblp.c
@@ -49,7 +49,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/smp_lock.h>
#include <linux/signal.h>
#include <linux/poll.h>
#include <linux/init.h>
--- linux-2619-rc2g2.orig/drivers/usb/core/hub.c
+++ linux-2619-rc2g2/drivers/usb/core/hub.c
@@ -16,7 +16,6 @@
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/ioctl.h>
#include <linux/usb.h>
#include <linux/usbdevice_fs.h>
--- linux-2619-rc2g2.orig/drivers/usb/core/inode.c
+++ linux-2619-rc2g2/drivers/usb/core/inode.c
@@ -36,7 +36,6 @@
#include <linux/usb.h>
#include <linux/namei.h>
#include <linux/usbdevice_fs.h>
-#include <linux/smp_lock.h>
#include <linux/parser.h>
#include <linux/notifier.h>
#include <asm/byteorder.h>
--- linux-2619-rc2g2.orig/drivers/usb/core/usb.c
+++ linux-2619-rc2g2/drivers/usb/core/usb.c
@@ -30,7 +30,6 @@
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
-#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/at91_udc.c
+++ linux-2619-rc2g2/drivers/usb/gadget/at91_udc.c
@@ -32,7 +32,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/list.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/dummy_hcd.c
+++ linux-2619-rc2g2/drivers/usb/gadget/dummy_hcd.c
@@ -42,7 +42,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/ether.c
+++ linux-2619-rc2g2/drivers/usb/gadget/ether.c
@@ -29,7 +29,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/goku_udc.c
+++ linux-2619-rc2g2/drivers/usb/gadget/goku_udc.c
@@ -31,7 +31,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/net2280.c
+++ linux-2619-rc2g2/drivers/usb/gadget/net2280.c
@@ -55,7 +55,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/serial.c
+++ linux-2619-rc2g2/drivers/usb/gadget/serial.c
@@ -23,7 +23,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/gadget/zero.c
+++ linux-2619-rc2g2/drivers/usb/gadget/zero.c
@@ -68,7 +68,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/host/ehci-hcd.c
+++ linux-2619-rc2g2/drivers/usb/host/ehci-hcd.c
@@ -24,7 +24,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/host/ohci-hcd.c
+++ linux-2619-rc2g2/drivers/usb/host/ohci-hcd.c
@@ -82,7 +82,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/host/sl811-hcd.c
+++ linux-2619-rc2g2/drivers/usb/host/sl811-hcd.c
@@ -38,7 +38,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/host/u132-hcd.c
+++ linux-2619-rc2g2/drivers/usb/host/u132-hcd.c
@@ -42,7 +42,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
--- linux-2619-rc2g2.orig/drivers/usb/image/mdc800.c
+++ linux-2619-rc2g2/drivers/usb/image/mdc800.c
@@ -94,7 +94,6 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/wait.h>
#include <linux/mutex.h>

--- linux-2619-rc2g2.orig/drivers/usb/image/microtek.c
+++ linux-2619-rc2g2/drivers/usb/image/microtek.c
@@ -129,7 +129,6 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/proc_fs.h>

--- linux-2619-rc2g2.orig/drivers/usb/input/hid-core.c
+++ linux-2619-rc2g2/drivers/usb/input/hid-core.c
@@ -20,7 +20,6 @@
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/mm.h>
-#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <asm/unaligned.h>
#include <asm/byteorder.h>
--- linux-2619-rc2g2.orig/drivers/usb/input/hiddev.c
+++ linux-2619-rc2g2/drivers/usb/input/hiddev.c
@@ -29,7 +29,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/input.h>
#include <linux/usb.h>
#include "hid.h"
--- linux-2619-rc2g2.orig/drivers/usb/input/xpad.c
+++ linux-2619-rc2g2/drivers/usb/input/xpad.c
@@ -62,7 +62,6 @@
#include <linux/stat.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <linux/smp_lock.h>
#include <linux/usb/input.h>

#define DRIVER_VERSION "v0.0.6"
--- linux-2619-rc2g2.orig/drivers/usb/misc/idmouse.c
+++ linux-2619-rc2g2/drivers/usb/misc/idmouse.c
@@ -22,7 +22,6 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
--- linux-2619-rc2g2.orig/drivers/usb/misc/legousbtower.c
+++ linux-2619-rc2g2/drivers/usb/misc/legousbtower.c
@@ -80,7 +80,6 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
--- linux-2619-rc2g2.orig/drivers/usb/misc/rio500.c
+++ linux-2619-rc2g2/drivers/usb/misc/rio500.c
@@ -39,7 +39,6 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/usb.h>
-#include <linux/smp_lock.h>
#include <linux/wait.h>

#include "rio500_usb.h"
--- linux-2619-rc2g2.orig/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ linux-2619-rc2g2/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -63,7 +63,6 @@
#include <linux/selection.h>
#include <linux/spinlock.h>
#include <linux/kref.h>
-#include <linux/smp_lock.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
--- linux-2619-rc2g2.orig/drivers/usb/mon/mon_main.c
+++ linux-2619-rc2g2/drivers/usb/mon/mon_main.c
@@ -10,7 +10,6 @@
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/debugfs.h>
-#include <linux/smp_lock.h>
#include <linux/notifier.h>
#include <linux/mutex.h>

--- linux-2619-rc2g2.orig/drivers/usb/serial/usb-serial.c
+++ linux-2619-rc2g2/drivers/usb/serial/usb-serial.c
@@ -28,7 +28,6 @@
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/list.h>
-#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
--- linux-2619-rc2g2.orig/drivers/usb/storage/usb.h
+++ linux-2619-rc2g2/drivers/usb/storage/usb.h
@@ -47,7 +47,6 @@
#include <linux/usb.h>
#include <linux/usb_usual.h>
#include <linux/blkdev.h>
-#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <scsi/scsi_host.h>

2006-10-20 09:27:01

by Stefan Richter

[permalink] [raw]
Subject: Re: dealing with excessive includes

Randy Dunlap wrote:
> Here's about half of checking includers of linux/smp_lock.h to see
> if they actually use any of its interfaces. (most don't)
>
> Yet to do: fs/* and arch/*
> Built only on x86_64.
[...]
> drivers/acpi/osl.c | 1 -
> drivers/block/acsi_slm.c | 1 -
> drivers/block/umem.c | 1 -
> drivers/char/ds1620.c | 1 -
> drivers/char/dsp56k.c | 1 -
> drivers/char/dtlk.c | 1 -
> drivers/char/ec3104_keyb.c | 1 -
> drivers/char/ftape/zftape/zftape-init.c | 1 -
> drivers/char/hangcheck-timer.c | 1 -
> drivers/char/ip27-rtc.c | 1 -
> drivers/char/lp.c | 1 -
> drivers/char/mem.c | 1 -
> drivers/char/mxser.c | 1 -
> drivers/char/ppdev.c | 1 -
> drivers/char/sysrq.c | 1 -
> drivers/char/vc_screen.c | 1 -
> drivers/char/watchdog/omap_wdt.c | 1 -
> drivers/char/watchdog/pcwd_usb.c | 1 -
> drivers/i2c/busses/scx200_acb.c | 1 -
> drivers/i2c/i2c-dev.c | 1 -
> drivers/ieee1394/raw1394.c | 1 -
> drivers/infiniband/ulp/iser/iser_verbs.c | 1 -
> drivers/input/evdev.c | 1 -
> drivers/input/input.c | 1 -
[... etc. pp. ...]
> sound/oss/swarm_cs4297a.c | 1 -
> sound/oss/trident.c | 1 -
> sound/oss/via82cxxx_audio.c | 1 -
> 166 files changed, 166 deletions(-)
[...]

I am afraid in many of these cases a proper cleanup would _replace_ the
include by the correct one, not just delete it. For example,
drivers/ieee1394/raw1394.c should include linux/spinlock.h. AFAICS it
does so at the moment only indirectly via another header.
--
Stefan Richter
-=====-=-==- =-=- =-=--
http://arcgraph.de/sr/

2006-10-20 12:43:33

by Matthew Wilcox

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Fri, Oct 20, 2006 at 01:57:37AM +0100, Al Viro wrote:
> That's just a dead weight these days

Agreed.

Signed-off-by: Matthew Wilcox <[email protected]>

diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index 920bdbf..9c98ed2 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -10,6 +10,7 @@

#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/kallsyms.h>

diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h
index d973e8b..2e87e82 100644
--- a/include/asm-parisc/uaccess.h
+++ b/include/asm-parisc/uaccess.h
@@ -4,7 +4,6 @@ #define __PARISC_UACCESS_H
/*
* User space memory access functions
*/
-#include <linux/sched.h>
#include <asm/page.h>
#include <asm/system.h>
#include <asm/cache.h>

2006-10-20 16:11:31

by Randy Dunlap

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Fri, 20 Oct 2006 11:26:58 +0200 Stefan Richter wrote:

> Randy Dunlap wrote:
> > Here's about half of checking includers of linux/smp_lock.h to see
> > if they actually use any of its interfaces. (most don't)
> >
> > Yet to do: fs/* and arch/*
> > Built only on x86_64.
> [...]
> > drivers/acpi/osl.c | 1 -
> > drivers/block/acsi_slm.c | 1 -
> > drivers/block/umem.c | 1 -
> > drivers/char/ds1620.c | 1 -
> > drivers/char/dsp56k.c | 1 -
> > drivers/char/dtlk.c | 1 -
> > drivers/char/ec3104_keyb.c | 1 -
> > drivers/char/ftape/zftape/zftape-init.c | 1 -
> > drivers/char/hangcheck-timer.c | 1 -
> > drivers/char/ip27-rtc.c | 1 -
> > drivers/char/lp.c | 1 -
> > drivers/char/mem.c | 1 -
> > drivers/char/mxser.c | 1 -
> > drivers/char/ppdev.c | 1 -
> > drivers/char/sysrq.c | 1 -
> > drivers/char/vc_screen.c | 1 -
> > drivers/char/watchdog/omap_wdt.c | 1 -
> > drivers/char/watchdog/pcwd_usb.c | 1 -
> > drivers/i2c/busses/scx200_acb.c | 1 -
> > drivers/i2c/i2c-dev.c | 1 -
> > drivers/ieee1394/raw1394.c | 1 -
> > drivers/infiniband/ulp/iser/iser_verbs.c | 1 -
> > drivers/input/evdev.c | 1 -
> > drivers/input/input.c | 1 -
> [... etc. pp. ...]
> > sound/oss/swarm_cs4297a.c | 1 -
> > sound/oss/trident.c | 1 -
> > sound/oss/via82cxxx_audio.c | 1 -
> > 166 files changed, 166 deletions(-)
> [...]
>
> I am afraid in many of these cases a proper cleanup would _replace_ the
> include by the correct one, not just delete it. For example,
> drivers/ieee1394/raw1394.c should include linux/spinlock.h. AFAICS it
> does so at the moment only indirectly via another header.

I don't think that we can fix it all at once. This is just one step.
AFAICT for raw1394.c, it's not incorrect as is, but more is needed,
sure.

Yes, we have lots of header include indirection going on.
I don't know of a good tool to detect/fix it.

What Al is doing is good stuff, but I'd still prefer to see an even
better tool, like gcc-preprocessor or sparse based (I guess).

---
~Randy

2006-10-20 17:51:56

by Stefan Richter

[permalink] [raw]
Subject: Re: dealing with excessive includes

Randy Dunlap wrote:
> On Fri, 20 Oct 2006 11:26:58 +0200 Stefan Richter wrote:
>> I am afraid in many of these cases a proper cleanup would _replace_ the
>> include by the correct one, not just delete it. For example,
>> drivers/ieee1394/raw1394.c should include linux/spinlock.h. AFAICS it
>> does so at the moment only indirectly via another header.
>
> I don't think that we can fix it all at once. This is just one step.
> AFAICT for raw1394.c, it's not incorrect as is, but more is needed,
> sure.

Yes, it's probably still correct after your patch. I just referred to
the sensible rule that necessary headers should be directly included
where they are used, not indirectly via other headers.

> Yes, we have lots of header include indirection going on.
> I don't know of a good tool to detect/fix it.

Me neither. I manually cleansed the ieee1394 core's and sbp2's includes
recently; this is a mind-numbing janitorial job.

> What Al is doing is good stuff, but I'd still prefer to see an even
> better tool, like gcc-preprocessor or sparse based (I guess).

On the surface, tools like LXR and cscope "know" where function are
declared or macros and types are defined. But oftentimes, other headers
than these tools turn up are to be included by API users. Cf. the
definition of atomic_t. (IOW the "necessary" header is not always the
one which has the actual definition.)
--
Stefan Richter
-=====-=-==- =-=- =-=--
http://arcgraph.de/sr/

2006-10-22 17:59:12

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Fri, 20 Oct 2006, Randy Dunlap wrote:
> Yes, we have lots of header include indirection going on.
> I don't know of a good tool to detect/fix it.

BTW, what about making sure all header files are self-contained (i.e. all
header files include all stuff they need)? This would make it easier for the
users to know which files to include.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2006-10-22 22:59:45

by Andi Kleen

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Sunday 22 October 2006 19:58, Geert Uytterhoeven wrote:
> On Fri, 20 Oct 2006, Randy Dunlap wrote:
> > Yes, we have lots of header include indirection going on.
> > I don't know of a good tool to detect/fix it.
>
> BTW, what about making sure all header files are self-contained (i.e. all
> header files include all stuff they need)? This would make it easier for the
> users to know which files to include.

Would be a worthy goal imho. Can it be done with scripts?

-Andi

2006-10-23 00:31:14

by Matthew Wilcox

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Sun, Oct 22, 2006 at 07:58:53PM +0200, Geert Uytterhoeven wrote:
> On Fri, 20 Oct 2006, Randy Dunlap wrote:
> > Yes, we have lots of header include indirection going on.
> > I don't know of a good tool to detect/fix it.
>
> BTW, what about making sure all header files are self-contained (i.e. all
> header files include all stuff they need)? This would make it easier for the
> users to know which files to include.

I was wondering about putting in some tags in comments in the headers and
using scripts to parse them out. Something like:

/*+
* Provides: struct sched
* Provides: total_forks, nr_threads, process_counts, nr_processes()
* Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
*/

(you should be able to have multiple /*+ blocks in the file, multiple
Provides: lines and multiple things provided on a line. Functions are
tagged with a trailing (), structs with the leading 'struct' and
everything else is a variable.)

Not only does that tell a script unambiguously which header needs to
be included for what function, struct definition and variable, it also
tells the programmer what header to include for what function.

This would have the benefit over automated analysis that you can put
Provides: irq_canonicalize() in <linux/interrupt.h> despite it being
actually defined in <asm/irq.h> (there's probably better examples
than this).

The script could warn for both unnecessary headers included and warn for
headers which weren't included but should be. The warnings would start
out fairly useful and improve as we added more Provides: lines.

Anyone want to code this, or just pick holes in it?

2006-10-23 00:43:18

by Andi Kleen

[permalink] [raw]
Subject: Re: dealing with excessive includes


> /*+
> * Provides: struct sched
> * Provides: total_forks, nr_threads, process_counts, nr_processes()
> * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> */

That's ugly. If it needs that i don't think it's a good idea.
We really want standard C, not some Linux dialect.

In theory it is even to do it automated without comments
just based on the referenced symbols, except if stuff is hidden in macros
(but then the include defining the macro should have the right includes
anyways). Another issue would be different name spaces - if there is both
typedef foo and struct foo and nested local foo a script might have a little trouble
distingushing them, but i suspect that won't be a big issue.

-Andi


2006-10-23 01:08:15

by Matthew Wilcox

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Mon, Oct 23, 2006 at 02:42:58AM +0200, Andi Kleen wrote:
>
> > /*+
> > * Provides: struct sched
> > * Provides: total_forks, nr_threads, process_counts, nr_processes()
> > * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> > */
>
> That's ugly. If it needs that i don't think it's a good idea.
> We really want standard C, not some Linux dialect.

Um, that's a comment. It's standard C.

> In theory it is even to do it automated without comments
> just based on the referenced symbols, except if stuff is hidden in macros
> (but then the include defining the macro should have the right includes
> anyways). Another issue would be different name spaces - if there is both
> typedef foo and struct foo and nested local foo a script might have a little trouble
> distingushing them, but i suspect that won't be a big issue.

Sorry, I assumed you'd've spent some time thinking about the problem.

Here's the problem. If a file needs canonicalize_irq(), it should
include <linux/interrupt.h> (which eventually ends up including
asm/irq,h), and not <asm/irq.h> (where it's defined).
If a file needs add_wait_queue(), it should include <linux/wait.h>
(where it's defined) and not <linux/fs.h> (which directly includes
linux/wait.h>.

Please define an algorithm which distinguishes the two cases.

2006-10-23 01:31:25

by Andi Kleen

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Monday 23 October 2006 03:08, Matthew Wilcox wrote:
> On Mon, Oct 23, 2006 at 02:42:58AM +0200, Andi Kleen wrote:
> >
> > > /*+
> > > * Provides: struct sched
> > > * Provides: total_forks, nr_threads, process_counts, nr_processes()
> > > * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> > > */
> >
> > That's ugly. If it needs that i don't think it's a good idea.
> > We really want standard C, not some Linux dialect.
>
> Um, that's a comment. It's standard C.

If you require it to do something it isn't a comment anymore -- it would become
a language extension.

>
> Here's the problem. If a file needs canonicalize_irq(), it should
> include <linux/interrupt.h> (which eventually ends up including
> asm/irq,h), and not <asm/irq.h> (where it's defined).
> If a file needs add_wait_queue(), it should include <linux/wait.h>
> (where it's defined) and not <linux/fs.h> (which directly includes
> linux/wait.h>.
>
> Please define an algorithm which distinguishes the two cases.

Needs are inside {} or in a macro definition
So if the identifier happens after #define or inside {} assume the symbol
is needed from somewhere else, otherwise it is declared here.

That is likely not 100% foolproof, but should be good enough and
the mismatches can be resolved by hand.

-Andi

2006-10-23 01:36:09

by Matthew Wilcox

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Mon, Oct 23, 2006 at 03:31:16AM +0200, Andi Kleen wrote:
> On Monday 23 October 2006 03:08, Matthew Wilcox wrote:
> > On Mon, Oct 23, 2006 at 02:42:58AM +0200, Andi Kleen wrote:
> > >
> > > > /*+
> > > > * Provides: struct sched
> > > > * Provides: total_forks, nr_threads, process_counts, nr_processes()
> > > > * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> > > > */
> > >
> > > That's ugly. If it needs that i don't think it's a good idea.
> > > We really want standard C, not some Linux dialect.
> >
> > Um, that's a comment. It's standard C.
>
> If you require it to do something it isn't a comment anymore -- it would become
> a language extension.

How is this any different from __iomem annotations?

> > Here's the problem. If a file needs canonicalize_irq(), it should
> > include <linux/interrupt.h> (which eventually ends up including
> > asm/irq,h), and not <asm/irq.h> (where it's defined).
> > If a file needs add_wait_queue(), it should include <linux/wait.h>
> > (where it's defined) and not <linux/fs.h> (which directly includes
> > linux/wait.h>.
> >
> > Please define an algorithm which distinguishes the two cases.
>
> Needs are inside {} or in a macro definition
> So if the identifier happens after #define or inside {} assume the symbol
> is needed from somewhere else, otherwise it is declared here.
>
> That is likely not 100% foolproof, but should be good enough and
> the mismatches can be resolved by hand.

Let me try to explain the problem again, because what you wrote has
nothing to do with the problem.

canonicalize_irq() is defined in <asm/irq.h>. No .c file should be
including <asm/irq.h> in order to get it. It should be including
<linux/interrupt.h>, which will indirectly pull in <asm/irq.h>

add_wait_queue() is defined in <linux/wait.h>. .c files wishing to use
add_wait_queue() should be including <linux/wait.h> rather than relying
on it being pulled in through some other path.

This needs annotations to fix, or a big bag of unreliable heuristics.

2006-10-23 01:41:31

by Andi Kleen

[permalink] [raw]
Subject: Re: dealing with excessive includes


> This needs annotations to fix, or a big bag of unreliable heuristics.

Ok you're right that case would need annotations.

I retreat my earlier statement that self sufficient include files
are a good idea. If it needs such hacks to do it it's probably not worth
it. After all it won't fix a single bug.

-Andi

2006-10-23 01:47:16

by Randy Dunlap

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Sun, 22 Oct 2006 19:36:04 -0600 Matthew Wilcox wrote:

> On Mon, Oct 23, 2006 at 03:31:16AM +0200, Andi Kleen wrote:
> > On Monday 23 October 2006 03:08, Matthew Wilcox wrote:
> > > On Mon, Oct 23, 2006 at 02:42:58AM +0200, Andi Kleen wrote:
> > > >
> > > > > /*+
> > > > > * Provides: struct sched
> > > > > * Provides: total_forks, nr_threads, process_counts, nr_processes()
> > > > > * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> > > > > */
> > > >
> > > > That's ugly. If it needs that i don't think it's a good idea.
> > > > We really want standard C, not some Linux dialect.
> > >
> > > Um, that's a comment. It's standard C.
> >
> > If you require it to do something it isn't a comment anymore -- it would become
> > a language extension.
>
> How is this any different from __iomem annotations?
>
> > > Here's the problem. If a file needs canonicalize_irq(), it should
> > > include <linux/interrupt.h> (which eventually ends up including
> > > asm/irq,h), and not <asm/irq.h> (where it's defined).
> > > If a file needs add_wait_queue(), it should include <linux/wait.h>
> > > (where it's defined) and not <linux/fs.h> (which directly includes
> > > linux/wait.h>.
> > >
> > > Please define an algorithm which distinguishes the two cases.
> >
> > Needs are inside {} or in a macro definition
> > So if the identifier happens after #define or inside {} assume the symbol
> > is needed from somewhere else, otherwise it is declared here.
> >
> > That is likely not 100% foolproof, but should be good enough and
> > the mismatches can be resolved by hand.
>
> Let me try to explain the problem again, because what you wrote has
> nothing to do with the problem.
>
> canonicalize_irq() is defined in <asm/irq.h>. No .c file should be
> including <asm/irq.h> in order to get it. It should be including
> <linux/interrupt.h>, which will indirectly pull in <asm/irq.h>

We can add #error or #warning to asm/irq.h when that is done &
detected hence caught and will be fixed.
Don't we already have a few like that? ("don't include this file
directly") I looked quickly but didn't see them...

> add_wait_queue() is defined in <linux/wait.h>. .c files wishing to use
> add_wait_queue() should be including <linux/wait.h> rather than relying
> on it being pulled in through some other path.
>
> This needs annotations to fix, or a big bag of unreliable heuristics.


---
~Randy

2006-10-23 01:50:00

by Nick Piggin

[permalink] [raw]
Subject: Re: dealing with excessive includes

Matthew Wilcox wrote:

> Let me try to explain the problem again, because what you wrote has
> nothing to do with the problem.
>
> canonicalize_irq() is defined in <asm/irq.h>. No .c file should be
> including <asm/irq.h> in order to get it. It should be including
> <linux/interrupt.h>, which will indirectly pull in <asm/irq.h>
>
> add_wait_queue() is defined in <linux/wait.h>. .c files wishing to use
> add_wait_queue() should be including <linux/wait.h> rather than relying
> on it being pulled in through some other path.
>
> This needs annotations to fix, or a big bag of unreliable heuristics.

Does fixing it really fix anything? I agree that cleaning it all up would
be great. But the aim should be to make less work for developers, rather
than more.

If you have an

#ifndef _LINUX_INTERRUPT_H
#error ...

That almost explicitly tells you which is the correct file to include to
get all definitions from this file. Wouldn't that help?

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com

2006-10-23 06:34:37

by Stefan Richter

[permalink] [raw]
Subject: Re: dealing with excessive includes

Nick Piggin wrote:
...
> If you have an
>
> #ifndef _LINUX_INTERRUPT_H
> #error ...
>
> That almost explicitly tells you which is the correct file to include to
> get all definitions from this file. Wouldn't that help?

This can even be evaluated by a script that searches for required header
files, except if more than one of such clauses appear in a file.
--
Stefan Richter
-=====-=-==- =-=- =-===
http://arcgraph.de/sr/

2006-10-23 08:29:25

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Mon, 23 Oct 2006, Andi Kleen wrote:
> On Sunday 22 October 2006 19:58, Geert Uytterhoeven wrote:
> > On Fri, 20 Oct 2006, Randy Dunlap wrote:
> > > Yes, we have lots of header include indirection going on.
> > > I don't know of a good tool to detect/fix it.
> >
> > BTW, what about making sure all header files are self-contained (i.e. all
> > header files include all stuff they need)? This would make it easier for the
> > users to know which files to include.
>
> Would be a worthy goal imho. Can it be done with scripts?

Making them self-contained or checking whether they are? :-)

The latter is simple, just compile each of them into dummy object files, which
should give no compile errors.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2006-10-23 08:34:23

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Mon, 23 Oct 2006, Andi Kleen wrote:
> > This needs annotations to fix, or a big bag of unreliable heuristics.
>
> Ok you're right that case would need annotations.

Annotations are a different thing. Personally, I don't like adding them.

> I retreat my earlier statement that self sufficient include files
> are a good idea. If it needs such hacks to do it it's probably not worth
> it. After all it won't fix a single bug.

- It will fix bugs of the type: add #include <x.h> to y.c because on some
architectures x.h isn't automatically pulled in by z.h.

- It would help in cleaning up the zillions of includes in the .c files,
decreasing compile time.

- It would make it easier for developers, since if you need something, you
just have to explicitly include the header file that defines it, and not
have to find out the hard way what other stuff to include.

I agree, that's not that many `real bugs'.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2006-10-23 16:09:57

by Linus Torvalds

[permalink] [raw]
Subject: Re: dealing with excessive includes



On Mon, 23 Oct 2006, Geert Uytterhoeven wrote:
> >
> > Would be a worthy goal imho. Can it be done with scripts?
>
> Making them self-contained or checking whether they are? :-)
>
> The latter is simple, just compile each of them into dummy object files, which
> should give no compile errors.

It's _not_ simple. Not at all.

We have tons of issues that depend on config variables and architecture
details.

It's hard.

Linus

2006-10-23 16:13:53

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Mon, 23 Oct 2006, Linus Torvalds wrote:
> On Mon, 23 Oct 2006, Geert Uytterhoeven wrote:
> > > Would be a worthy goal imho. Can it be done with scripts?
> >
> > Making them self-contained or checking whether they are? :-)
> >
> > The latter is simple, just compile each of them into dummy object files, which
> > should give no compile errors.
>
> It's _not_ simple. Not at all.
>
> We have tons of issues that depend on config variables and architecture
> details.

Indeed, so the config variables and architecture details should be handled in
the include files, not in the (multiple) users of those include files.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2006-10-23 16:32:06

by Linus Torvalds

[permalink] [raw]
Subject: Re: dealing with excessive includes



On Mon, 23 Oct 2006, Geert Uytterhoeven wrote:
> >
> > We have tons of issues that depend on config variables and architecture
> > details.
>
> Indeed, so the config variables and architecture details should be handled in
> the include files, not in the (multiple) users of those include files.

The point is - _verifying_ that is actually hard.

If some inline function depends on a particular header, you'll have a hard
time checking for that if there's an #ifdef around it. Which is not
uncommon, we have things like:

#ifdef CONFIG_PROCFS
.. number of inline functions ..
#else
#define function1(a,b,c) do { } while (0)
...
#endif

so I'm just saying that "just compile it" is _not_ a way of verifying that
the header file is complete - because it may well be complete for the
particular config you're testing, but not for some other.

So this is a hard problem. If it was easy, we'd not _have_ the problem in
the first place.

Linus

2006-10-23 16:53:13

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Mon, 23 Oct 2006, Linus Torvalds wrote:
> On Mon, 23 Oct 2006, Geert Uytterhoeven wrote:
> > > We have tons of issues that depend on config variables and architecture
> > > details.
> >
> > Indeed, so the config variables and architecture details should be handled in
> > the include files, not in the (multiple) users of those include files.
>
> The point is - _verifying_ that is actually hard.
>
> If some inline function depends on a particular header, you'll have a hard
> time checking for that if there's an #ifdef around it. Which is not
> uncommon, we have things like:
>
> #ifdef CONFIG_PROCFS
> .. number of inline functions ..
> #else
> #define function1(a,b,c) do { } while (0)
> ...
> #endif
>
> so I'm just saying that "just compile it" is _not_ a way of verifying that
> the header file is complete - because it may well be complete for the
> particular config you're testing, but not for some other.
>
> So this is a hard problem. If it was easy, we'd not _have_ the problem in
> the first place.

I agree _verifying_ this for all config and arch combinations is hard.
But my point is that right now we're `solving' this at the user (of the
include) level, which is an order of magnitude more work.
If the includes were (sufficiently) self-contained, the driver writers would
have to care less about config/arch dependencies.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2006-10-23 17:06:05

by Linus Torvalds

[permalink] [raw]
Subject: Re: dealing with excessive includes



On Mon, 23 Oct 2006, Geert Uytterhoeven wrote:
>
> I agree _verifying_ this for all config and arch combinations is hard.
> But my point is that right now we're `solving' this at the user (of the
> include) level, which is an order of magnitude more work.
> If the includes were (sufficiently) self-contained, the driver writers would
> have to care less about config/arch dependencies.

But header files already basically are self-contained. They didn't always
use to be that way, but over the years, we've generally made them that way
in almost all cases.

The problem is generally not that they aren't self-contained, it's that
they bring in other things depending on architecture, and then some driver
depends on a header file including other header files, even when that
isn't always the case at all: exactly because which header file it
includes depends on config options (to a small degree) and on architecture
(to a much larger degree).

Linus

2006-10-28 15:25:00

by Tim Schmielau

[permalink] [raw]
Subject: Re: dealing with excessive includes

On Wed, 18 Oct 2006 10:31:26 +0100, Al Viro wrote:
> On Wed, Oct 18, 2006 at 01:19:44PM +0400, Alexey Dobriyan wrote:
> > > module.h is trickier. First of all, we want extern for wake_up_process().
> >
> > When I came up with this to l-k, Nick and Christoph told me that duplicate
> > proto sucks. So module.h/sched.h is
> > a) uninline module_put()
> > b) remove #include <linux/sched.h>
>
> Works for me... OTOH, wake_up_process() is not likely to change
> prototype, so I'm not sure how strong that argument actually is.
>
> Anyway, that patch is obviously preliminary - at the very least
> it needs be checked on more configs (and more targets - e.g. mips and
> parisc hadn't been checked at all). Probably worth putting in -mm for
> a while, too, or we'll get fun breakage on the next big merge from -mm.

So, has a patch emerged yet? I'd like to help checking and fixing things.

There shouldn't be too much fallout from that. I had a patch to uninclude
sched.h from module.h in -mm for some time about a year ago.
All fixes necessary at that time should be in Linus' tree by now, just the
final patch to module.h got dropped.

Tim