[PATCH] mm: restore user defined min_free_kbytes when disabling thp

From: Han Pingtian
Date: Tue Jan 21 2014 - 04:24:43 EST


thp increases the value of min_free_kbytes in initialization. This will
change the user defined value of min_free_kbytes sometimes. So try to
restore the value when disabling thp if the value has been changed in
thp initialization and isn't changed by user afte that.

Signed-off-by: Han Pingtian <hanpt@xxxxxxxxxxxxxxxxxx>
---
mm/huge_memory.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 94a824f..fcb8ce58 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -164,6 +164,16 @@ static int start_khugepaged(void)
} else if (khugepaged_thread) {
kthread_stop(khugepaged_thread);
khugepaged_thread = NULL;
+
+ if (user_min_free_kbytes >= 0 &&
+ user_min_free_kbytes != min_free_kbytes) {
+ pr_info("restore min_free_kbytes from %d to user "
+ "defined %d when stopping khugepaged\n",
+ min_free_kbytes, user_min_free_kbytes);
+
+ min_free_kbytes = user_min_free_kbytes;
+ setup_per_zone_wmarks();
+ }
}

return err;
--
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/