* [PATCH] mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin()
@ 2016-09-02 12:44 Ebru Akagunduz
2016-09-02 13:52 ` Rik van Riel
2016-09-07 12:41 ` Andrea Arcangeli
0 siblings, 2 replies; 3+ messages in thread
From: Ebru Akagunduz @ 2016-09-02 12:44 UTC (permalink / raw)
To: linux-mm
Cc: riel, aarcange, akpm, vbabka, mgorman, kirill.shutemov, hannes,
linux-kernel, 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 <ebru.akagunduz@gmail.com>
Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
---
mm/khugepaged.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 79c52d0..f401e9d 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -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 */
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin()
2016-09-02 12:44 [PATCH] mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin() Ebru Akagunduz
@ 2016-09-02 13:52 ` Rik van Riel
2016-09-07 12:41 ` Andrea Arcangeli
1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2016-09-02 13:52 UTC (permalink / raw)
To: Ebru Akagunduz, linux-mm
Cc: aarcange, akpm, vbabka, mgorman, kirill.shutemov, hannes,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
On Fri, 2016-09-02 at 15:44 +0300, Ebru Akagunduz wrote:
> 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 <ebru.akagunduz@gmail.com>
> Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
>
Reviewed-by: Rik van Riel <riel@redhat.com>
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin()
2016-09-02 12:44 [PATCH] mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin() Ebru Akagunduz
2016-09-02 13:52 ` Rik van Riel
@ 2016-09-07 12:41 ` Andrea Arcangeli
1 sibling, 0 replies; 3+ messages in thread
From: Andrea Arcangeli @ 2016-09-07 12:41 UTC (permalink / raw)
To: Ebru Akagunduz
Cc: linux-mm, riel, akpm, vbabka, mgorman, kirill.shutemov, hannes,
linux-kernel
On Fri, Sep 02, 2016 at 03:44:36PM +0300, Ebru Akagunduz wrote:
> 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 <ebru.akagunduz@gmail.com>
> Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
> ---
> mm/khugepaged.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-07 12:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-02 12:44 [PATCH] mm, thp: fix leaking mapped pte in __collapse_huge_page_swapin() Ebru Akagunduz
2016-09-02 13:52 ` Rik van Riel
2016-09-07 12:41 ` Andrea Arcangeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).