mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin()
Subsystems (2)
PATCH 1/1 mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin()
Currently, khugepaged does not let swapin, if there is no enough young pages in a THP. The problem is when a THP does not have enough young page, khugepaged leaks mapped ptes.
This patch prohibits leaking mapped ptes.
Signed-off-by Ebru Akagunduz <[email protected]>
Suggested-by Andrea Arcangeli <[email protected]>
--- mm/khugepaged.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
mm/khugepaged.c +5 -5
@@ -881,6 +881,11 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, .pmd = pmd, }; +/* we only decide to swapin, if there is enough young ptes */ +if (referenced <HPAGE_PMD_NR /2 ) { +trace_mm_collapse_huge_page_swapin (mm, swapped_in, referenced,0 ); +return false; + } fe.pte =pte_offset_map (pmd, address);for (; fe.address < address +HPAGE_PMD_NR *PAGE_SIZE ; fe.pte++, fe.address +=PAGE_SIZE ) {
@@ -888,11 +893,6 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm,if (!is_swap_pte (pteval))continue ; swapped_in++; -/* we only decide to swapin, if there is enough young ptes */ -if (referenced <HPAGE_PMD_NR /2 ) { -trace_mm_collapse_huge_page_swapin (mm, swapped_in, referenced,0 ); -return false; - } ret =do_swap_page (&fe, pteval);/* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */
Signature · 7 lines
1.9.1 -- 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>
Quoted 9 lines · Ebru Akagunduz
Currently, khugepaged does not let swapin, if there is no enough young pages in a THP. The problem is when a THP does not have enough young page, khugepaged leaks mapped ptes.
This patch prohibits leaking mapped ptes.
Signed-off-by Ebru Akagunduz <[email protected]>Suggested-by Andrea Arcangeli <[email protected]>
Reviewed-by Rik van Riel <[email protected]>
Signature · 1 line
All Rights Reversed.
Quoted 11 lines · Ebru Akagunduz
Currently, khugepaged does not let swapin, if there is no enough young pages in a THP. The problem is when a THP does not have enough young page, khugepaged leaks mapped ptes.
This patch prohibits leaking mapped ptes.
Signed-off-by Ebru Akagunduz <[email protected]>Suggested-by Andrea Arcangeli <[email protected]>--- mm/khugepaged.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by Andrea Arcangeli <[email protected]>