Skip to contentSkip to conversation

mm: migration: deposit page table when copying a PMD migration entry.

PATCH Applied Zi Yan 2 participants 2 messages Oct 30, 2017

Subsystems (2)
lore
Share & tools
lore

Zi Yan

author
#0 lore raw

PATCH 1/1 mm: migration: deposit page table when copying a PMD migration entry.

From: Zi Yan <[email protected]>

We need to deposit pre-allocated PTE page table when a PMD migration entry is copied in copy_huge_pmd(). Otherwise, we will leak the pre-allocated page and cause a NULL pointer dereference later in zap_huge_pmd().

The missing counters during PMD migration entry copy process are added as well.

The bug report is here: https://lkml.org/lkml/2017/10/29/214

Fixes 84c3fc4e9c563 ("mm: thp: check pmd migration entry in common path")
Cc Kirill A. Shutemov <[email protected]>
---
 mm/huge_memory.c | 3 +++
 1 file changed, 3 insertions(+)
mm/huge_memory.c +3 -0
index 269b5df58543..1981ed697dab 100644
@@ -941,6 +941,9 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 				pmd = pmd_swp_mksoft_dirty(pmd);
 			set_pmd_at(src_mm, addr, src_pmd, pmd);
 		}
+		add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);
+		atomic_long_inc(&dst_mm->nr_ptes);
+		pgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable);
 		set_pmd_at(dst_mm, addr, dst_pmd, pmd);
 		ret = 0;
 		goto out_unlock;
Signature · 7 lines
2.14.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Zi Yan

From: Zi Yan <[email protected]>

We need to deposit pre-allocated PTE page table when a PMD migration entry is copied in copy_huge_pmd(). Otherwise, we will leak the pre-allocated page and cause a NULL pointer dereference later in zap_huge_pmd().

The missing counters during PMD migration entry copy process are added as well.

Quoted 6 lines

The bug report is here: https://lkml.org/lkml/2017/10/29/214

Fixes 84c3fc4e9c563 ("mm: thp: check pmd migration entry in common path")
Cc Kirill A. Shutemov <[email protected]>
Signature · 1 line
 Kirill A. Shutemov