[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250730014708.1516-2-daijunbing@vivo.com>
Date: Wed, 30 Jul 2025 09:47:02 +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 1/5] epoll: Make epoll_wait sleep freezable
When a user process enters TASK_INTERRUPTIBLE using the epoll_wait(2)
system call and its variants, add the TASK_FREEZABLE flag to prevent the
process from being prematurely awakened during suspend/resume, thus
avoiding unnecessary wakeups and overhead.
ep_poll is only used within the paths of epoll_wait-related system
calls.
In this path, after the process enters sleep, no kernel locks are held.
Therefore, adding TASK_FREEZABLE is safe.
Signed-off-by: Dai Junbing <daijunbing@...o.com>
---
fs/eventpoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0fbf5dfedb24..d52bd9838ef5 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -2094,7 +2094,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
* the same lock on wakeup ep_poll_callback() side, so it
* is safe to avoid an explicit barrier.
*/
- __set_current_state(TASK_INTERRUPTIBLE);
+ __set_current_state(TASK_INTERRUPTIBLE | TASK_FREEZABLE);
/*
* Do the final check under the lock. ep_start/done_scan()
--
2.25.1
Powered by blists - more mailing lists