Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 29 Sep 2016 09:32:39 +0200 (CEST) Received: from smtpbguseast2.qq.com ([54.204.34.130]:41744 "EHLO smtpbguseast2.qq.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23990778AbcI2HcbZos9H (ORCPT ); Thu, 29 Sep 2016 09:32:31 +0200 X-QQ-mid: bizesmtp7t1475134338tljmr0xng Received: from software.domain.org (unknown [222.92.8.142]) by esmtp4.qq.com (ESMTP) with id ; Thu, 29 Sep 2016 15:32:04 +0800 (CST) X-QQ-SSF: 01100000002000F0FJ72B00A0000000 X-QQ-FEAT: 3jlOKZxptE6Kmm7n2hPddR6mwxuk60+f7jS6h39RKS/7e1zVIdnZn/0kpOZ36 3kUWjxmhWHItFo8tXkq5ekfPPsopOLcxOAJenux+h+k+ME5/+i/gpf2iIDoLwt6Hljz4LZ6 V++/r1ZjrGjOu+VwOpNjGpTJ06EpIQe9sFZkQI5K8yX5LZCyE3G+wu6StvhF3L5x/EML4lq sr+guCwcVP8112W2s4IO/DetBF8noT7mL0SEGOgQJt7xp7TZZUL6Bl3nvhyydYeh9RnX99k 3UEw8HhBUoczaAom0UxNFnJjg= X-QQ-GoodBg: 0 From: Huacai Chen To: Ralf Baechle Cc: Manuel Lauss , "Steven J . Hill" , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen , stable@vger.kernel.org Subject: [PATCH] MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() Date: Thu, 29 Sep 2016 15:31:54 +0800 Message-Id: <1475134314-32604-1-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 55289 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: chenhc@lemote.com Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips 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