[PATCH 4/4] select: make select() and poll() waits freezable
From: Dai Junbing
Date: Wed May 27 2026 - 02:52:48 EST
Tasks blocked in select() or poll() may be woken during suspend and
resume due to freezer state transitions. This can cause avoidable
activity in the suspend/resume path and add unnecessary overhead.
Mark the waits in do_select() and do_poll() as freezable so these tasks
are not unnecessarily woken by the freezer.
Both functions are only used from their respective system call paths,
where the task sleeps without holding locks that would make freezing
unsafe.
Signed-off-by: Dai Junbing <daijunbing@xxxxxxxx>
---
fs/select.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/select.c b/fs/select.c
index bf71c9838dfe..b0b279748355 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -600,7 +600,7 @@ static noinline_for_stack int do_select(int n, fd_set_bits *fds, struct timespec
to = &expire;
}
- if (!poll_schedule_timeout(&table, TASK_INTERRUPTIBLE,
+ if (!poll_schedule_timeout(&table, TASK_INTERRUPTIBLE|TASK_FREEZABLE,
to, slack))
timed_out = 1;
}
@@ -962,7 +962,7 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait,
to = &expire;
}
- if (!poll_schedule_timeout(wait, TASK_INTERRUPTIBLE, to, slack))
+ if (!poll_schedule_timeout(wait, TASK_INTERRUPTIBLE|TASK_FREEZABLE, to, slack))
timed_out = 1;
}
return count;
--
2.25.1