Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hao <haokexin@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>
Subject: [PATCH] mm/khugepaged: Remove unnecessary try_to_freeze()
Date: Sat, 16 Dec 2023 19:43:41 +0800	[thread overview]
Message-ID: <20231216114341.2281852-1-haokexin@gmail.com> (raw)

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 unnecessary
try_to_freeze().

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.39.2



             reply	other threads:[~2023-12-16 11:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 11:43 Kevin Hao [this message]
2023-12-18 18:34 ` [PATCH] mm/khugepaged: Remove unnecessary try_to_freeze() Andrew Morton
2023-12-19  0:44   ` Kevin Hao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231216114341.2281852-1-haokexin@gmail.com \
    --to=haokexin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox