2023-10-04 11:19:36

by Mateusz Guzik

[permalink] [raw]
Subject: [PATCH 0/2] 2 cosmetic changes

both were annoying me for some time, so I'm pushing them out

These patches don't warrant arguing nor pinging in case of no response,
so if you don't like them that's it for the patchset. :)

cheers

Mateusz Guzik (2):
vfs: predict the error in retry_estale as unlikely
vfs: stop counting on gcc not messing with mnt_expiry_mark if not
asked

fs/namespace.c | 4 ++--
include/linux/namei.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

--
2.39.2


2023-10-04 11:19:55

by Mateusz Guzik

[permalink] [raw]
Subject: [PATCH 2/2] vfs: stop counting on gcc not messing with mnt_expiry_mark if not asked

So happens it already was not doing it, but there is no need to "hope"
as indicated in the comment.

No changes in generated assembly.

Signed-off-by: Mateusz Guzik <[email protected]>
---
fs/namespace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index e157efc54023..d785bcb75111 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1344,9 +1344,9 @@ void mntput(struct vfsmount *mnt)
{
if (mnt) {
struct mount *m = real_mount(mnt);
- /* avoid cacheline pingpong, hope gcc doesn't get "smart" */
+ /* avoid cacheline pingpong */
if (unlikely(m->mnt_expiry_mark))
- m->mnt_expiry_mark = 0;
+ WRITE_ONCE(m->mnt_expiry_mark, 0);
mntput_no_expire(m);
}
}
--
2.39.2

2023-10-04 11:23:17

by Mateusz Guzik

[permalink] [raw]
Subject: [PATCH 1/2] vfs: predict the error in retry_estale as unlikely

Signed-off-by: Mateusz Guzik <[email protected]>
---
include/linux/namei.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/namei.h b/include/linux/namei.h
index 1463cbda4888..689b16f3031b 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -112,7 +112,7 @@ static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
static inline bool
retry_estale(const long error, const unsigned int flags)
{
- return error == -ESTALE && !(flags & LOOKUP_REVAL);
+ return unlikely(error == -ESTALE && !(flags & LOOKUP_REVAL));
}

#endif /* _LINUX_NAMEI_H */
--
2.39.2

2023-10-09 16:15:13

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH 0/2] 2 cosmetic changes

On Wed, 04 Oct 2023 13:19:14 +0200, Mateusz Guzik wrote:
> both were annoying me for some time, so I'm pushing them out
>
> These patches don't warrant arguing nor pinging in case of no response,
> so if you don't like them that's it for the patchset. :)
>
> cheers
>
> [...]

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/2] vfs: predict the error in retry_estale as unlikely
https://git.kernel.org/vfs/vfs/c/c9f39d6a1486
[2/2] vfs: stop counting on gcc not messing with mnt_expiry_mark if not asked
https://git.kernel.org/vfs/vfs/c/5cafd8fed85c