diff options
author | Kevin Hao <haokexin@gmail.com> | 2023-12-20 07:17:53 +0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-12-29 11:58:42 -0800 |
commit | b39ca208403c8f2c17dab1fbfef1f5ecaff25e53 (patch) | |
tree | 41279172770249bdb291cfa0f7e87e3481831c20 /mm/khugepaged.c | |
parent | 91349f541e7daa6cce15e01e7ffe4fd63731ead9 (diff) | |
download | linux-b39ca208403c8f2c17dab1fbfef1f5ecaff25e53.tar.gz linux-b39ca208403c8f2c17dab1fbfef1f5ecaff25e53.tar.bz2 linux-b39ca208403c8f2c17dab1fbfef1f5ecaff25e53.zip |
mm/khugepaged: remove redundant try_to_freeze()
A freezable kernel thread can enter frozen state during freezing by either
calling try_to_freeze() or using wait_event_freezable() and its variants.
However, there is no need to use both methods simultaneously. The
freezable wait variants have been used in khugepaged_wait_work() and
khugepaged_alloc_sleep(), so remove this redundant try_to_freeze().
I used the following stress-ng command to generate some memory load on my
Intel Alder Lake board (24 CPUs, 32G memory).
stress-ng --vm 48 --vm-bytes 90%
The worst freezing latency is:
Freezing user space processes
Freezing user space processes completed (elapsed 0.040 seconds)
OOM killer disabled.
Freezing remaining freezable tasks
Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
Without the faked memory load, the freezing latency is:
Freezing user space processes
Freezing user space processes completed (elapsed 0.000 seconds)
OOM killer disabled.
Freezing remaining freezable tasks
Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
I didn't see any observable difference whether this patch is applied or not.
Link: https://lkml.kernel.org/r/20231219231753.683171-1-haokexin@gmail.com
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/khugepaged.c')
-rw-r--r-- | mm/khugepaged.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 1002e9156388..9cdea59fb4c0 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2499,7 +2499,7 @@ static void khugepaged_do_scan(struct collapse_control *cc) while (true) { cond_resched(); - if (unlikely(kthread_should_stop() || try_to_freeze())) + if (unlikely(kthread_should_stop())) break; spin_lock(&khugepaged_mm_lock); |