Linux NILFS development
 help / color / mirror / Atom feed
* [PATCH] nilfs2: Add missing set_freezable() for freezable kthread
@ 2023-12-19  9:09 Ryusuke Konishi
  0 siblings, 0 replies; 3+ messages in thread
From: Ryusuke Konishi @ 2023-12-19  9:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-nilfs, linux-kernel

From: Kevin Hao <haokexin@gmail.com>

The kernel thread function nilfs_segctor_thread() invokes
the try_to_freeze() in its loop. But all the kernel threads are
non-freezable by default. So if we want to make a kernel thread to be
freezable, we have to invoke set_freezable() explicitly.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
Andrew, please add this to the queue for the next merge window (if
it's still ok).  This fixes an issue where the log writer thread was
not calling try_to_freeze() as intended when starting suspend or
hibernation.

I haven't run into any problems with or without this change in various
suspend/hibernation tests so far, so I haven't added a Cc tag to the
stable team.

If any suspend failures are reported due to the lack of this setup,
I will separately request the stable team to backport this.

Thanks,
Ryusuke Konishi

fs/nilfs2/segment.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 52995838f2de..2590a0860eab 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2588,6 +2588,7 @@ static int nilfs_segctor_thread(void *arg)
 		   "segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds",
 		   sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ);
 
+	set_freezable();
 	spin_lock(&sci->sc_state_lock);
  loop:
 	for (;;) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] nilfs2: Add missing set_freezable() for freezable kthread
@ 2023-12-17 13:50 Kevin Hao
  2023-12-17 15:49 ` Ryusuke Konishi
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hao @ 2023-12-17 13:50 UTC (permalink / raw)
  To: Ryusuke Konishi; +Cc: linux-nilfs, Rafael J. Wysocki, Pavel Machek

The kernel thread function nilfs_segctor_thread() invokes
the try_to_freeze() in its loop. But all the kernel threads are
non-freezable by default. So if we want to make a kernel thread to be
freezable, we have to invoke set_freezable() explicitly.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 fs/nilfs2/segment.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 52995838f2de..2590a0860eab 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2588,6 +2588,7 @@ static int nilfs_segctor_thread(void *arg)
 		   "segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds",
 		   sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ);
 
+	set_freezable();
 	spin_lock(&sci->sc_state_lock);
  loop:
 	for (;;) {
-- 
2.39.2


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

end of thread, other threads:[~2023-12-19  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19  9:09 [PATCH] nilfs2: Add missing set_freezable() for freezable kthread Ryusuke Konishi
  -- strict thread matches above, loose matches on Subject: below --
2023-12-17 13:50 Kevin Hao
2023-12-17 15:49 ` Ryusuke Konishi

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