[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5pqwouyalbjgggcxxnu6yah6jzurmksk7jnepk3x22qtospo4j@6rky4lp4d7tk>
Date: Wed, 30 Jul 2025 14:46:18 +0200
From: Jan Kara <jack@...e.cz>
To: Dai Junbing <daijunbing@...o.com>
Cc: 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, opensource.kernel@...o.com
Subject: Re: [PATCH v1 2/5] select/poll: Make sleep freezable
On Wed 30-07-25 09:47:03, Dai Junbing wrote:
> 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>
This looks sensible to me. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> 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
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists