Skip to content

Commit 67f8746

Browse files
Mel Gormantorvalds
authored andcommitted
mm: clear pmd_numa before invalidating
On x86, PMD entries are similar to _PAGE_PROTNONE protection and are handled as NUMA hinting faults. The following two page table protection bits are what defines them _PAGE_NUMA:set _PAGE_PRESENT:clear A PMD is considered present if any of the _PAGE_PRESENT, _PAGE_PROTNONE, _PAGE_PSE or _PAGE_NUMA bits are set. If pmdp_invalidate encounters a pmd_numa, it clears the present bit leaving _PAGE_NUMA which will be considered not present by the CPU but present by pmd_present. The existing caller of pmdp_invalidate should handle it but it's an inconsistent state for a PMD. This patch keeps the state consistent when calling pmdp_invalidate. Signed-off-by: Mel Gorman <mgorman@suse.de> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Alex Thorlton <athorlton@sgi.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f714f4f commit 67f8746

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎mm/pgtable-generic.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
191191
void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
192192
pmd_t *pmdp)
193193
{
194+
pmd_t entry = *pmdp;
195+
if (pmd_numa(entry))
196+
entry = pmd_mknonnuma(entry);
194197
set_pmd_at(vma->vm_mm, address, pmdp, pmd_mknotpresent(*pmdp));
195198
flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
196199
}

0 commit comments

Comments
 (0)