]> Pileus Git - ~andy/linux/blobdiff - arch/x86/include/asm/pgtable.h
thp: add pmd_modify
[~andy/linux] / arch / x86 / include / asm / pgtable.h
index 001a3831567a2624df6adcfb0fe83b7b56963e82..c48ba055f69337ac15d1b14ddc2a040f674728cc 100644 (file)
@@ -325,6 +325,16 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
        return __pte(val);
 }
 
+static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
+{
+       pmdval_t val = pmd_val(pmd);
+
+       val &= _HPAGE_CHG_MASK;
+       val |= massage_pgprot(newprot) & ~_HPAGE_CHG_MASK;
+
+       return __pmd(val);
+}
+
 /* mprotect needs to preserve PAT bits when updating vm_page_prot */
 #define pgprot_modify pgprot_modify
 static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)