Skip to contentSkip to conversation

fs: annotate cdev_lock with __cacheline_aligned_in_smp

PATCH Applied Mateusz Guzik 3 participants 3 messages Dec 3, 2025 – Dec 4, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: annotate cdev_lock with __cacheline_aligned_in_smp

No need for the crapper to be susceptible to false-sharing.

---
 fs/char_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/char_dev.c +1 -1
index c2ddb998f3c9..84a5a0699373 100644
@@ -343,7 +343,7 @@ void __unregister_chrdev(unsigned int major, unsigned int baseminor,
 	kfree(cd);
 }
 
-static DEFINE_SPINLOCK(cdev_lock);
+static __cacheline_aligned_in_smp DEFINE_SPINLOCK(cdev_lock);
 
 static struct kobject *cdev_get(struct cdev *p)
 {
Signature · 1 line
2.48.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Mateusz Guzik

No need for the crapper to be susceptible to false-sharing.

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/char_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/char_dev.c +1 -1
index c2ddb998f3c9..84a5a0699373 100644
@@ -343,7 +343,7 @@ void __unregister_chrdev(unsigned int major, unsigned int baseminor,
 	kfree(cd);
 }
 
-static DEFINE_SPINLOCK(cdev_lock);
+static __cacheline_aligned_in_smp DEFINE_SPINLOCK(cdev_lock);
 
 static struct kobject *cdev_get(struct cdev *p)
 {
Signature · 1 line
2.48.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
In reply to Mateusz Guzik
Quoted 3 lines · Mateusz Guzik

No need for the crapper to be susceptible to false-sharing.

Applied to the vfs-6.20.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.20.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.20.misc

[1/1] fs: annotate cdev_lock with __cacheline_aligned_in_smp

      https://git.kernel.org/vfs/vfs/c/6913380839e5