Return-Path: Received: from smtpbg202.qq.com ([184.105.206.29]:38684 "EHLO smtpbg202.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbdCKFTj (ORCPT ); Sat, 11 Mar 2017 00:19:39 -0500 From: Huacai Chen To: Ralf Baechle Cc: John Crispin , "Steven J . Hill" , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen , stable@vger.kernel.org Subject: [PATCH V2 7/7] MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() Date: Sat, 11 Mar 2017 13:19:58 +0800 Message-Id: <1489209598-30312-7-git-send-email-chenhc@lemote.com> In-Reply-To: <1489209598-30312-1-git-send-email-chenhc@lemote.com> References: <1489209598-30312-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: stable@vger.kernel.org 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 514cbc0..ef6f007 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -193,6 +193,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