[RFC PATCH 2/2] eventpoll: separate nested-check objects by cache line
From: Pranith Kumar
Date: Mon Oct 19 2026 - 14:32:02 EST
The generation stamp, topology rwsem, and global mutex occupy one
64-byte line in the ARM64 build. Readers of the stamp can therefore
share a line with frequent rwsem updates from independent workers.
Align the stamp and rwsem independently on SMP builds. This leaves
the mutex on a separate line as well. The rwsem reader count remains
a shared object; this change only removes mixed-object sharing.
On the local four-core workload, nested throughput rose
from 5,325,959 to 5,487,081 pairs/s (+3.03%) over the parallel-add
change.
Signed-off-by: Pranith Kumar <bobby.prani@xxxxxxxxx>
---
fs/eventpoll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 5f7cd03107b3..ffe2c12858ab 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -422,7 +422,7 @@ static long max_user_watches __read_mostly;
static DEFINE_MUTEX(epnested_mutex);
/* Hash collisions only reduce concurrency. */
#define EP_FILE_LOCK_BITS 8
-static DECLARE_RWSEM(epnested_rwsem);
+static __cacheline_aligned_in_smp DECLARE_RWSEM(epnested_rwsem);
static struct mutex ep_file_mutexes[1 << EP_FILE_LOCK_BITS];
static struct mutex *ep_file_mutex(struct file *file)
@@ -430,7 +430,7 @@ static struct mutex *ep_file_mutex(struct file *file)
return &ep_file_mutexes[hash_ptr(file, EP_FILE_LOCK_BITS)];
}
-static u64 loop_check_gen = 0;
+static u64 loop_check_gen __cacheline_aligned_in_smp;
#define PATH_ARR_SIZE 5
--
2.47.3