The patch titled Subject: mm: ksm: remove unnecessary try_to_freeze() has been added to the -mm mm-unstable branch. Its filename is mm-ksm-remove-unnecessary-try_to_freeze.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-ksm-remove-unnecessary-try_to_freeze.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kevin Hao <haokexin@xxxxxxxxx> Subject: mm: ksm: remove unnecessary try_to_freeze() Date: Wed, 13 Dec 2023 17:09:06 +0800 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. Link: https://lkml.kernel.org/r/20231213090906.1070985-1-haokexin@xxxxxxxxx Signed-off-by: Kevin Hao <haokexin@xxxxxxxxx> Acked-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx> Cc: Pavel Machek <pavel@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/ksm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/mm/ksm.c~mm-ksm-remove-unnecessary-try_to_freeze +++ a/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 { _ Patches currently in -mm which might be from haokexin@xxxxxxxxx are mm-ksm-remove-unnecessary-try_to_freeze.patch fork-remove-redundant-task_uninterruptible.patch