summaryrefslogtreecommitdiff
path: root/fs/posix_acl.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2022-12-21 20:35:40 +0100
committerChristian Brauner (Microsoft) <brauner@kernel.org>2023-01-08 12:37:49 +0100
commit4e1da8fe031303599e78f88e0dad9f44272e4f99 (patch)
treebe4f00de082d570ac06a21010528c2150bde5670 /fs/posix_acl.c
parent1b929c02afd37871d5afb9d498426f83432e71c2 (diff)
posix_acl: Use try_cmpxchg in get_acl
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in get_acl. x86 CMPXCHG instruction returns success in ZF flag, so this change saves a compare after cmpxchg (and related move instruction in front of cmpxchg). No functional change intended. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Diffstat (limited to 'fs/posix_acl.c')
-rw-r--r--fs/posix_acl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index d7bc81fc0840..420c689e1bec 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -174,7 +174,7 @@ static struct posix_acl *__get_acl(struct user_namespace *mnt_userns,
* Cache the result, but only if our sentinel is still in place.
*/
posix_acl_dup(acl);
- if (unlikely(cmpxchg(p, sentinel, acl) != sentinel))
+ if (unlikely(!try_cmpxchg(p, &sentinel, acl)))
posix_acl_release(acl);
return acl;
}