Skip to contentSkip to conversation

embedding 2.6 or more findings on kernel size

PATCH In review Dmitry Golubev 2 participants 4 messages Aug 30, 2004 – Sep 1, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

Compiling the 2.6.8.1 kernel, I found three interesting places (looking very quickly, perhaps would find more) when the kernel was compiled with unused parts:

1. it compiles everything inside /arch/i386/kernel/cpu/ . From my point of view, that is incorrect, especially when choosing processor like Cyrix/VIA C3 (which is a cyrix, not a transmeta, nexgen or something else) and explicitly specifying not to make generic x86 code. Perhaps, choice should be given. About 15KB of memory wasted on this...

2. then I found it to compile a synaptics touchpad support - also must be optional. Another something like 8KB

3. and the third thing I found is that scsi_ioctl is compiled even if SCSI support is taken out... very interesting behaviour... another like 8KB wasted... I have no SCSI, no USB MassStorage, no CD-RW, no nothing could possibly use SCSI...

Many things could be put on about 100-200KB spared if not migrating to 2.6... Perhaps, more controls should be available to configure - new kernels should be smaller and faster, not larger, shouldn't they?

Thanks,
Dmitry

#1 lore raw

PATCH 1/1 embedding 2.6 or more findings on kernel size

Here is the patch for the reported problems. Additional research may follow...

Dmitry

Quoted 21 lines · Dmitry Golubev

Hello,

Compiling the 2.6.8.1 kernel, I found three interesting places (looking very quickly, perhaps would find more) when the kernel was compiled with unused parts:

1. it compiles everything inside /arch/i386/kernel/cpu/ . From my point of view, that is incorrect, especially when choosing processor like Cyrix/VIA C3 (which is a cyrix, not a transmeta, nexgen or something else) and explicitly specifying not to make generic x86 code. Perhaps, choice should be given. About 15KB of memory wasted on this...

2. then I found it to compile a synaptics touchpad support - also must be optional. Another something like 8KB

3. and the third thing I found is that scsi_ioctl is compiled even if SCSI support is taken out... very interesting behaviour... another like 8KB wasted... I have no SCSI, no USB MassStorage, no CD-RW, no nothing could possibly use SCSI...

Quoted 6 lines

Many things could be put on about 100-200KB spared if not migrating to 2.6... Perhaps, more controls should be available to configure - new kernels should be smaller and faster, not larger, shouldn't they?

Thanks,
Dmitry

linux-2.6.8.1_new/arch/i386/Kconfig renamed from linux-2.6.8.1/arch/i386/Kconfig +65 -0
diff -Naur -X ./patt ./linux-2.6.8.1/arch/i386/Kconfig ./linux-2.6.8.1_new/arch/i386/Kconfig
@@ -321,6 +321,46 @@
 
 endchoice
 
+menu "Specific x86 vendor support"
+	depends on X86
+	
+config X86_CPU_VENDOR_AMD
+	bool "Advanced Micro Devices"
+	default y
+
+config X86_CPU_VENDOR_CYRIX
+	bool "Cyrix | VIA | National Semiconductor"
+	default y
+
+config X86_CPU_VENDOR_CENTAUR
+	bool "Centaur Technology"
+	default y
+	help
+	  This option enables support for Centaur C6 (IDT WinChip) 
+	  processor family.
+
+config X86_CPU_VENDOR_TRANSMETA
+	bool "Transmeta Crusoe"
+	default y
+
+config X86_CPU_VENDOR_INTEL
+	bool "Intel"
+	default y
+
+config X86_CPU_VENDOR_RISE
+	bool "Rise Technology"
+	default y
+
+config X86_CPU_VENDOR_NEXGEN
+	bool "NexGen"
+	default y
+
+config X86_CPU_VENDOR_UMC
+	bool "UMC Green CPUs"
+	default y
+
+endmenu
+
 config X86_GENERIC
        bool "Generic x86 support" 
        help
@@ -492,6 +532,15 @@
 	  cost of slightly increased overhead in some places. If unsure say
 	  N here.
 
+config PPRO_RAM_BUG
+	bool "Pentium PRO memory bug workaround"
+	depends on X86_CRU_VENDOR_INTEL
+	default n
+	help
+	  This option enables early probe support logic for Intel Pentium PRO
+	  memory erratum #50. If you do not have Pentium PRO processor, it is 
+	  safe to say N here. 
+
 config PREEMPT
 	bool "Preemptible Kernel"
 	help
@@ -813,6 +862,22 @@
 
 	  See <file:Documentation/mtrr.txt> for more information.
 
+# Configure MTRR options implied by vendor
+config MTRR_AMD
+	bool
+	depends on X86_CPU_VENDOR_AMD && MTRR
+	default y 
+
+config MTRR_CYRIX
+	bool
+	depends on X86_CPU_VENDOR_CYRIX && MTRR
+	default y
+
+config MTRR_CENTAUR
+	bool
+	depends on X86_CPU_VENDOR_CENTAUR && MTRR
+	default y
+	
 config EFI
 	bool "Boot from EFI support (EXPERIMENTAL)"
 	depends on ACPI
linux-2.6.8.1_new/arch/i386/kernel/cpu/Makefile renamed from linux-2.6.8.1/arch/i386/kernel/cpu/Makefile +8 -8
diff -Naur -X ./patt ./linux-2.6.8.1/arch/i386/kernel/cpu/Makefile ./linux-2.6.8.1_new/arch/i386/kernel/cpu/Makefile
@@ -4,14 +4,14 @@
 
 obj-y	:=	common.o proc.o
 
-obj-y	+=	amd.o
-obj-y	+=	cyrix.o
-obj-y	+=	centaur.o
-obj-y	+=	transmeta.o
-obj-y	+=	intel.o
-obj-y	+=	rise.o
-obj-y	+=	nexgen.o
-obj-y	+=	umc.o
+obj-$(CONFIG_X86_CPU_VENDOR_AMD)	+=	amd.o
+obj-$(CONFIG_X86_CPU_VENDOR_CYRIX)	+=	cyrix.o
+obj-$(CONFIG_X86_CPU_VENDOR_CENTAUR)	+=	centaur.o
+obj-$(CONFIG_X86_CPU_VENDOR_TRANSMETA)	+=	transmeta.o
+obj-$(CONFIG_X86_CPU_VENDOR_INTEL)	+=	intel.o
+obj-$(CONFIG_X86_CPU_VENDOR_RISE)	+=	rise.o
+obj-$(CONFIG_X86_CPU_VENDOR_NEXGEN)	+=	nexgen.o
+obj-$(CONFIG_X86_CPU_VENDOR_UMC)	+=	umc.o
 
 obj-$(CONFIG_X86_MCE)	+=	mcheck/
 
linux-2.6.8.1_new/arch/i386/kernel/cpu/common.c renamed from linux-2.6.8.1/arch/i386/kernel/cpu/common.c +58 -1

94 lines not on this page · raw message

linux-2.6.8.1_new/arch/i386/kernel/cpu/intel.c renamed from linux-2.6.8.1/arch/i386/kernel/cpu/intel.c +4 -0
diff -Naur -X ./patt ./linux-2.6.8.1/arch/i386/kernel/cpu/intel.c ./linux-2.6.8.1_new/arch/i386/kernel/cpu/intel.c
@@ -43,6 +43,8 @@
  *	This is called before we do cpu ident work
  */
  
+#ifdef CONFIG_PPRO_RAM_BUG 
+
 int __init ppro_with_ram_bug(void)
 {
 	/* Uses data from early_cpu_detect now */
@@ -55,6 +57,8 @@
 	}
 	return 0;
 }
+#endif
+
 	
 #define LVL_1_INST	1
 #define LVL_1_DATA	2
linux-2.6.8.1_new/arch/i386/kernel/cpu/mtrr/Makefile renamed from linux-2.6.8.1/arch/i386/kernel/cpu/mtrr/Makefile +3 -4
diff -Naur -X ./patt ./linux-2.6.8.1/arch/i386/kernel/cpu/mtrr/Makefile ./linux-2.6.8.1_new/arch/i386/kernel/cpu/mtrr/Makefile
@@ -1,5 +1,4 @@
 obj-y		:= main.o if.o generic.o state.o
-obj-y		+= amd.o
-obj-y		+= cyrix.o
-obj-y		+= centaur.o
-
+obj-$(CONFIG_MTRR_AMD)		+= amd.o
+obj-$(CONFIG_MTRR_CYRIX)	+= cyrix.o
+obj-$(CONFIG_MTRR_CENTAUR)	+= centaur.o
linux-2.6.8.1_new/arch/i386/kernel/cpu/mtrr/main.c renamed from linux-2.6.8.1/arch/i386/kernel/cpu/mtrr/main.c +6 -0
diff -Naur -X ./patt ./linux-2.6.8.1/arch/i386/kernel/cpu/mtrr/main.c ./linux-2.6.8.1_new/arch/i386/kernel/cpu/mtrr/main.c
@@ -536,9 +536,15 @@
 
 static void __init init_ifs(void)
 {
+#ifdef CONFIG_MTRR_AMD
 	amd_init_mtrr();
+#endif
+#ifdef CONFIG_MTRR_CYRIX
 	cyrix_init_mtrr();
+#endif
+#ifdef CONFIG_MTRR_CENTAUR
 	centaur_init_mtrr();
+#endif
 }
 
 static void __init init_other_cpus(void)
linux-2.6.8.1_new/arch/i386/mm/init.c renamed from linux-2.6.8.1/arch/i386/mm/init.c +13 -0
diff -Naur -X ./patt ./linux-2.6.8.1/arch/i386/mm/init.c ./linux-2.6.8.1_new/arch/i386/mm/init.c
@@ -563,7 +563,12 @@
 
 void __init mem_init(void)
 {
+#ifdef CONFIG_PPRO_RAM_BUG 
+
 	extern int ppro_with_ram_bug(void);
+
+#endif
+
 	int codesize, reservedpages, datasize, initsize;
 	int tmp;
 	int bad_ppro;
@@ -572,9 +577,17 @@
 	if (!mem_map)
 		BUG();
 #endif
+
+#ifdef CONFIG_PPRO_RAM_BUG 
 	
 	bad_ppro = ppro_with_ram_bug();
 
+#else
+
+	bad_ppro=0;
+
+#endif
+
 #ifdef CONFIG_HIGHMEM
 	/* check that fixmap and pkmap do not overlap */
 	if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
linux-2.6.8.1_new/drivers/block/Makefile renamed from linux-2.6.8.1/drivers/block/Makefile +3 -1
diff -Naur -X ./patt ./linux-2.6.8.1/drivers/block/Makefile ./linux-2.6.8.1_new/drivers/block/Makefile
@@ -13,7 +13,9 @@
 # kblockd threads
 #
 
-obj-y	:= elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o
+obj-y	:= elevator.o ll_rw_blk.o ioctl.o genhd.o
+
+obj-$(CONFIG_SCSI_IOCTL) += scsi_ioctl.o
 
 obj-$(CONFIG_IOSCHED_NOOP)	+= noop-iosched.o
 obj-$(CONFIG_IOSCHED_AS)	+= as-iosched.o
linux-2.6.8.1_new/drivers/input/mouse/Kconfig renamed from linux-2.6.8.1/drivers/input/mouse/Kconfig +8 -1
diff -Naur -X ./patt ./linux-2.6.8.1/drivers/input/mouse/Kconfig ./linux-2.6.8.1_new/drivers/input/mouse/Kconfig
@@ -124,9 +124,16 @@
 	select SERIO
 	help
 	  Say Y (or M) if you want to use a DEC VSXXX-AA (hockey
-	  puck) or a VSXXX-GA (rectangular) mouse. Theses mice are
+	  puck) or a VSXXX-GA (rectangular) mouse. These mice are
 	  typically used on DECstations or VAXstations, but can also
 	  be used on any box capable of RS232 (with some adaptor
 	  described in the source file). This driver should, in theory,
 	  also work with the digitizer DEC produced, but it isn't tested
 	  with that (I don't have the hardware yet).
+
+config MOUSE_SYNAPTICS
+	bool "Synaptics TouchPad support"
+	depends on INPUT && INPUT_MOUSE
+	help
+	  Say Y if you want Synaptics TouchPad support compiled in your
+	  kernel. This will increase the kernel size by approximately 8KB.
\ No newline at end of file
linux-2.6.8.1_new/drivers/input/mouse/Makefile renamed from linux-2.6.8.1/drivers/input/mouse/Makefile +3 -1
diff -Naur -X ./patt ./linux-2.6.8.1/drivers/input/mouse/Makefile ./linux-2.6.8.1_new/drivers/input/mouse/Makefile
@@ -14,4 +14,6 @@
 obj-$(CONFIG_MOUSE_SERIAL)	+= sermouse.o
 obj-$(CONFIG_MOUSE_VSXXXAA)	+= vsxxxaa.o
 
-psmouse-objs  := psmouse-base.o logips2pp.o synaptics.o
+psmouse-objs  := psmouse-base.o logips2pp.o
+
+obj-$(CONFIG_MOUSE_SYNAPTICS)	+= synaptics.o
linux-2.6.8.1_new/drivers/input/mouse/psmouse-base.c renamed from linux-2.6.8.1/drivers/input/mouse/psmouse-base.c +10 -0
diff -Naur -X ./patt ./linux-2.6.8.1/drivers/input/mouse/psmouse-base.c ./linux-2.6.8.1_new/drivers/input/mouse/psmouse-base.c
@@ -413,6 +413,9 @@
 static int psmouse_extensions(struct psmouse *psmouse,
 			      unsigned int max_proto, int set_properties)
 {
+
+#ifdef CONFIG_MOUSE_SYNAPTICS
+
 	int synaptics_hardware = 0;
 
 /*
@@ -442,6 +445,8 @@
 		synaptics_reset(psmouse);
 	}
 
+#endif
+
 	if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) {
 
 		if (set_properties) {
@@ -489,6 +494,9 @@
  * Okay, all failed, we have a standard mouse here. The number of the buttons
  * is still a question, though. We assume 3.
  */
+
+#ifdef CONFIG_MOUSE_SYNAPTICS
+
 	if (synaptics_hardware) {
 /*
  * We detected Synaptics hardware but it did not respond to IMPS/2 probes.
@@ -500,6 +508,8 @@
 		psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS);
 	}
 
+#endif
+
 	return PSMOUSE_PS2;
 }
 
linux-2.6.8.1_new/drivers/scsi/Kconfig renamed from linux-2.6.8.1/drivers/scsi/Kconfig +7 -0
diff -Naur -X ./patt ./linux-2.6.8.1/drivers/scsi/Kconfig ./linux-2.6.8.1_new/drivers/scsi/Kconfig
@@ -21,6 +21,13 @@
 	  However, do not compile this as a module if your root file system
 	  (the one containing the directory /) is located on a SCSI device.
 
+config SCSI_IOCTL
+	bool "SCSI IOCTL infrastructure support (READ HELP)"
+	default y
+	help
+	  This option enables SCSI IOCTL infrastructure support needed even
+	  for some non-SCSI devices. Normally you should say Y.
+
 config SCSI_PROC_FS
 	bool "legacy /proc/scsi/ support"
 	depends on SCSI && PROC_FS
#2 lore raw
Quoted 38 lines · Dmitry Golubev

...

linux-2.6.8.1_new/arch/i386/Kconfig renamed from linux-2.6.8.1/arch/i386/Kconfig +31 -0
@@ -321,6 +321,46 @@
 
 endchoice
 
+menu "Specific x86 vendor support"
+	depends on X86
+	
+config X86_CPU_VENDOR_AMD
+	bool "Advanced Micro Devices"
+	default y
+
+config X86_CPU_VENDOR_CYRIX
+	bool "Cyrix | VIA | National Semiconductor"
+	default y
+
+config X86_CPU_VENDOR_CENTAUR
+	bool "Centaur Technology"
+	default y
+	help
+	  This option enables support for Centaur C6 (IDT WinChip) 
+	  processor family.
+
+config X86_CPU_VENDOR_TRANSMETA
+	bool "Transmeta Crusoe"
+	default y
+
+config X86_CPU_VENDOR_INTEL
+	bool "Intel"
+	default y
+
+config X86_CPU_VENDOR_RISE
+	bool "Rise Technology"
+	default y
+
+config X86_CPU_VENDOR_NEXGEN

linux-2.6.8.1_new/arch/i386/Kconfig line 363

Quoted 10 lines
linux-2.6.8.1_new/arch/i386/Kconfig renamed from linux-2.6.8.1/arch/i386/Kconfig +9 -0
+	bool "NexGen"
+	default y
+
+config X86_CPU_VENDOR_UMC
+	bool "UMC Green CPUs"
+	default y
+
+endmenu
+
...

Please don't include this.

I'd prefer to switch i386 cpu selection to a different scheme which gives you effectively these options for free without additional options.

@Andrew:
You rejected my i386 cpu selection patch for 2.6 some time ago, and asked me to resend it for 2.7 .
With the new 2.6 development model, will you now accept this patch in 2.6?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
Quoted 1 line

Please don't include this.

what a good start...

Quoted 2 lines

I'd prefer to switch i386 cpu selection to a different scheme which gives you effectively these options for free without additional options.

I admit, I might have missed the latest version of your patch, but in what I have seen, some functionality have been missing comparing to my patch (do you have a possibility to compile a kernel especially for NexGen, Transmeta or UMC?), and it also changes user experience, which obviously should not happen in the stable branch. However, it might be a good idea to work on your patch for v 2.7.

Anyway, if you would like, I can separate CPU support part of the patch from the other parts...

Dmitry