linux-mips
[Top] [All Lists]

[patch] mips, mm: avoid using HPAGE constants without CONFIG_HUGETLB_PAG

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [patch] mips, mm: avoid using HPAGE constants without CONFIG_HUGETLB_PAGE
From: David Rientjes <rientjes@google.com>
Date: Sat, 19 Nov 2011 18:56:22 -0800 (PST)
Cc: Hillf Danton <dhillf@gmail.com>, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=date:from:x-x-sender:to:cc:subject:message-id:user-agent :mime-version:content-type; bh=tw7vXZJo7r8Tuw6EBHcj8wEN9jBscEw4gf40JC5deDU=; b=VANFMGbcp0Jm6UdL2DqmODL7healkZfDB9uUKNcC9MBKoHrtbS5jf1zWMBrR7Kii4l Cph52s8viu8uJfBc4OxQ==
Sender: linux-mips-bounce@linux-mips.org
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
HPAGE_{MASK,SHIFT,SIZE} are only defined with CONFIG_HUGETLB_PAGE, so
make sure to never use them unless that option is enabled.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 arch/mips/mm/tlb-r4k.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -124,9 +124,11 @@ void local_flush_tlb_range(struct vm_area_struct *vma, 
unsigned long start,
 
                ENTER_CRITICAL(flags);
                if (huge) {
+#ifdef CONFIG_HUGETLB_PAGE
                        start = round_down(start, HPAGE_SIZE);
                        end = round_up(end, HPAGE_SIZE);
                        size = (end - start) >> HPAGE_SHIFT;
+#endif
                } else {
                        start = round_down(start, PAGE_SIZE << 1);
                        end = round_up(end, PAGE_SIZE << 1);
@@ -135,15 +137,16 @@ void local_flush_tlb_range(struct vm_area_struct *vma, 
unsigned long start,
                if (size <= current_cpu_data.tlbsize/2) {
                        int oldpid = read_c0_entryhi();
                        int newpid = cpu_asid(cpu, mm);
+                       unsigned long incr = PAGE_SIZE << 1;
 
-                       while (start < end) {
+#ifdef CONFIG_HUGETLB_PAGE
+                       if (huge)
+                               incr = HPAGE_SIZE;
+#endif
+                       for (; start < end; start += incr) {
                                int idx;
 
                                write_c0_entryhi(start | newpid);
-                               if (huge)
-                                       start += HPAGE_SIZE;
-                               else
-                                       start += (PAGE_SIZE << 1);
                                mtc0_tlbw_hazard();
                                tlb_probe();
                                tlb_probe_hazard();

<Prev in Thread] Current Thread [Next in Thread>