When a process sleeps during read on pipes or open on FIFOs, add the TASK_FREEZABLE flag. This prevents premature wakeups during system suspend/resume operations, avoiding unnecessary wakeup overhead. In both the pipe read and FIFO open paths, no kernel locks are held during sleep. Therefore, adding TASK_FREEZABLE is safe. Signed-off-by: Dai Junbing --- fs/pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index 45077c37bad1..b49e382c59ba 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -385,7 +385,7 @@ anon_pipe_read(struct kiocb *iocb, struct iov_iter *to) * since we've done any required wakeups and there's no need * to mark anything accessed. And we've dropped the lock. */ - if (wait_event_interruptible_exclusive(pipe->rd_wait, pipe_readable(pipe)) < 0) + if (wait_event_freezable_exclusive(pipe->rd_wait, pipe_readable(pipe)) < 0) return -ERESTARTSYS; wake_next_reader = true; @@ -1098,7 +1098,7 @@ static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt) int cur = *cnt; while (cur == *cnt) { - prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE); + prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE | TASK_FREEZABLE); pipe_unlock(pipe); schedule(); finish_wait(&pipe->rd_wait, &rdwait); -- 2.25.1