lkml.org 
[lkml]   [1999]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectlinux/malloc.h
Date
Hi,

I've stumbled across some really horrible mess in the kernel, and I'm in
the process of clearing it up. I first noticed this mess on non-PCI
architectures which would issue a complete set of warnings for almost
every C source file. The complaint was from serialP.h.

Modifing serialP.h and restarting make caused the whole kernel to be
recompiled (obviously from my last comment), but why? Well, the
dependency tree looks something like this:

file.c
malloc.h
slab.h
mm.h
sched.h
tty.h
serialP.h

Unfortunately, sched.h is in the dependency tree for 118 other include
files, and mm.h for 108 others.

I looked at sched.h to see why it was including tty.h. It wanted it not
for the definition of struct tty_struct, but for it's prototype, ie,
just the declaration of the name.

The penalty from including tty.h int sched.h increases the dependency
tree for sched.h by something around 84 header files needlessly included.
(with tty.h, if you included just sched.h, you'd cause the compiler to
drag in 138 header files, without just 54 files).

IMHO, this is an unreasonable penalty for such a small requirement.
Hence, I'd like to get peoples optinions on using structure prototypes
to declare well-known structure names in the kernel include files, thus
reducing the dependency tree. Here are the advantages and disadvantages:

Advantages:
1. make doesn't have such a hard time figuring out the dependency tree
2. the C compiler spend so long opening/closing multiple header files
multiple times and parsing needless structure definitions, function
prototypes etc.
3. Less time spent recompiling the whole kernel as a whole.
4. Let make's dependency system work more efficiently.

Disadvantages:
1. Removal of well-known structures will not produce a warning.
2. Some pain when the change is made to sort out the include files
in some of the sources. (eg, some files get everything they
need from #include <linux/malloc.h> !

I don't see the disadvantage as being too great - we are running a decent(tm)
system with grep which can find the structures when we remove them.

All comments welcome.

PS, linux/malloc.h does not contain anything useful, except including
linux/slab.h. Is there any reason why all instances of it can't be
changed to linux/slab.h?
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King rmk@arm.linux.org.uk --- ---
| | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.026 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site