[PATCH 2/7] mm: Move pt_mm within struct page
From: Matthew Wilcox
Date: Tue Apr 28 2020 - 15:45:14 EST
From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
Instead of a per-arch word within struct page, use a formerly reserved
word. This word is shared with page->mapping, so it must be cleared
before being freed as it is checked in free_pages().
Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
arch/x86/mm/pgtable.c | 1 +
include/linux/mm_types.h | 7 ++-----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 7bd2c3a52297..f5f46737aea0 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -95,6 +95,7 @@ static inline void pgd_list_del(pgd_t *pgd)
struct page *page = virt_to_page(pgd);
list_del(&page->lru);
+ page->pt_mm = NULL;
}
#define UNSHARED_PTRS_PER_PGD \
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 9bb34e2cd5a5..7efa12f4626f 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -149,11 +149,8 @@ struct page {
pgtable_t pmd_huge_pte;
};
};
- unsigned long _pt_pad_2; /* mapping */
- union {
- struct mm_struct *pt_mm; /* x86 pgds only */
- atomic_t pt_frag_refcount; /* powerpc */
- };
+ struct mm_struct *pt_mm;
+ atomic_t pt_frag_refcount; /* powerpc */
#if ALLOC_SPLIT_PTLOCKS
spinlock_t *ptl;
#else
--
2.26.2