Skip to contentSkip to conversation

FAILED: patch "[PATCH] epoll: Add synchronous wakeup support for ep_poll_callback" failed to apply to 5.4-stable tree

PATCH Superseded [email protected] 3 participants 6 messages Dec 23, 2024 – Dec 26, 2024

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x 900bbaae67e980945dec74d36f8afe0de7556d5a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024122326-viscous-dreaded-d15d@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 900bbaae67e980945dec74d36f8afe0de7556d5a Mon Sep 17 00:00:00 2001
From: Xuewen Yan <[email protected]>
Date: Fri, 26 Apr 2024 16:05:48 +0800
Subject: [PATCH] epoll: Add synchronous wakeup support for ep_poll_callback

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().

fs/eventpoll.c +4 -1
index 90fbab6b6f03..1a06e462b6ef 100644
@@ -1373,7 +1373,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++;
include/linux/wait.h +1 -0
index 8aa3372f21a0..2b322a9b88a2 100644
@@ -221,6 +221,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)
 
 #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)
#1 lore raw

PATCH 1/1 epoll: Add synchronous wakeup support for ep_poll_callback

From: Xuewen Yan <[email protected]>

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().

[ Redefine wake_up_sync(x) as __wake_up_sync(x, TASK_NORMAL, 1) to
make it work on 5.4.y ]

---
 fs/eventpoll.c       | 5 ++++-
 include/linux/wait.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
fs/eventpoll.c +4 -1
index 8c0e94183186..569bfff280e4 100644
@@ -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++;
include/linux/wait.h +1 -0
index 03bff85e365f..5b65f720261a 100644
@@ -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)
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 5.4.y] epoll: Add synchronous wakeup support for ep_poll_callback

Quoted 58 lines · Wenshan Lan

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

From: Xuewen Yan <[email protected]>

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().

[ Redefine wake_up_sync(x) as __wake_up_sync(x, TASK_NORMAL, 1) to
make it work on 5.4.y ]

---
  fs/eventpoll.c       | 5 ++++-
  include/linux/wait.h | 1 +
  2 files changed, 5 insertions(+), 1 deletion(-)
fs/eventpoll.c +4 -1
index 8c0e94183186..569bfff280e4 100644
@@ -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++;
include/linux/wait.h +1 -1
index 03bff85e365f..5b65f720261a 100644
@@ -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)
--
Quoted 1 line

2.43.0

Please ignore this patch for I forgot to CC the related persons. Thanks.

B.R.

Wenshan

Quoted 1 line
maintainer Reviewed-by Brian Geffon on v1 1/1
#3 lore raw

Re: [PATCH 5.4.y] epoll: Add synchronous wakeup support for ep_poll_callback

In reply to Wenshan Lan

[ Sasha's backport helper bot ]

Hi,

Found matching upstream commit: 900bbaae67e980945dec74d36f8afe0de7556d5a

WARNING: Author mismatch between patch and found commit:
Backport author: Wenshan Lan <[email protected]> Commit author: Xuewen Yan <[email protected]>

Status in newer kernel trees:
6.12.y | Not found
6.6.y | Not found
6.1.y | Not found
5.15.y | Not found
5.10.y | Not found
5.4.y | Not found

Note: The patch differs from the upstream commit:
---
1: 900bbaae67e9 ! 1: 90c173fa699e epoll: Add synchronous wakeup support for ep_poll_callback
@@ Commit message

+ (cherry picked from commit 900bbaae67e980945dec74d36f8afe0de7556d5a)
+ [ 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 <[email protected]>

## fs/eventpoll.c ##
@@ fs/eventpoll.c: static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
@@ include/linux/wait.h: 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)
++#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)
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.4.y        |  Success    |  Success   |
#4 lore raw

PATCH v2 1/1 epoll: Add synchronous wakeup support for ep_poll_callback

In reply to [email protected]

From: Xuewen Yan <[email protected]>

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().

[ Redefine wake_up_sync(x) as __wake_up_sync(x, TASK_NORMAL, 1) to
make it work on 5.4.y ]

---
v2: CC the related persons

 fs/eventpoll.c       | 5 ++++-
 include/linux/wait.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
fs/eventpoll.c +4 -1
index 8c0e94183186..569bfff280e4 100644
@@ -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++;
include/linux/wait.h +1 -0
index 03bff85e365f..5b65f720261a 100644
@@ -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)
Signature · 1 line
2.43.0
maintainer Reviewed-by Brian Geffon on v2 1/1
#5 lore raw

Re: [PATCH 5.4.y v2] epoll: Add synchronous wakeup support for ep_poll_callback

[ Sasha's backport helper bot ]

Hi,

Found matching upstream commit: 900bbaae67e980945dec74d36f8afe0de7556d5a

WARNING: Author mismatch between patch and found commit:
Backport author: Wenshan Lan <[email protected]> Commit author: Xuewen Yan <[email protected]>

Status in newer kernel trees:
6.12.y | Not found
6.6.y | Not found
6.1.y | Not found
5.15.y | Not found
5.10.y | Not found
5.4.y | Not found

Note: The patch differs from the upstream commit:
---
1: 900bbaae67e9 ! 1: b90bb7104c43 epoll: Add synchronous wakeup support for ep_poll_callback
@@ Commit message

+ (cherry picked from commit 900bbaae67e980945dec74d36f8afe0de7556d5a)
+ [ 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 <[email protected]>

## fs/eventpoll.c ##
@@ fs/eventpoll.c: static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
@@ include/linux/wait.h: 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)
++#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)
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.4.y        |  Success    |  Success   |