* [PATCH] Use __fill_user() to clear bss.
@ 2007-11-11 8:52 Franck Bui-Huu
0 siblings, 0 replies; only message in thread
From: Franck Bui-Huu @ 2007-11-11 8:52 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
bss is relatively big, more than 70Kb on cobalt config, so it's a pity
to clear it one word per loop. Instead this patch uses __fill_user(),
which should be faster.
Since we do a function jump to __fill_user(), argument registers needs
to be modified. However at this point, they contains the firmware
arguments which are saved the bss section. To avoid issue, this patch
makes them part of the data section.
Also this patch makes sure that sp is setup before doing a jal.
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
Ralf,
I haven't done any benchmarks but it seems the right thing to do.
Please consider,
Franck
arch/mips/kernel/head.S | 14 ++++++--------
arch/mips/kernel/setup.c | 13 ++++++++++---
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 2367687..97273ae 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -171,14 +171,6 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
mtc0 t0, CP0_STATUS
#endif /* CONFIG_MIPS_MT_SMTC */
- PTR_LA t0, __bss_start # clear .bss
- LONG_S zero, (t0)
- PTR_LA t1, __bss_stop - LONGSIZE
-1:
- PTR_ADDIU t0, LONGSIZE
- LONG_S zero, (t0)
- bne t0, t1, 1b
-
LONG_S a0, fw_arg0 # firmware arguments
LONG_S a1, fw_arg1
LONG_S a2, fw_arg2
@@ -191,6 +183,12 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
set_saved_sp sp, t0, t1
PTR_SUBU sp, 4 * SZREG # init stack pointer
+ PTR_LA a0, __bss_start # clear .bss
+ move a1, zero
+ PTR_LA a2, __bss_stop
+ LONG_SUBU a2, a0
+ jal __fill_user # no need to save ra
+
j start_kernel
END(kernel_entry)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a06a27d..0eee73f 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -30,6 +30,7 @@
#include <asm/setup.h>
#include <asm/system.h>
+unsigned long kernelsp[NR_CPUS];
struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(cpu_data);
@@ -39,6 +40,15 @@ struct screen_info screen_info;
#endif
/*
+ * Note: they're part of the data section because they're used
+ * *before* bss is cleared.
+ */
+unsigned long fw_arg0 = ULONG_MAX;
+unsigned long fw_arg1 = ULONG_MAX;
+unsigned long fw_arg2 = ULONG_MAX;
+unsigned long fw_arg3 = ULONG_MAX;
+
+/*
* Despite it's name this variable is even if we don't have PCI
*/
unsigned int PCI_DMA_BUS_IS_PHYS;
@@ -571,9 +581,6 @@ static int __init dsp_disable(char *s)
__setup("nodsp", dsp_disable);
-unsigned long kernelsp[NR_CPUS];
-unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
-
#ifdef CONFIG_DEBUG_FS
struct dentry *mips_debugfs_dir;
static int __init debugfs_mips(void)
--
1.5.3.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-11 8:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-11 8:52 [PATCH] Use __fill_user() to clear bss Franck Bui-Huu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.