public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT] sched.h removal from module.h
@ 2006-08-27 15:32 Alexey Dobriyan
  2006-08-29  1:10 ` Nick Piggin
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2006-08-27 15:32 UTC (permalink / raw)
  To: linux-kernel

I don't have compile-kernel-in-a-minute box, so

Please, test on your usual configs and send me _new_ warnings and errors
that appeared.

Patch seems to pass [alpha, i386, x86_64] x [allmodconfig-SMP, -UP] without
regressions.

[PATCH] sched.h removal from module.h

This is done by duplicating prototype of wake_up_process() which seems
to be the only thing module.h wants.

Some modules doesn't really want more than
module_init/module_exit/MODULE_LICENSE so dragging 43 headers from sched.h
mostly slows down compilation.

Examples:

$ wc lib/sort.i
 10933  31212 287154 lib/sort.i
  7919  21084 198611 lib/sort.i	# after removal
  ------------------
                -31%

$ wc lib/idr.i
 11299  32412 298627 lib/idr.i
  8269  22287 210083 lib/idr.i	# after removal
  ------------------
                -30%

Note that, say, PCI drivers shouldn't shrink much due to linux/pci.h
including asm/pci.h including linux/mm.h including, you guessed it right,
sched.h. That's for later.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 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 |    2 ++
 drivers/w1/slaves/w1_therm.c      |    1 +
 include/linux/acct.h              |    1 +
 include/linux/module.h            |    3 ++-
 include/linux/phy.h               |    1 +
 include/scsi/libiscsi.h           |    1 +
 10 files changed, 12 insertions(+), 1 deletion(-)

--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -9,6 +9,7 @@ #include <linux/cpu.h>
 #include <linux/topology.h>
 #include <linux/device.h>
 #include <linux/node.h>
+#include <linux/sched.h>
 
 #include "base.h"
 
--- 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>
--- a/drivers/leds/ledtrig-ide-disk.c
+++ b/drivers/leds/ledtrig-ide-disk.c
@@ -15,6 +15,7 @@ #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/timer.h>
+#include <linux/jiffies.h>
 #include <linux/leds.h>
 
 static void ledtrig_ide_timerfunc(unsigned long data);
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/device.h>
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -29,6 +29,8 @@ #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 
+#include <asm/param.h>
+
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -25,6 +25,7 @@ #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/device.h>
+#include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/delay.h>
 
--- 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);
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -6,7 +6,6 @@ #define _LINUX_MODULE_H
  * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
  * Rewritten again by Rusty Russell, 2002
  */
-#include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/stat.h>
@@ -406,6 +405,8 @@ static inline int try_module_get(struct 
 	return ret;
 }
 
+/* Prototype duplicated only to not include sched.h */
+int FASTCALL(wake_up_process(struct task_struct * tsk));
 static inline void module_put(struct module *module)
 {
 	if (module) {
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -20,6 +20,7 @@ #define __PHY_H
 
 #include <linux/spinlock.h>
 #include <linux/device.h>
+#include <linux/workqueue.h>
 
 #define PHY_BASIC_FEATURES	(SUPPORTED_10baseT_Half | \
 				 SUPPORTED_10baseT_Full | \
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -25,6 +25,7 @@ #define LIBISCSI_H
 
 #include <linux/types.h>
 #include <linux/mutex.h>
+#include <linux/workqueue.h>
 #include <scsi/iscsi_proto.h>
 #include <scsi/iscsi_if.h>
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFT] sched.h removal from module.h
  2006-08-27 15:32 [RFT] sched.h removal from module.h Alexey Dobriyan
@ 2006-08-29  1:10 ` Nick Piggin
  2006-08-29 11:31   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Piggin @ 2006-08-29  1:10 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel

Alexey Dobriyan wrote:
> I don't have compile-kernel-in-a-minute box, so
> 
> Please, test on your usual configs and send me _new_ warnings and errors
> that appeared.
> 
> Patch seems to pass [alpha, i386, x86_64] x [allmodconfig-SMP, -UP] without
> regressions.
> 
> [PATCH] sched.h removal from module.h
> 
> This is done by duplicating prototype of wake_up_process() which seems
> to be the only thing module.h wants.

This is really ugly, IMO. It makes the code less maintainable, so I don't
think there is any point in doing it. In this case, we really do want to
use scheduler functions, so the thing you do in that case is to include
sched.h, not declare them yourself :(

If you are particularly concerned about this, just move all those refcount
inlines into kernel/module.c (they're too big anyway)... then you can drop
the sched.h include from module.h for free ;)

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFT] sched.h removal from module.h
  2006-08-29  1:10 ` Nick Piggin
@ 2006-08-29 11:31   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2006-08-29 11:31 UTC (permalink / raw)
  To: Nick Piggin; +Cc: Alexey Dobriyan, linux-kernel

On Tue, Aug 29, 2006 at 11:10:27AM +1000, Nick Piggin wrote:
> >This is done by duplicating prototype of wake_up_process() which seems
> >to be the only thing module.h wants.
> 
> This is really ugly, IMO. It makes the code less maintainable, so I don't
> think there is any point in doing it. In this case, we really do want to
> use scheduler functions, so the thing you do in that case is to include
> sched.h, not declare them yourself :(
> 
> If you are particularly concerned about this, just move all those refcount
> inlines into kernel/module.c (they're too big anyway)... then you can drop
> the sched.h include from module.h for free ;)

Agreed.  At least module_put should move out of line.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-29 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-27 15:32 [RFT] sched.h removal from module.h Alexey Dobriyan
2006-08-29  1:10 ` Nick Piggin
2006-08-29 11:31   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox