diff mbox series

[2/3] powerpc: mpc83xx: Use wait_event_freezable() for freezable kthread

Message ID 20231221044510.1802429-3-haokexin@gmail.com (mailing list archive)
State Accepted
Commit 11611d254c15cce1f58431b2965c6edb5aa7e610
Headers show
Series powerpc: Fixes and optimization for the freezable kthread | expand

Commit Message

Kevin Hao Dec. 21, 2023, 4:45 a.m. UTC
A freezable kernel thread can enter frozen state during freezing by
either calling try_to_freeze() or using wait_event_freezable() and its
variants. So for the following snippet of code in a kernel thread loop:
  wait_event_interruptible();
  try_to_freeze();

We can change it to a simple wait_event_freezable() and then eliminate
a function call.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 arch/powerpc/platforms/83xx/suspend.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index eed325ed08cc..c9664e46b03d 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -264,8 +264,7 @@  static int agent_thread_fn(void *data)
 	set_freezable();
 
 	while (1) {
-		wait_event_interruptible(agent_wq, pci_pm_state >= 2);
-		try_to_freeze();
+		wait_event_freezable(agent_wq, pci_pm_state >= 2);
 
 		if (signal_pending(current) || pci_pm_state < 2)
 			continue;