[RFC PATCH 0/2] eventpoll: scale nested leaf additions

From: Pranith Kumar

Date: Mon Oct 19 2026 - 14:31:23 EST


Adding an ordinary file to an epoll watched by another epoll takes
epnested_mutex. Workers adding different files to different epoll
instances therefore serialize on one global lock, even though their
reverse-path checks do not conflict.

The first patch freezes the epoll topology with a shared rwsem during
these leaf additions and uses a hashed per-file mutex to serialize
checks for the same target file. An epoll topology change takes the
rwsem for write and retains epnested_mutex for cycle and path checks.
The second patch separates the generation stamp and topology rwsem
onto cache lines of their own on SMP builds. In the tested ARM64
layout, this also separates them from epnested_mutex.

The series was built and tested on linux-next tag next-20261016
(7.3-rc7 based). Four workers each ran 2,000 epoll
add/delete pairs in nested and flat modes. Throughput:

Kernel Nested pairs/s Gain % Flat pairs/s Gain %
Unpatched linux-next 1,558,641 0.0% 6,736,037 0.00%
Parallel additions 5,325,959 +241.7% 6,771,375 +0.52%
Parallel + alignment 5,487,081 +252.0% 6,780,276 +0.66%

This patch was developed with AI assistance.

Pranith Kumar (2):
eventpoll: parallelize independent nested leaf additions
eventpoll: separate nested-check objects by cache line

fs/eventpoll.c | 116 ++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 90 insertions(+), 26 deletions(-)

base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
--
2.47.3