Commit b1caa957 authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Linus Torvalds

khugepaged: ignore pmd tables with THP mapped with ptes

Prepare khugepaged to see compound pages mapped with pte.  For now we
won't collapse the pmd table with such pte.

khugepaged is subject for future rework wrt new refcounting.
Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7479df6d
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
EM( SCAN_PAGE_LRU, "page_not_in_lru") \ EM( SCAN_PAGE_LRU, "page_not_in_lru") \
EM( SCAN_PAGE_LOCK, "page_locked") \ EM( SCAN_PAGE_LOCK, "page_locked") \
EM( SCAN_PAGE_ANON, "page_not_anon") \ EM( SCAN_PAGE_ANON, "page_not_anon") \
EM( SCAN_PAGE_COMPOUND, "page_compound") \
EM( SCAN_ANY_PROCESS, "no_process_for_page") \ EM( SCAN_ANY_PROCESS, "no_process_for_page") \
EM( SCAN_VMA_NULL, "vma_null") \ EM( SCAN_VMA_NULL, "vma_null") \
EM( SCAN_VMA_CHECK, "vma_check_failed") \ EM( SCAN_VMA_CHECK, "vma_check_failed") \
......
...@@ -45,6 +45,7 @@ enum scan_result { ...@@ -45,6 +45,7 @@ enum scan_result {
SCAN_PAGE_LRU, SCAN_PAGE_LRU,
SCAN_PAGE_LOCK, SCAN_PAGE_LOCK,
SCAN_PAGE_ANON, SCAN_PAGE_ANON,
SCAN_PAGE_COMPOUND,
SCAN_ANY_PROCESS, SCAN_ANY_PROCESS,
SCAN_VMA_NULL, SCAN_VMA_NULL,
SCAN_VMA_CHECK, SCAN_VMA_CHECK,
...@@ -2770,6 +2771,13 @@ static int khugepaged_scan_pmd(struct mm_struct *mm, ...@@ -2770,6 +2771,13 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
result = SCAN_PAGE_NULL; result = SCAN_PAGE_NULL;
goto out_unmap; goto out_unmap;
} }
/* TODO: teach khugepaged to collapse THP mapped with pte */
if (PageCompound(page)) {
result = SCAN_PAGE_COMPOUND;
goto out_unmap;
}
/* /*
* Record which node the original page is from and save this * Record which node the original page is from and save this
* information to khugepaged_node_load[]. * information to khugepaged_node_load[].
...@@ -2782,7 +2790,6 @@ static int khugepaged_scan_pmd(struct mm_struct *mm, ...@@ -2782,7 +2790,6 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
goto out_unmap; goto out_unmap;
} }
khugepaged_node_load[node]++; khugepaged_node_load[node]++;
VM_BUG_ON_PAGE(PageCompound(page), page);
if (!PageLRU(page)) { if (!PageLRU(page)) {
result = SCAN_SCAN_ABORT; result = SCAN_SCAN_ABORT;
goto out_unmap; goto out_unmap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment