* [PATCH] MIPS: Optimize pgd_init and pmd_init
@ 2012-08-16 18:15 David Daney
2012-08-17 14:52 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2012-08-16 18:15 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: David Daney
From: David Daney <ddaney@caviumnetworks.com>
On a dual issue processor GCC generates code that saves a couple of
clock cycles per loop if we rearrange things slightly. Checking for
p != end saves a SLTU per loop, moving the increment to the middle can
let it dual issue on multi-issue processors.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
arch/mips/mm/pgtable-64.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index cda4e30..2540779 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -26,17 +26,17 @@ void pgd_init(unsigned long page)
p = (unsigned long *) page;
end = p + PTRS_PER_PGD;
- while (p < end) {
+ do {
p[0] = entry;
p[1] = entry;
p[2] = entry;
p[3] = entry;
p[4] = entry;
- p[5] = entry;
- p[6] = entry;
- p[7] = entry;
p += 8;
- }
+ p[-3] = entry;
+ p[-2] = entry;
+ p[-1] = entry;
+ } while (p != end);
}
#ifndef __PAGETABLE_PMD_FOLDED
@@ -47,17 +47,17 @@ void pmd_init(unsigned long addr, unsigned long pagetable)
p = (unsigned long *) addr;
end = p + PTRS_PER_PMD;
- while (p < end) {
+ do {
p[0] = pagetable;
p[1] = pagetable;
p[2] = pagetable;
p[3] = pagetable;
p[4] = pagetable;
- p[5] = pagetable;
- p[6] = pagetable;
- p[7] = pagetable;
p += 8;
- }
+ p[-3] = pagetable;
+ p[-2] = pagetable;
+ p[-1] = pagetable;
+ } while (p != end);
}
#endif
--
1.7.11.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MIPS: Optimize pgd_init and pmd_init
2012-08-16 18:15 [PATCH] MIPS: Optimize pgd_init and pmd_init David Daney
@ 2012-08-17 14:52 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2012-08-17 14:52 UTC (permalink / raw)
To: David Daney; +Cc: linux-mips, David Daney
On Thu, Aug 16, 2012 at 11:15:22AM -0700, David Daney wrote:
thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-17 14:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 18:15 [PATCH] MIPS: Optimize pgd_init and pmd_init David Daney
2012-08-17 14:52 ` Ralf Baechle
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.