Return-Path: Received: from smtpbgau1.qq.com ([54.206.16.166]:42100 "EHLO smtpbgau1.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbdAUAzy (ORCPT ); Fri, 20 Jan 2017 19:55:54 -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 RESEND 4/4] MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() Date: Sat, 21 Jan 2017 08:56:06 +0800 Message-Id: <1484960166-30022-4-git-send-email-chenhc@lemote.com> In-Reply-To: <1484960166-30022-1-git-send-email-chenhc@lemote.com> References: <1484960166-30022-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