]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
eventpoll: drop unused depth argument from epoll_mutex_lock()
authorChristian Brauner <brauner@kernel.org>
Fri, 24 Apr 2026 13:46:38 +0000 (15:46 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 28 Apr 2026 15:27:27 +0000 (17:27 +0200)
epoll_mutex_lock() has three callers, all in do_epoll_ctl(), and every
one passes depth == 0. The argument has been dead since the helper was
introduced. Drop it. Because a zero subclass makes mutex_lock_nested()
equivalent to mutex_lock(), switch the blocking path to the simpler
primitive as well.

No functional change.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Link: https://patch.msgid.link/20260424-work-epoll-rework-v1-7-249ed00a20f3@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/eventpoll.c

index da31a3ac6057cad5bd89e97b463597821d1677ce..ba1017c72167c36498149d3c836f8b2a80d8b3d6 100644 (file)
@@ -2432,16 +2432,13 @@ static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
 }
 #endif
 
-static inline int epoll_mutex_lock(struct mutex *mutex, int depth,
-                                  bool nonblock)
+static inline int epoll_mutex_lock(struct mutex *mutex, bool nonblock)
 {
        if (!nonblock) {
-               mutex_lock_nested(mutex, depth);
+               mutex_lock(mutex);
                return 0;
        }
-       if (mutex_trylock(mutex))
-               return 0;
-       return -EAGAIN;
+       return mutex_trylock(mutex) ? 0 : -EAGAIN;
 }
 
 int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
@@ -2513,14 +2510,14 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
         * deep wakeup paths from forming in parallel through multiple
         * EPOLL_CTL_ADD operations.
         */
-       error = epoll_mutex_lock(&ep->mtx, 0, nonblock);
+       error = epoll_mutex_lock(&ep->mtx, nonblock);
        if (error)
                goto error_tgt_fput;
        if (op == EPOLL_CTL_ADD) {
                if (READ_ONCE(fd_file(f)->f_ep) || ep->gen == loop_check_gen ||
                    is_file_epoll(fd_file(tf))) {
                        mutex_unlock(&ep->mtx);
-                       error = epoll_mutex_lock(&epnested_mutex, 0, nonblock);
+                       error = epoll_mutex_lock(&epnested_mutex, nonblock);
                        if (error)
                                goto error_tgt_fput;
                        loop_check_gen++;
@@ -2531,7 +2528,7 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
                                if (ep_loop_check(ep, tep) != 0)
                                        goto error_tgt_fput;
                        }
-                       error = epoll_mutex_lock(&ep->mtx, 0, nonblock);
+                       error = epoll_mutex_lock(&ep->mtx, nonblock);
                        if (error)
                                goto error_tgt_fput;
                }