From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx159.postini.com [74.125.245.159]) by kanga.kvack.org (Postfix) with SMTP id 2D2166B0071 for ; Fri, 28 Sep 2012 19:36:58 -0400 (EDT) From: "Kirill A. Shutemov" Subject: [PATCH 3/3] x86: implement HAVE_PMD_SPECAIL Date: Sat, 29 Sep 2012 02:37:21 +0300 Message-Id: <1348875441-19561-4-git-send-email-kirill.shutemov@linux.intel.com> In-Reply-To: <1348875441-19561-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1348875441-19561-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton , Andrea Arcangeli , linux-mm@kvack.org, "H. Peter Anvin" Cc: Andi Kleen , linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Arnd Bergmann , Ingo Molnar , linux-arch@vger.kernel.org, "Kirill A. Shutemov" From: "Kirill A. Shutemov" We can use the same bit as for special PTE. There's no conflict with _PAGE_SPLITTING since it's only defined for PSE pmd, but special PMD is only valid for non-PSE. Signed-off-by: Kirill A. Shutemov --- arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 50a1d1f..b2146c3 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -97,6 +97,7 @@ config X86 select KTIME_SCALAR if X86_32 select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER + select HAVE_PMD_SPECIAL config INSTRUCTION_DECODER def_bool (KPROBES || PERF_EVENTS || UPROBES) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 49afb3f..ff61694 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -167,6 +167,12 @@ static inline int has_transparent_hugepage(void) } #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +static inline int pmd_special(pmd_t pmd) +{ + return !pmd_trans_huge(pmd) && + pmd_flags(pmd) & _PAGE_SPECIAL; +} + static inline pte_t pte_set_flags(pte_t pte, pteval_t set) { pteval_t v = native_pte_val(pte); @@ -290,6 +296,11 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd) return pmd_clear_flags(pmd, _PAGE_PRESENT); } +static inline pmd_t pmd_mkspecial(pmd_t pmd) +{ + return pmd_set_flags(pmd, _PAGE_SPECIAL); +} + /* * Mask out unsupported bits in a present pgprot. Non-present pgprots * can use those bits for other purposes, so leave them be. @@ -474,7 +485,8 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address) static inline int pmd_bad(pmd_t pmd) { - return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE; + pmdval_t flags = pmd_flags(pmd); + return (flags & ~(_PAGE_USER | _PAGE_SPECIAL)) != _KERNPG_TABLE; } static inline unsigned long pages_to_mb(unsigned long npg) -- 1.7.7.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org