]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
namespace: Use atomic64_inc_return() in alloc_mnt_ns()
authorUros Bizjak <ubizjak@gmail.com>
Mon, 7 Oct 2024 08:52:37 +0000 (10:52 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 22 Oct 2024 09:16:57 +0000 (11:16 +0200)
Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
to use optimized implementation and ease register pressure around
the primitive for targets that implement optimized variant.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20241007085303.48312-1-ubizjak@gmail.com
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namespace.c

index 93c377816d75d08f6624c958a3114a73b9ce977c..9a3c251d033dede6d65ee61d6ff614b723318c15 100644 (file)
@@ -3901,7 +3901,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
        }
        new_ns->ns.ops = &mntns_operations;
        if (!anon)
-               new_ns->seq = atomic64_add_return(1, &mnt_ns_seq);
+               new_ns->seq = atomic64_inc_return(&mnt_ns_seq);
        refcount_set(&new_ns->ns.count, 1);
        refcount_set(&new_ns->passive, 1);
        new_ns->mounts = RB_ROOT;