[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250730014708.1516-3-daijunbing@vivo.com>
Date: Wed, 30 Jul 2025 09:47:03 +0800
From: Dai Junbing <daijunbing@...o.com>
To: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>,
Miklos Szeredi <miklos@...redi.hu>,
"Theodore Ts'o" <tytso@....edu>,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-ext4@...r.kernel.org
Cc: opensource.kernel@...o.com,
Dai Junbing <daijunbing@...o.com>
Subject: [PATCH v1 2/5] select/poll: Make sleep freezable
When processes sleep in TASK_INTERRUPTIBLE state during select(2)
or poll(2) system calls, add the TASK_FREEZABLE flag. This prevents
them from being prematurely awakened during system suspend/resume
operations, avoiding unnecessary wakeup overhead.
The functions do_select() and do_poll() are exclusively used within
their respective system call paths. During sleep in these paths, no
kernel locks are held. Therefore, adding TASK_FREEZABLE is safe.
Signed-off-by: Dai Junbing <daijunbing@...o.com>
---
fs/select.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/select.c b/fs/select.c
index 9fb650d03d52..8a1e9fe12650 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;
}
@@ -955,7 +955,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
Powered by blists - more mailing lists