Skip to content

Commit 0cb9c99

Browse files
ubizjakbrauner
authored andcommitted
namespace: Use atomic64_inc_return() in alloc_mnt_ns()
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>
1 parent 1e75624 commit 0cb9c99

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3901,7 +3901,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
39013901
}
39023902
new_ns->ns.ops = &mntns_operations;
39033903
if (!anon)
3904-
new_ns->seq = atomic64_add_return(1, &mnt_ns_seq);
3904+
new_ns->seq = atomic64_inc_return(&mnt_ns_seq);
39053905
refcount_set(&new_ns->ns.count, 1);
39063906
refcount_set(&new_ns->passive, 1);
39073907
new_ns->mounts = RB_ROOT;

0 commit comments

Comments
 (0)