diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2021-03-16 14:57:59 +0100 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2021-04-06 19:26:11 +0200 |
commit | 01b00a8fd6f9b39687111d4a7ff5471974bed515 (patch) | |
tree | 8d63c5e2d889e941f5e43b97a6355709dfaede57 | |
parent | 52c5e9d693649de3431624f035cdffaf3083ee1c (diff) | |
download | linux-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.c | 5 |
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 { |