kernel-ark/arch/powerpc/kernel
Emil Medve eda09fbdcd [POWERPC] Optimize counting distinct entries in the relocation sections
When a module has relocation sections with tens of thousands of
entries, counting the distinct/unique entries only (i.e. no
duplicates) at load time can take tens of seconds and up to minutes.
The sore point is the count_relocs() function which is called as part
of the architecture specific module loading processing path:

	-> load_module()			generic
	   -> module_frob_arch_sections()	arch specific
	      -> get_plt_size()		32-bit
	      -> get_stubs_size()	64-bit
		 -> count_relocs()

Here count_relocs is being called to find out how many distinct
targets of R_PPC_REL24 relocations there are, since each distinct
target needs a PLT entry or a stub created for it.

The previous counting algorithm has O(n^2) complexity.  Basically two
solutions were proposed on the e-mail list: a hash based approach and
a sort based approach.

The hash based approach is the fastest (O(n)) but the has it needs
additional memory and for certain corner cases it could take lots of
memory due to the degeneration of the hash.  One such proposal was
submitted here:

http://ozlabs.org/pipermail/linuxppc-dev/2007-June/037641.html

The sort based approach is slower (O(n * log n + n)) but if the
sorting is done "in place" it doesn't need additional memory.
This has O(n + n * log n) complexity with no additional memory
requirements.

This commit implements the in-place sort option.

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-21 15:05:58 +11:00
..
vdso32 [POWERPC] vdso: Fixes for cache block sizes 2007-11-20 13:56:31 +11:00
vdso64 [POWERPC] vdso: Fixes for cache block sizes 2007-11-20 13:56:31 +11:00
align.c [POWERPC] Handle alignment faults on SPE load/store instructions 2007-09-14 08:51:48 -05:00
asm-offsets.c [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
audit.c [PATCH] audit signal recipients 2007-05-11 05:38:25 -04:00
binfmt_elf32.c powerpc: Use linux/elfcore-compat.h 2007-10-17 08:42:51 -07:00
btext.c [POWERPC] Fix early btext debug on PowerMac 2007-11-13 16:22:44 +11:00
clock.c [POWERPC] clk.h interface for platforms 2007-10-03 09:11:56 +10:00
compat_audit.c [PATCH] add SIGNAL syscall class (v3) 2007-05-11 05:38:25 -04:00
cpu_setup_6xx.S Spelling fix: explicitly 2007-10-19 23:22:55 +02:00
cpu_setup_44x.S [POWERPC] 4xx: 440EPx/GRx incorrect write to DDR SDRAM errata workaround 2007-10-03 07:20:18 -05:00
cpu_setup_pa6t.S [POWERPC] pasemi: Enable one more hid bit 2007-04-24 21:31:49 +10:00
cpu_setup_ppc970.S [POWERPC] powerpc: Enable DEEPNAP power savings mode on 970MP 2006-10-16 16:32:25 +10:00
cputable.c [POWERPC] add e300c4 entry to cputable 2007-12-11 13:57:17 -06:00
crash_dump.c [POWERPC] FWNMI is only used on pSeries 2007-09-19 15:25:34 +10:00
crash.c [POWERPC] Clean out a bunch of duplicate includes 2007-08-17 11:01:51 +10:00
dma_64.c Update arch/ to use sg helpers 2007-10-22 21:19:59 +02:00
entry_32.S [POWERPC] Avoid unpaired stwcx. on some processors 2007-11-13 16:22:43 +11:00
entry_64.S [POWERPC] Add 1TB workaround for PA6T 2007-10-17 22:30:09 +10:00
firmware.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
fpu.S [POWERPC] Restore copyright notice in arch/powerpc/kernel/fpu.S 2006-08-30 14:45:35 +10:00
head_8xx.S [POWERPC] 8xx: Work around CPU15 erratum. 2007-10-03 20:36:36 -05:00
head_32.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
head_40x.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
head_44x.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
head_64.S [POWERPC] Fix si_addr value on low level hash failures 2007-11-08 14:15:34 +11:00
head_booke.h
head_fsl_booke.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
ibmebus.c Update arch/ to use sg helpers 2007-10-22 21:19:59 +02:00
idle_6xx.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
idle_power4.S [POWERPC] powermac: Support G5 CPU hotplug 2007-05-07 20:31:13 +10:00
idle.c [POWERPC] Fix sysctl table check failure on PowerMac 2007-11-08 14:15:30 +11:00
init_task.c [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c 2006-10-02 07:57:20 -07:00
io.c [POWERPC] Move inline asm eieio to using eieio inline function 2007-07-10 00:33:14 -05:00
iomap.c [POWERPC] Add 64-bit resources support to pci_iomap 2007-09-20 07:36:52 -05:00
iommu.c [POWERPC] iommu_free_table doesn't need the device_node 2007-12-11 13:41:33 +11:00
irq.c Spelling fix: explicitly 2007-10-19 23:22:55 +02:00
isa-bridge.c [POWERPC] pci_controller->arch_data really is a struct device_node * 2007-12-11 13:42:37 +11:00
kprobes.c kprobes: support kretprobe blacklist 2007-10-16 09:43:10 -07:00
l2cr_6xx.S Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
legacy_serial.c [POWERPC] arch/powerpc/: Spelling fixes 2007-12-20 16:15:51 +11:00
lparcfg.c [POWERPC] lparcfg: Remove useless buffer allocation 2007-12-11 13:41:28 +11:00
machine_kexec_32.c Storage class should be first 2006-06-26 18:57:34 +02:00
machine_kexec_64.c [POWERPC] Rename get_property to of_get_property: arch/powerpc 2007-04-13 03:55:19 +10:00
machine_kexec.c Use extended crashkernel command line on ppc64 2007-10-19 11:53:51 -07:00
Makefile [POWERPC] Stop the TOC overflowing for large builds 2007-12-20 17:13:34 +11:00
misc_32.S [POWERPC] kernel_execve is identical in 32 and 64 bit 2007-12-11 13:34:39 +11:00
misc_64.S [POWERPC] kernel_execve is identical in 32 and 64 bit 2007-12-11 13:34:39 +11:00
misc.S [POWERPC] kernel_execve is identical in 32 and 64 bit 2007-12-11 13:34:39 +11:00
module_32.c [POWERPC] Optimize counting distinct entries in the relocation sections 2007-12-21 15:05:58 +11:00
module_64.c [POWERPC] Optimize counting distinct entries in the relocation sections 2007-12-21 15:05:58 +11:00
msi.c [POWERPC] PowerPC MSI infrastructure 2007-05-08 13:40:31 +10:00
nvram_64.c [POWERPC] pseries: Eliminate global error_log_cnt variable 2007-08-17 11:01:52 +10:00
of_device.c [POWERPC] Move of_device allocation into of_device.[ch] 2007-10-17 22:30:07 +10:00
of_platform.c [POWERPC] Use of_register_driver to implement of_register_platform_driver 2007-12-11 13:34:39 +11:00
paca.c [POWERPC] Implement SLB shadow buffer 2006-08-08 17:08:56 +10:00
pci_32.c [POWERPC] Merge 32 and 64 bits pcibios_enable_device 2007-12-20 16:18:11 +11:00
pci_64.c [POWERPC] Merge 32 and 64 bits pcibios_enable_device 2007-12-20 16:18:11 +11:00
pci_dn.c [POWERPC] pci_controller->arch_data really is a struct device_node * 2007-12-11 13:42:37 +11:00
pci-common.c [POWERPC] Fix PCI IRQ fallback code to not map IRQ 0 2007-12-20 16:18:17 +11:00
pmc.c [POWERPC] Fix typo: MMCR0_PMA0 != MMCR0_PMAO 2007-05-22 20:20:56 +10:00
ppc32.h
ppc_ksyms.c [POWERPC] Fix build errors when BLOCK=n 2007-09-22 14:49:22 +10:00
proc_ppc64.c [PATCH] mark struct file_operations const 2 2007-02-12 09:48:44 -08:00
process.c [POWERPC] Fix hardware IRQ time accounting problem. 2007-12-06 16:08:59 +11:00
prom_init.c [POWERPC] ] Fix memset size error 2007-11-08 14:15:33 +11:00
prom_parse.c [POWERPC] Add of_translate_dma_address 2007-12-11 15:43:35 +11:00
prom.c [POWERPC] Use SLB size from the device tree 2007-12-11 13:45:56 +11:00
ptrace32.c [POWERPC] Add CHECK_FULL_REGS in several places in ptrace code 2007-10-03 11:48:43 +10:00
ptrace.c Consolidate PTRACE_DETACH 2007-10-16 09:42:49 -07:00
rtas_flash.c Slab API: remove useless ctor parameter and reorder parameters 2007-10-17 08:42:45 -07:00
rtas_pci.c [POWERPC] pci32: Add flags modifying the PCI code behaviour 2007-12-20 16:18:07 +11:00
rtas-proc.c [POWERPC] Fix ppc_rtas_progress_show() 2007-05-17 21:11:15 +10:00
rtas-rtc.c [PATCH] powerpc: reorg RTAS delay code 2006-06-09 21:21:06 +10:00
rtas.c Revert "[POWERPC] Fix RTAS os-term usage on kernel panic" 2007-12-03 09:39:45 +11:00
semaphore.c
setup_32.c [POWERPC] Only call ppc_md.setup_arch() if it is provided 2007-10-11 20:39:36 +10:00
setup_64.c [POWERPC] Fix cache line vs. block size confusion 2007-11-08 14:15:30 +11:00
setup-common.c [POWERPC] Cleanup SMT thread handling 2007-12-03 13:56:25 +11:00
setup.h [PATCH] powerpc: Make early xmon logic immune to location of early parsing 2006-05-19 15:02:12 +10:00
signal_32.c [POWERPC] arch/powerpc: Remove duplicate includes 2007-12-20 17:13:50 +11:00
signal_64.c [POWERPC] Implement logging of unhandled signals 2007-10-12 14:05:18 +10:00
signal.c [POWERPC] Implement logging of unhandled signals 2007-10-12 14:05:18 +10:00
signal.h [POWERPC] Less ifdef's in signal.c/signal.h 2007-06-14 22:29:58 +10:00
smp-tbsync.c [POWERPC] Replace kmalloc+memset with kzalloc 2006-12-04 20:42:09 +11:00
smp.c Convert cpu_sibling_map to be a per cpu variable 2007-10-16 09:42:50 -07:00
softemu8xx.c [POWERPC] 8xx: Move softemu8xx.c from arch/ppc 2007-10-04 11:02:54 -05:00
suspend.c [PATCH] x86: Move swsusp __pa() dependent code to arch portion 2007-05-02 19:27:07 +02:00
swsusp_32.S [POWERPC] Make altivec code in swsusp_32.S depend on CONFIG_ALTIVEC 2007-11-08 14:15:34 +11:00
swsusp_64.c [POWERPC] powermac: Suspend to disk on G5 2007-05-07 20:31:14 +10:00
swsusp_asm64.S [POWERPC] powermac: Suspend to disk on G5 2007-05-07 20:31:14 +10:00
swsusp.c powerpc: fixup hard_irq_disable semantics 2007-05-11 08:29:34 -07:00
sys_ppc32.c remove include/asm-*/ipc.h 2007-10-17 08:42:55 -07:00
syscalls.c remove include/asm-*/ipc.h 2007-10-17 08:42:55 -07:00
sysfs.c [POWERPC] Remove warning in arch/powerpc/kernel/sysfs.c 2007-09-14 01:33:22 +10:00
systbl.S [POWERPC] Align the sys_call_table 2007-10-11 14:36:47 +10:00
tau_6xx.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
time.c [POWERPC] Optimize account_system_vtime 2007-12-20 16:15:46 +11:00
traps.c [POWERPC] Emulate isel (Integer Select) instruction 2007-12-11 13:57:16 -06:00
udbg_16550.c [POWERPC] Remove useless volatiles in udbg_16550.c 2007-12-11 15:43:35 +11:00
udbg.c [POWERPC] Early debug forces console log level to max 2007-12-11 15:43:35 +11:00
vdso.c [POWERPC] vdso: Fixes for cache block sizes 2007-11-20 13:56:31 +11:00
vecemu.c
vector.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
vio.c Driver core: change add_uevent_var to use a struct 2007-10-12 14:51:01 -07:00
vmlinux.lds.S [POWERPC] Fix link errors for allyesconfig 2007-11-08 14:15:33 +11:00