Skip to content

Commit 3a4551e

Browse files
committed
eventpoll: drop dead bool return from ep_remove_epi()
ep_remove_epi() always returns true -- the "can be disposed" answer was meaningful back when the dying-check lived inside the pre-split __ep_remove(), but after that check moved to ep_remove() the return value is just noise. Both callers gate on it unconditionally: if (ep_remove_epi(ep, epi)) WARN_ON_ONCE(ep_refcount_dec_and_test(ep)); dispose = ep_remove_epi(ep, epi); ... if (dispose && ep_refcount_dec_and_test(ep)) ep_free(ep); Make ep_remove_epi() return void, drop the dispose local in eventpoll_release_file(), and the useless conditionals at both callers. No functional change. Link: https://patch.msgid.link/[email protected] Signed-off-by: Christian Brauner (Amutable) <[email protected]>
1 parent 33e92e9 commit 3a4551e

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

fs/eventpoll.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ static void ep_remove_file(struct eventpoll *ep, struct epitem *epi,
882882
free_ephead(to_free);
883883
}
884884

885-
static bool ep_remove_epi(struct eventpoll *ep, struct epitem *epi)
885+
static void ep_remove_epi(struct eventpoll *ep, struct epitem *epi)
886886
{
887887
lockdep_assert_held(&ep->mtx);
888888

@@ -904,7 +904,6 @@ static bool ep_remove_epi(struct eventpoll *ep, struct epitem *epi)
904904
kfree_rcu(epi, rcu);
905905

906906
percpu_counter_dec(&ep->user->epoll_watches);
907-
return true;
908907
}
909908

910909
/*
@@ -932,9 +931,8 @@ static void ep_remove(struct eventpoll *ep, struct epitem *epi)
932931
return;
933932

934933
ep_remove_file(ep, epi, file);
935-
936-
if (ep_remove_epi(ep, epi))
937-
WARN_ON_ONCE(ep_refcount_dec_and_test(ep));
934+
ep_remove_epi(ep, epi);
935+
WARN_ON_ONCE(ep_refcount_dec_and_test(ep));
938936
}
939937

940938
static void ep_clear_and_put(struct eventpoll *ep)
@@ -1126,7 +1124,6 @@ void eventpoll_release_file(struct file *file)
11261124
{
11271125
struct eventpoll *ep;
11281126
struct epitem *epi;
1129-
bool dispose;
11301127

11311128
/*
11321129
* Use the 'dying' flag to prevent a concurrent ep_clear_and_put() from
@@ -1150,11 +1147,11 @@ void eventpoll_release_file(struct file *file)
11501147
ep_unregister_pollwait(ep, epi);
11511148

11521149
ep_remove_file(ep, epi, file);
1153-
dispose = ep_remove_epi(ep, epi);
1150+
ep_remove_epi(ep, epi);
11541151

11551152
mutex_unlock(&ep->mtx);
11561153

1157-
if (dispose && ep_refcount_dec_and_test(ep))
1154+
if (ep_refcount_dec_and_test(ep))
11581155
ep_free(ep);
11591156
goto again;
11601157
}

0 commit comments

Comments
 (0)