linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] namespace: Use atomic64_inc_return() in alloc_mnt_ns()
@ 2024-10-07  8:52 Uros Bizjak
  2024-10-07 11:39 ` Christian Brauner
  2024-10-07 14:50 ` Al Viro
  0 siblings, 2 replies; 5+ messages in thread
From: Uros Bizjak @ 2024-10-07  8:52 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Uros Bizjak, Alexander Viro, Christian Brauner, Jan Kara

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>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 93c377816d75..9a3c251d033d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -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;
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-07 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07  8:52 [PATCH] namespace: Use atomic64_inc_return() in alloc_mnt_ns() Uros Bizjak
2024-10-07 11:39 ` Christian Brauner
2024-10-07 14:50 ` Al Viro
2024-10-07 14:56   ` Christian Brauner
2024-10-07 15:02   ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).