2004-04-05 20:56:53

by Matt Mackall

[permalink] [raw]
Subject: [PATCH] Drop exported symbols list if !modules


Drop ksyms if we've built without module support

From: Zwane Mwaikambo <[email protected]>
Subject: Re: 2.6.1-rc1-tiny2

Index: linux-2.6.1-rc1-tiny2/arch/alpha/kernel/Makefile===================================================================
RCS file: /home/cvsroot/linux-2.6.1-rc1-tiny2/arch/alpha/kernel/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 Makefile


tiny-mpm/arch/alpha/kernel/Makefile | 4 ++--
tiny-mpm/arch/i386/kernel/Makefile | 4 ++--
tiny-mpm/arch/ia64/kernel/Makefile | 4 ++--
tiny-mpm/arch/m68k/kernel/Makefile | 4 ++--
tiny-mpm/arch/parisc/kernel/Makefile | 4 ++--
tiny-mpm/arch/sh/kernel/Makefile | 4 ++--
tiny-mpm/arch/sparc64/kernel/Makefile | 4 ++--
tiny-mpm/arch/x86_64/kernel/Makefile | 4 ++--
8 files changed, 16 insertions(+), 16 deletions(-)

Index: tiny/arch/alpha/kernel/Makefile
===================================================================
--- tiny.orig/arch/alpha/kernel/Makefile 2003-12-17 20:58:48.000000000 -0600
+++ tiny/arch/alpha/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -8,13 +8,13 @@

obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
irq_alpha.o signal.o setup.o ptrace.o time.o semaphore.o \
- alpha_ksyms.o systbls.o err_common.o
+ systbls.o err_common.o

obj-$(CONFIG_VGA_HOSE) += console.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_PCI) += pci.o pci_iommu.o
obj-$(CONFIG_SRM_ENV) += srm_env.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += alpha_ksyms.o module.o

ifdef CONFIG_ALPHA_GENERIC

Index: tiny/arch/i386/kernel/Makefile
===================================================================
--- tiny.orig/arch/i386/kernel/Makefile 2004-04-02 20:25:48.000000000 -0600
+++ tiny/arch/i386/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -6,7 +6,7 @@

obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
- pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
+ pci-dma.o i387.o dmi_scan.o bootflag.o \
doublefault.o

obj-y += cpu/
@@ -26,7 +26,7 @@
obj-$(CONFIG_X86_IO_APIC) += io_apic.o
obj-$(CONFIG_X86_NUMAQ) += numaq.o
obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += module.o i386_ksyms.o
obj-y += sysenter.o vsyscall.o
obj-$(CONFIG_ACPI_SRAT) += srat.o
obj-$(CONFIG_HPET_TIMER) += time_hpet.o
Index: tiny/arch/ia64/kernel/Makefile
===================================================================
--- tiny.orig/arch/ia64/kernel/Makefile 2004-04-02 20:24:32.000000000 -0600
+++ tiny/arch/ia64/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -4,7 +4,7 @@

extra-y := head.o init_task.o vmlinux.lds.s

-obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \
+obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o irq.o irq_ia64.o \
irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \
salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o unwind.o mca.o mca_asm.o

@@ -14,7 +14,7 @@
obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o
obj-$(CONFIG_IA64_PALINFO) += palinfo.o
obj-$(CONFIG_IOSAPIC) += iosapic.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += ia64_ksyms.o module.o
obj-$(CONFIG_SMP) += smp.o smpboot.o
obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o
obj-$(CONFIG_IA64_CYCLONE) += cyclone.o
Index: tiny/arch/m68k/kernel/Makefile
===================================================================
--- tiny.orig/arch/m68k/kernel/Makefile 2004-03-25 13:36:07.000000000 -0600
+++ tiny/arch/m68k/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -10,9 +10,9 @@
extra-y += vmlinux.lds.s

obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \
- sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
+ sys_m68k.o time.o semaphore.o setup.o

obj-$(CONFIG_PCI) += bios32.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += m68k_ksyms.o module.o

EXTRA_AFLAGS := -traditional
Index: tiny/arch/parisc/kernel/Makefile
===================================================================
--- tiny.orig/arch/parisc/kernel/Makefile 2004-03-03 14:00:22.000000000 -0600
+++ tiny/arch/parisc/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -13,13 +13,13 @@
obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
ptrace.o hardware.o inventory.o drivers.o semaphore.o \
- signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
+ signal.o hpmc.o real2.o unaligned.o \
process.o processor.o pdc_cons.o pdc_chassis.o

obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_PA11) += pci-dma.o
obj-$(CONFIG_PCI) += pci.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += parisc_ksyms.o module.o
obj-$(CONFIG_PARISC64) += binfmt_elf32.o sys_parisc32.o ioctl32.o signal32.o
# only supported for PCX-W/U in 64-bit mode at the moment
obj-$(CONFIG_PARISC64) += perf.o perf_asm.o
Index: tiny/arch/sh/kernel/Makefile
===================================================================
--- tiny.orig/arch/sh/kernel/Makefile 2004-03-03 14:00:26.000000000 -0600
+++ tiny/arch/sh/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -6,7 +6,7 @@

obj-y := process.o signal.o entry.o traps.o irq.o \
ptrace.o setup.o time.o sys_sh.o semaphore.o \
- io.o io_generic.o sh_ksyms.o
+ io.o io_generic.o

obj-y += cpu/

@@ -15,7 +15,7 @@
obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o
obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += sh_ksyms.o module.o

USE_STANDARD_AS_RULE := true

Index: tiny/arch/sparc64/kernel/Makefile
===================================================================
--- tiny.orig/arch/sparc64/kernel/Makefile 2003-12-17 20:58:18.000000000 -0600
+++ tiny/arch/sparc64/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -11,7 +11,7 @@
traps.o devices.o auxio.o \
irq.o ptrace.o time.o sys_sparc.o signal.o \
unaligned.o central.o pci.o starfire.o semaphore.o \
- power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o
+ power.o sbus.o iommu_common.o chmc.o

obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \
pci_psycho.o pci_sabre.o pci_schizo.o
@@ -19,7 +19,7 @@
obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o
obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o
-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += sparc64_ksyms.o module.o
obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o
obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o

Index: tiny/arch/x86_64/kernel/Makefile
===================================================================
--- tiny.orig/arch/x86_64/kernel/Makefile 2004-04-02 20:24:33.000000000 -0600
+++ tiny/arch/x86_64/kernel/Makefile 2004-04-02 20:28:12.000000000 -0600
@@ -6,7 +6,7 @@
EXTRA_AFLAGS := -traditional
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
- x8664_ksyms.o i387.o syscall.o vsyscall.o \
+ i387.o syscall.o vsyscall.o \
setup64.o bootflag.o e820.o reboot.o warmreboot.o
obj-y += mce.o acpi/

@@ -26,7 +26,7 @@
obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o
obj-$(CONFIG_SWIOTLB) += swiotlb.o

-obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_MODULES) += x8664_ksyms.o module.o

obj-y += topology.o



--
Matt Mackall : http://www.selenic.com : Linux development and consulting


2004-04-05 22:47:24

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

On Tue, 2004-04-06 at 06:55, Matt Mackall wrote:
> Drop ksyms if we've built without module support
>
> From: Zwane Mwaikambo <[email protected]>
> Subject: Re: 2.6.1-rc1-tiny2

Other than saving a little compile time, does this actually do anything?

I'm not against it, I just don't think I see the point.

Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell

2004-04-05 23:07:39

by Matt Mackall

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

On Tue, Apr 06, 2004 at 08:45:01AM +1000, Rusty Russell wrote:
> On Tue, 2004-04-06 at 06:55, Matt Mackall wrote:
> > Drop ksyms if we've built without module support
> >
> > From: Zwane Mwaikambo <[email protected]>
> > Subject: Re: 2.6.1-rc1-tiny2
>
> Other than saving a little compile time, does this actually do anything?
>
> I'm not against it, I just don't think I see the point.

Well it obviously saves memory and image size too; I'm in the process
of merging bits from my -tiny tree. As bloat has a way of being
well-distributed across the code base, it's going to take many small
trimmings to cut it back. Most of the 150 or so patches I've got now
save between 1 and 8k. Doesn't sound like much, but it adds up.

--
Matt Mackall : http://www.selenic.com : Linux development and consulting

2004-04-05 23:17:58

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

On Tue, 2004-04-06 at 09:07, Matt Mackall wrote:
> On Tue, Apr 06, 2004 at 08:45:01AM +1000, Rusty Russell wrote:
> > On Tue, 2004-04-06 at 06:55, Matt Mackall wrote:
> > > Drop ksyms if we've built without module support
> > >
> > > From: Zwane Mwaikambo <[email protected]>
> > > Subject: Re: 2.6.1-rc1-tiny2
> >
> > Other than saving a little compile time, does this actually do anything?
> >
> > I'm not against it, I just don't think I see the point.
>
> Well it obviously saves memory and image size too;

Please measure it. It's not obvious to me at all.

Thanks,
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell

2004-04-05 23:28:19

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

Rusty Russell <[email protected]> wrote:
>
> On Tue, 2004-04-06 at 09:07, Matt Mackall wrote:
> > On Tue, Apr 06, 2004 at 08:45:01AM +1000, Rusty Russell wrote:
> > > On Tue, 2004-04-06 at 06:55, Matt Mackall wrote:
> > > > Drop ksyms if we've built without module support
> > > >
> > > > From: Zwane Mwaikambo <[email protected]>
> > > > Subject: Re: 2.6.1-rc1-tiny2
> > >
> > > Other than saving a little compile time, does this actually do anything?
> > >
> > > I'm not against it, I just don't think I see the point.
> >
> > Well it obviously saves memory and image size too;
>
> Please measure it. It's not obvious to me at all.

Miniscule savings

text data bss dec hex filename
3221815 862456 0 4084271 3e522f vmlinux-before
3221591 862456 0 4084047 3e514f vmlinux-after

2004-04-05 23:36:38

by Matt Mackall

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

On Mon, Apr 05, 2004 at 04:30:19PM -0700, Andrew Morton wrote:
> Rusty Russell <[email protected]> wrote:
> >
> > On Tue, 2004-04-06 at 09:07, Matt Mackall wrote:
> > > On Tue, Apr 06, 2004 at 08:45:01AM +1000, Rusty Russell wrote:
> > > > On Tue, 2004-04-06 at 06:55, Matt Mackall wrote:
> > > > > Drop ksyms if we've built without module support
> > > > >
> > > > > From: Zwane Mwaikambo <[email protected]>
> > > > > Subject: Re: 2.6.1-rc1-tiny2
> > > >
> > > > Other than saving a little compile time, does this actually do anything?
> > > >
> > > > I'm not against it, I just don't think I see the point.
> > >
> > > Well it obviously saves memory and image size too;
> >
> > Please measure it. It's not obvious to me at all.
>
> Miniscule savings
>
> text data bss dec hex filename
> 3221815 862456 0 4084271 3e522f vmlinux-before
> 3221591 862456 0 4084047 3e514f vmlinux-after

I was seeing this when I added it to my tree circa 2.6.1:

701262 58619 15616 775497 bd549 vmlinux before
700530 58619 15616 774765 bd26d vmlinux after

..which I would expect to grow with code size.

On the other hand, I'm now seeing:

0 0 0 0 0 arch/i386/kernel/i386_ksyms.o

So something's changed.

--
Matt Mackall : http://www.selenic.com : Linux development and consulting

2004-04-05 23:53:00

by Brian Gerst

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

Matt Mackall wrote:
> On Tue, Apr 06, 2004 at 08:45:01AM +1000, Rusty Russell wrote:
>
>>On Tue, 2004-04-06 at 06:55, Matt Mackall wrote:
>>
>>>Drop ksyms if we've built without module support
>>>
>>>From: Zwane Mwaikambo <[email protected]>
>>>Subject: Re: 2.6.1-rc1-tiny2
>>
>>Other than saving a little compile time, does this actually do anything?
>>
>>I'm not against it, I just don't think I see the point.
>
>
> Well it obviously saves memory and image size too; I'm in the process
> of merging bits from my -tiny tree. As bloat has a way of being
> well-distributed across the code base, it's going to take many small
> trimmings to cut it back. Most of the 150 or so patches I've got now
> save between 1 and 8k. Doesn't sound like much, but it adds up.
>

EXPORT_SYMBOL() is a no-op when modules are disabled:
$ size arch/i386/kernel/i386_ksyms.o
text data bss dec hex filename
0 0 0 0 0 arch/i386/kernel/i386_ksyms.o

Although, what really should be done is to move the exports to the
appropriate files instead of keeping them lumped together.

--
Brian Gerst

2004-04-06 00:48:59

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH] Drop exported symbols list if !modules

On Tue, 2004-04-06 at 09:30, Andrew Morton wrote:
> Rusty Russell <[email protected]> wrote:
> > Please measure it. It's not obvious to me at all.
>
> Miniscule savings
>
> text data bss dec hex filename
> 3221815 862456 0 4084271 3e522f vmlinux-before
> 3221591 862456 0 4084047 3e514f vmlinux-after

Reproduced here: that's the .comment section getting a little larger.

This gets stripped in building arch/i386/boot/vmlinux.bin, and hence
arch/i386/boot/bzImage.

So, the patch is just churn AFAICT.

Thanks,
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell