aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Daney <ddaney@caviumnetworks.com>2012-08-16 14:15:22 -0400
committerRalf Baechle <ralf@linux-mips.org>2012-10-11 05:04:35 -0400
commitf59a2d22a05272034e856b7a2dd7a3ab7864a2ae (patch)
tree5111649972d2ea819f9f3e17096d263485c858c5
parenta7911a8fd16201a28110c99ecb3deed8aebb4fdc (diff)
MIPS: Optimize pgd_init and pmd_init
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> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/4249/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/mm/pgtable-64.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index cda4e300eb0a..25407794edb4 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)
26 p = (unsigned long *) page; 26 p = (unsigned long *) page;
27 end = p + PTRS_PER_PGD; 27 end = p + PTRS_PER_PGD;
28 28
29 while (p < end) { 29 do {
30 p[0] = entry; 30 p[0] = entry;
31 p[1] = entry; 31 p[1] = entry;
32 p[2] = entry; 32 p[2] = entry;
33 p[3] = entry; 33 p[3] = entry;
34 p[4] = entry; 34 p[4] = entry;
35 p[5] = entry;
36 p[6] = entry;
37 p[7] = entry;
38 p += 8; 35 p += 8;
39 } 36 p[-3] = entry;
37 p[-2] = entry;
38 p[-1] = entry;
39 } while (p != end);
40} 40}
41 41
42#ifndef __PAGETABLE_PMD_FOLDED 42#ifndef __PAGETABLE_PMD_FOLDED
@@ -47,17 +47,17 @@ void pmd_init(unsigned long addr, unsigned long pagetable)
47 p = (unsigned long *) addr; 47 p = (unsigned long *) addr;
48 end = p + PTRS_PER_PMD; 48 end = p + PTRS_PER_PMD;
49 49
50 while (p < end) { 50 do {
51 p[0] = pagetable; 51 p[0] = pagetable;
52 p[1] = pagetable; 52 p[1] = pagetable;
53 p[2] = pagetable; 53 p[2] = pagetable;
54 p[3] = pagetable; 54 p[3] = pagetable;
55 p[4] = pagetable; 55 p[4] = pagetable;
56 p[5] = pagetable;
57 p[6] = pagetable;
58 p[7] = pagetable;
59 p += 8; 56 p += 8;
60 } 57 p[-3] = pagetable;
58 p[-2] = pagetable;
59 p[-1] = pagetable;
60 } while (p != end);
61} 61}
62#endif 62#endif
63 63