]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ns: pad refcount
authorMateusz Guzik <mjguzik@gmail.com>
Wed, 3 Dec 2025 09:28:50 +0000 (10:28 +0100)
committerChristian Brauner <brauner@kernel.org>
Mon, 15 Dec 2025 13:33:38 +0000 (14:33 +0100)
Note no effort is made to make sure structs embedding the namespace are
themselves aligned, so this is not guaranteed to eliminate cacheline
bouncing due to refcount management.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251203092851.287617-2-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/ns/ns_common_types.h

index b332b019b29cb8bc15f7d5fba6a945cbe5129b3a..0014fbc1c62692069820c10d772c7b4b6a6605d6 100644 (file)
@@ -108,11 +108,13 @@ extern const struct proc_ns_operations utsns_operations;
  * @ns_tree: namespace tree nodes and active reference count
  */
 struct ns_common {
+       struct {
+               refcount_t __ns_ref; /* do not use directly */
+       } ____cacheline_aligned_in_smp;
        u32 ns_type;
        struct dentry *stashed;
        const struct proc_ns_operations *ops;
        unsigned int inum;
-       refcount_t __ns_ref; /* do not use directly */
        union {
                struct ns_tree;
                struct rcu_head ns_rcu;