All of lore.kernel.org
 help / color / mirror / Atom feed
* + lib-atomic64-separate-hashed-locks-by-smp-cache-line.patch added to mm-nonmm-unstable branch
@ 2026-11-29 22:33 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-11-29 22:33 UTC (permalink / raw)
  To: mm-commits, mark.rutland, akpm


The patch titled
     Subject: lib/atomic64: separate hashed locks by SMP cache line
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     lib-atomic64-separate-hashed-locks-by-smp-cache-line.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-atomic64-separate-hashed-locks-by-smp-cache-line.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: lib/atomic64: separate hashed locks by SMP cache line
Date: Sun, 29 Nov 2026 14:15:31 -0800

On machines where SMP_CACHE_BYTES exceeds L1_CACHE_BYTES, two hashed
atomic64 locks can occupy the same shared cache line.  Concurrent atomic64
operations on unrelated values then cause avoidable cache-line transfers
between CPUs.  This affects performance, not the correctness of the locks.

The array is aligned to SMP_CACHE_BYTES, but each union is only
L1_CACHE_BYTES long.  Align the element type to SMP_CACHE_BYTES and remove
the redundant padding.  On affected ARC configurations using generic
atomic64 operations, this separates the locks.  On !SMP, the type needs no
cache-line padding, so the 16-element array also consumes less memory.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>

 lib/atomic64.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/lib/atomic64.c~lib-atomic64-separate-hashed-locks-by-smp-cache-line
+++ a/lib/atomic64.c
@@ -24,10 +24,9 @@
 /*
  * Ensure each lock is in a separate cacheline.
  */
-static union {
+static struct {
 	arch_spinlock_t lock;
-	char pad[L1_CACHE_BYTES];
-} atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp = {
+} ____cacheline_aligned_in_smp atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp = {
 	[0 ... (NR_LOCKS - 1)] = {
 		.lock =  __ARCH_SPIN_LOCK_UNLOCKED,
 	},
_

Patches currently in -mm which might be from akpm@linux-foundation.org are

mm-vma-drop-mm-asynchronously-in-vma_start_read-fix.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read-fix-2.patch
kselftest-mm-rename-read_pmd_pagesize-to-pmd_psize-fix.patch
selftests-mm-check-madv_cold-and-madv_pageout-on-partly-advised-thps-fix.patch
selftests-mm-add-uffdio_move-huge-zeropage-pmd-regression-test-fix.patch
selftests-mm-allocate-nr_pages-based-on-pmd-size-for-uffd-pmd_move-tests-fix.patch
selftests-mm-retain-move-pmd-coverage-and-verify-huge-pmds.patch
lib-test_xarray-check-unused-spare-node-after-range-creation.patch
mm-memory-failure-dont-unpoison-a-leaked-raw_hwp_unreliable-folio-fix.patch
mm-hugetlb-delay-anon-folio-rmap-removal-until-after-the-tlb-flush-fix.patch
mm-hugetlb-delay-anon-folio-rmap-removal-until-after-the-tlb-flush-fix-2.patch
mm-vmstat_kunit-add-synthetic-benchmark-for-mm-stats-fix.patch
mm-prevent-pre-content-bypass-through-mremap-and-remap_file_pages.patch
afs-do-not-put-error-pointer-after-address-lookup-failure.patch
selftests-mm-check-that-fsync-reports-hard-poisoned-dirty-page-cache.patch
selftests-mm-memory-failure-truncate-poisoned-fuse-page-cache-before-teardown.patch
selftests-mm-memory-failure-skip-poisoned-dirty-page-cache-on-nilfs2.patch
selftest-mm-memory-failure-keep-page-cache-files-linked-until-cleanup.patch
selftest-mm-memory-failure-keep-page-cache-files-linked-until-cleanup-fix.patch
selftests-mm-memory-failure-skip-hard-dirty-page-cache-test-on-cephfs.patch
selftests-mm-memory-failure-close-dirty-page-cache-files-before-unlinking-them.patch
selftests-mm-memory-failure-extend-page-cache-test-files-with-pwrite.patch
selftests-mm-memory-failure-write-the-whole-page-cache-test-file-for-omfs.patch
selftests-mm-memory-failure-accept-eio-from-close-after-poisoning-dirty-data.patch
alloc_tag-introduce-ioctls-to-toggle-allocation-tracepoints-fix-fix.patch
alloc_tag-introduce-ioctls-to-toggle-allocation-tracepoints-fix.patch
mm-vmscan-scope-freeze-writeback-skip-to-the-reclaim-target.patch
mm-vmscan-scope-freeze-writeback-skip-to-the-reclaim-target-fix.patch
mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault-fix.patch
ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown.patch
ipc-msg-clamp-negative-msg_info-usage-counts.patch
squashfs-fix-leaked-page-locks-when-page-actor-allocation-fails-fix.patch
ocfs2-skip-network-flush-when-no-domain-handlers-are-registered.patch
selftests-ptrace-check-that-ptrace_set_syscall_info-rejects-invalid-error-values-fix.patch
kernfs-fix-a-race-on-the-count-of-mmapped-files.patch
kernfs-path-lookup-scalability-improvements.patch
kernfs-path-lookup-scalability-improvements-fix.patch
kernfs-make-getattr-lockless.patch
kernfs-make-getattr-lockless-fix.patch
kernfs-open-and-close-plain-files-without-the-open-file-mutex.patch
kernfs-keep-the-kernfs_open_node-for-a-while-after-the-last-close.patch
kernfs-open-and-close-files-with-release-without-the-open-file-mutex.patch
lib-atomic64-separate-hashed-locks-by-smp-cache-line.patch
nvdimm-btt-separate-map-locks-by-smp-cache-line.patch
drivers-media-v4l2-core-v4l2-vp9c-reduce-inlining.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 22:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 22:33 + lib-atomic64-separate-hashed-locks-by-smp-cache-line.patch added to mm-nonmm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.