diff mbox series

epoll: simplify ep_busy_loop by removing always 0 argument

Message ID 20250227033412.5873-1-linf@wangsu.com (mailing list archive)
State New
Headers show
Series epoll: simplify ep_busy_loop by removing always 0 argument | expand

Commit Message

Lin Feng Feb. 27, 2025, 3:34 a.m. UTC
Commit 00b27634bc471("epoll: replace gotos with a proper loop") refactored
ep_poll and always feeds ep_busy_loop with a time_out value of 0, nonblock
mode for ep_busy_loop has sunk since, IOW nonblock mode checking has been
taken over by ep_poll itself, codes snipped:

static int ep_poll(struct eventpoll *ep...
{
...
    if (timed_out)
        return 0;

    eavail = ep_busy_loop(ep, timed_out);
...
}

Given this fact codes can be simplified a bit for ep_busy_loop.

Signed-off-by: Lin Feng <linf@wangsu.com>
---
 fs/eventpoll.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Christian Brauner Feb. 27, 2025, 8:45 a.m. UTC | #1
On Thu, 27 Feb 2025 11:34:12 +0800, Lin Feng wrote:
> Commit 00b27634bc471("epoll: replace gotos with a proper loop") refactored
> ep_poll and always feeds ep_busy_loop with a time_out value of 0, nonblock
> mode for ep_busy_loop has sunk since, IOW nonblock mode checking has been
> taken over by ep_poll itself, codes snipped:
> 
> static int ep_poll(struct eventpoll *ep...
> {
> ...
>     if (timed_out)
>         return 0;
> 
> [...]

Applied to the vfs-6.15.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.15.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.15.misc

[1/1] epoll: simplify ep_busy_loop by removing always 0 argument
      https://git.kernel.org/vfs/vfs/c/d3a194d95fc8
diff mbox series

Patch

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 7c0980db77b3..1fc770270ab8 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -438,7 +438,7 @@  static bool ep_busy_loop_end(void *p, unsigned long start_time)
  *
  * we must do our busy polling with irqs enabled
  */
-static bool ep_busy_loop(struct eventpoll *ep, int nonblock)
+static bool ep_busy_loop(struct eventpoll *ep)
 {
 	unsigned int napi_id = READ_ONCE(ep->napi_id);
 	u16 budget = READ_ONCE(ep->busy_poll_budget);
@@ -448,7 +448,7 @@  static bool ep_busy_loop(struct eventpoll *ep, int nonblock)
 		budget = BUSY_POLL_BUDGET;
 
 	if (napi_id >= MIN_NAPI_ID && ep_busy_loop_on(ep)) {
-		napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end,
+		napi_busy_loop(napi_id, ep_busy_loop_end,
 			       ep, prefer_busy_poll, budget);
 		if (ep_events_available(ep))
 			return true;
@@ -560,7 +560,7 @@  static void ep_resume_napi_irqs(struct eventpoll *ep)
 
 #else
 
-static inline bool ep_busy_loop(struct eventpoll *ep, int nonblock)
+static inline bool ep_busy_loop(struct eventpoll *ep)
 {
 	return false;
 }
@@ -2047,7 +2047,7 @@  static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
 		if (timed_out)
 			return 0;
 
-		eavail = ep_busy_loop(ep, timed_out);
+		eavail = ep_busy_loop(ep);
 		if (eavail)
 			continue;