summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2015-06-24 23:56:07 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-25 00:49:41 (GMT)
commitcd0924112119547b0d3fb13a9ed99717d924c2be (patch)
tree49a000c9132efe3fb88a9d31214511f6f38dae3b /mm
parentebb09738d32b840be8157d556f7756e6dbcc1735 (diff)
downloadlinux-cd0924112119547b0d3fb13a9ed99717d924c2be.tar.xz
thp: cleanup how khugepaged enters freezer
khugepaged_do_scan() checks in every iteration whether freezing(current) is true, and in such case breaks out of the loop, which causes try_to_freeze() to be called immediately afterwards in khugepaged_wait_work(). If nothing else, this causes unnecessary freezing(current) test, and also makes the way khugepaged enters freezer a bit less obvious than necessary. Let's just try to freeze directly, instead of splitting it into two (directly adjacent) phases. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Cc: Mel Gorman <mgorman@suse.de> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/huge_memory.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 078832c..b3d8cd8 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2799,7 +2799,7 @@ static void khugepaged_do_scan(void)
cond_resched();
- if (unlikely(kthread_should_stop() || freezing(current)))
+ if (unlikely(kthread_should_stop() || try_to_freeze()))
break;
spin_lock(&khugepaged_mm_lock);
@@ -2820,8 +2820,6 @@ static void khugepaged_do_scan(void)
static void khugepaged_wait_work(void)
{
- try_to_freeze();
-
if (khugepaged_has_work()) {
if (!khugepaged_scan_sleep_millisecs)
return;