On Tue, 15 Jul 2025 at 05:47, Nam Cao namcao@linutronix.de wrote:
fs/eventpoll.c | 139 +++++++++---------------------------------------- 1 file changed, 26 insertions(+), 113 deletions(-)
Yeah, this is more like the kind of diffstat I like to see for eventpoll. Plus it makes things fundamentally simpler.
It might be worth looking at ep_poll_callback() - the only case that had read_lock_irqsave() - and seeing if perhaps some of the tests inside the lock might be done optimistically, or delayed to after the lock.
For example, the whole wakeup sequence looks like it should be done *after* the ep->lock has been released, because it uses its own lock (ie the
if (sync) wake_up_sync(&ep->wq); else wake_up(&ep->wq);
thing uses the wq lock, and there is nothing that ep->lock protects there as far as I can tell.
So I think this has some potential for _simple_ optimizations, but I'm not sure how worth it it is.
Thanks, Linus