[PATCH] fs: annotate cdev_lock with __cacheline_aligned_in_smp

Mateusz Guzik posted 1 patch 2 weeks, 2 days ago
fs/char_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] fs: annotate cdev_lock with __cacheline_aligned_in_smp
Posted by Mateusz Guzik 2 weeks, 2 days ago
No need for the crapper to be susceptible to false-sharing.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
 fs/char_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/char_dev.c b/fs/char_dev.c
index c2ddb998f3c9..84a5a0699373 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -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)
 {
-- 
2.48.1
Re: [PATCH] fs: annotate cdev_lock with __cacheline_aligned_in_smp
Posted by Christian Brauner 2 weeks, 1 day ago
On Wed, 03 Dec 2025 10:55:08 +0100, Mateusz Guzik wrote:
> 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
Re: [PATCH] fs: annotate cdev_lock with __cacheline_aligned_in_smp
Posted by Jan Kara 2 weeks, 2 days ago
On Wed 03-12-25 10:55:08, Mateusz Guzik wrote:
> No need for the crapper to be susceptible to false-sharing.
> 
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> ---
>  fs/char_dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/char_dev.c b/fs/char_dev.c
> index c2ddb998f3c9..84a5a0699373 100644
> --- a/fs/char_dev.c
> +++ b/fs/char_dev.c
> @@ -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)
>  {
> -- 
> 2.48.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR