summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2021-03-16 14:57:59 +0100
committerMarek Szyprowski <m.szyprowski@samsung.com>2021-04-06 19:26:11 +0200
commit01b00a8fd6f9b39687111d4a7ff5471974bed515 (patch)
tree8d63c5e2d889e941f5e43b97a6355709dfaede57
parent52c5e9d693649de3431624f035cdffaf3083ee1c (diff)
downloadlinux-rpi-01b00a8fd6f9b39687111d4a7ff5471974bed515.tar.gz
linux-rpi-01b00a8fd6f9b39687111d4a7ff5471974bed515.tar.bz2
linux-rpi-01b00a8fd6f9b39687111d4a7ff5471974bed515.zip
thp: don't leak 2M huge page in each scan try
this is still not perfect, because 64k huge page will be leaked in any case of failure. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r--mm/khugepaged.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 2a8a491d91ab..66e585988559 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2357,7 +2357,10 @@ xa_unlocked:
#else
retract_page_tables(mapping, start);
#endif
- *hpage = NULL;
+
+ /* consume preallocated huge page */
+ if (hpage_type == THP_ADV_LV2)
+ *hpage = NULL;
khugepaged_pages_collapsed++;
} else {