Skip to content

RFC eventpoll: scale nested leaf additions

Pranith Kumar linux-fsdevel lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2eventpoll: parallelize independent nested leaf additionsfs/eventpoll.c+89 -250 replies
1/2eventpoll: parallelize independent nested leaf additionsfs/eventpoll.c+89 -250 replies
2/2eventpoll: separate nested-check objects by cache linefs/eventpoll.c+2 -20 replies
2/2eventpoll: separate nested-check objects by cache linefs/eventpoll.c+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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

Signature · 1 line
2.47.3