mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin()
Currently, khugepaged does not permit swapin if there are enough young pages in a THP. The problem is when a THP does not have enough young pages, khugepaged leaks mapped ptes. This patch prohibits leaking mapped ptes. Link: http://lkml.kernel.org/r/1472820276-7831-1-git-send-email-ebru.akagunduz@gmail.com Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com> Suggested-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
c131f751ab
commit
982785c6b0
@ -882,6 +882,11 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm,
|
|||||||
.pmd = pmd,
|
.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);
|
fe.pte = pte_offset_map(pmd, address);
|
||||||
for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE;
|
for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE;
|
||||||
fe.pte++, fe.address += PAGE_SIZE) {
|
fe.pte++, fe.address += PAGE_SIZE) {
|
||||||
@ -889,11 +894,6 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm,
|
|||||||
if (!is_swap_pte(pteval))
|
if (!is_swap_pte(pteval))
|
||||||
continue;
|
continue;
|
||||||
swapped_in++;
|
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);
|
ret = do_swap_page(&fe, pteval);
|
||||||
|
|
||||||
/* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */
|
/* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user