From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f68.google.com ([209.85.160.68]:37313 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeA0DVF (ORCPT ); Fri, 26 Jan 2018 22:21:05 -0500 Received: by mail-pl0-f68.google.com with SMTP id ay8so163771plb.4 for ; Fri, 26 Jan 2018 19:21:05 -0800 (PST) From: Huacai Chen To: Ralf Baechle Cc: James Hogan , "Steven J . Hill" , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen , "# 3 . 8+" Subject: [PATCH V2 06/12] MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() Date: Sat, 27 Jan 2018 11:21:16 +0800 Message-Id: <1517023276-17527-1-git-send-email-chenhc@lemote.com> In-Reply-To: <1517022752-3053-1-git-send-email-chenhc@lemote.com> References: <1517022752-3053-1-git-send-email-chenhc@lemote.com> Sender: stable-owner@vger.kernel.org List-ID: This patch is borrowed from ARM64 to ensure pmd_present() returns false after pmd_mknotpresent(). This is needed for THP. Cc: # 3.8+ References: 5bb1cc0ff9a6 ("arm64: Ensure pmd_present() returns false after pmd_mknotpresent()") Reviewed-by: James Hogan Signed-off-by: Huacai Chen --- arch/mips/include/asm/pgtable-64.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 0036ea0..93a9dce 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -265,6 +265,11 @@ static inline int pmd_bad(pmd_t pmd) static inline int pmd_present(pmd_t pmd) { +#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT + if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) + return pmd_val(pmd) & _PAGE_PRESENT; +#endif + return pmd_val(pmd) != (unsigned long) invalid_pte_table; } -- 2.7.0