linux-mips
[Top] [All Lists]

[PATCH v2 1/2] hugetlb: Provide a default HPAGE_SHIFT if !CONFIG_HUGETLB

To: linux-mips@linux-mips.org, ralf@linux-mips.org, Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] hugetlb: Provide a default HPAGE_SHIFT if !CONFIG_HUGETLB_PAGE
From: David Daney <ddaney.cavm@gmail.com>
Date: Thu, 17 Nov 2011 13:57:29 -0800
Cc: David Daney <david.daney@cavium.com>, David Rientjes <rientjes@google.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=g2a7UfVNsxyKYNpY/vXm++bgGWrAnAplfeNavxnL5yk=; b=oNo82Ud4i1tNiHPyKIKvl3y0DFlKX3DAABRux/5XM9+yIofAt/eC4+dLBtjzixVhB1 o8Exn3jZrWW51trw891NQxJylrIV1U7KbsRkfxuOK9PBvOHbUx57fnMKEIXgdE3xu5Zf 5vCGJim4mzj5XG6Hl5aH5eo+xmj/oaFTbxYMc=
In-reply-to: <1321567050-13197-1-git-send-email-ddaney.cavm@gmail.com>
References: <1321567050-13197-1-git-send-email-ddaney.cavm@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
From: David Daney <david.daney@cavium.com>

When linux-next 10111117 is build for MIPS with
cavium-octeon_defconfig, we get:

  arch/mips/mm/tlb-r4k.c: In function 'local_flush_tlb_range':
  arch/mips/mm/tlb-r4k.c:129:28: error: 'HPAGE_SHIFT' undeclared (first use in 
this function)

The fix is to supply a dummy HPAGE_SHIFT in the !CONFIG_HUGETLB_PAGE
case.  Instead of supplying the non-huge value, as was done for
HPAGE_MASK and HPAGE_SIZE, we do BUG() instead.  This satisfies the
compiler, but give us runtime safety if someone were to use HPAGE_SIZE
incorrectly.

Cc: David Rientjes <rientjes@google.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
 include/linux/hugetlb.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 19644e0..380451c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -113,6 +113,7 @@ static inline void copy_huge_page(struct page *dst, struct 
page *src)
 #ifndef HPAGE_MASK
 #define HPAGE_MASK     PAGE_MASK               /* Keep the compiler happy */
 #define HPAGE_SIZE     PAGE_SIZE
+#define HPAGE_SHIFT    ({BUG(); 0; })
 #endif
 
 #endif /* !CONFIG_HUGETLB_PAGE */
-- 
1.7.2.3


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