Patch "epoll: Add synchronous wakeup support for ep_poll_callback" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    epoll: Add synchronous wakeup support for ep_poll_callback

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     epoll-add-synchronous-wakeup-support-for-ep_poll_cal.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f8a05f73700a36801f76c3deaede7dcf06f537c5
Author: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
Date:   Thu Dec 26 19:14:29 2024 +0800

    epoll: Add synchronous wakeup support for ep_poll_callback
    
    [ Upstream commit 900bbaae67e980945dec74d36f8afe0de7556d5a ]
    
    Now, the epoll only use wake_up() interface to wake up task.
    However, sometimes, there are epoll users which want to use
    the synchronous wakeup flag to hint the scheduler, such as
    Android binder driver.
    So add a wake_up_sync() define, and use the wake_up_sync()
    when the sync is true in ep_poll_callback().
    
    Co-developed-by: Jing Xia <jing.xia@xxxxxxxxxx>
    Signed-off-by: Jing Xia <jing.xia@xxxxxxxxxx>
    Signed-off-by: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240426080548.8203-1-xuewen.yan@xxxxxxxxxx
    Tested-by: Brian Geffon <bgeffon@xxxxxxxxxx>
    Reviewed-by: Brian Geffon <bgeffon@xxxxxxxxxx>
    Reported-by: Benoit Lize <lizeb@xxxxxxxxxx>
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    [ Redefine wake_up_sync(x) as __wake_up_sync(x, TASK_NORMAL, 1) to
      make it work on 5.4.y ]
    Signed-off-by: Wenshan Lan <jetlan9@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 8c0e94183186..569bfff280e4 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1273,7 +1273,10 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
 				break;
 			}
 		}
-		wake_up(&ep->wq);
+		if (sync)
+			wake_up_sync(&ep->wq);
+		else
+			wake_up(&ep->wq);
 	}
 	if (waitqueue_active(&ep->poll_wait))
 		pwake++;
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 03bff85e365f..5b65f720261a 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -213,6 +213,7 @@ void __wake_up_pollfree(struct wait_queue_head *wq_head);
 #define wake_up_all(x)			__wake_up(x, TASK_NORMAL, 0, NULL)
 #define wake_up_locked(x)		__wake_up_locked((x), TASK_NORMAL, 1)
 #define wake_up_all_locked(x)		__wake_up_locked((x), TASK_NORMAL, 0)
+#define wake_up_sync(x)			__wake_up_sync(x, TASK_NORMAL, 1)
 
 #define wake_up_interruptible(x)	__wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
 #define wake_up_interruptible_nr(x, nr)	__wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux