linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: ksm: Remove unnecessary try_to_freeze()
@ 2023-12-13  9:09 Kevin Hao
  2023-12-13 11:17 ` Rafael J. Wysocki
  2023-12-13 11:37 ` David Hildenbrand
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Hao @ 2023-12-13  9:09 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrea Arcangeli, Andrew Morton, Rafael J. Wysocki, Pavel Machek

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.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>
---
 mm/ksm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index 16532fa85a46..e2ce850c2739 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2604,11 +2604,9 @@ static int ksm_scan_thread(void *nothing)
 			ksm_do_scan(ksm_thread_pages_to_scan);
 		mutex_unlock(&ksm_thread_mutex);
 
-		try_to_freeze();
-
 		if (ksmd_should_run()) {
 			sleep_ms = READ_ONCE(ksm_thread_sleep_millisecs);
-			wait_event_interruptible_timeout(ksm_iter_wait,
+			wait_event_freezable_timeout(ksm_iter_wait,
 				sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs),
 				msecs_to_jiffies(sleep_ms));
 		} else {
-- 
2.39.2



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-13 11:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13  9:09 [PATCH] mm: ksm: Remove unnecessary try_to_freeze() Kevin Hao
2023-12-13 11:17 ` Rafael J. Wysocki
2023-12-13 11:28   ` David Hildenbrand
2023-12-13 11:35     ` Kevin Hao
2023-12-13 11:37 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox