summaryrefslogtreecommitdiffstats
path: root/fs/sysv/namei.c
diff options
context:
space:
mode:
authorFabio M. De Francesco <fmdefrancesco@gmail.com>2023-01-19 16:32:32 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2023-01-19 23:24:35 -0500
commit83005276d383387fec7e18c7a36daade579a23a7 (patch)
tree854063585b9186556e6ce1c280a7deb81ab9dd90 /fs/sysv/namei.c
parentc26ddc49c9080975cc03cf3bd6917c3fb37d808b (diff)
downloadlinux-83005276d383387fec7e18c7a36daade579a23a7.tar.gz
linux-83005276d383387fec7e18c7a36daade579a23a7.tar.bz2
linux-83005276d383387fec7e18c7a36daade579a23a7.zip
fs/sysv: Replace kmap() with kmap_local_page()
kmap() is being deprecated in favor of kmap_local_page(). There are two main problems with kmap(): (1) It comes with an overhead as the mapping space is restricted and protected by a global lock for synchronization and (2) it also requires global TLB invalidation when the kmap’s pool wraps and it might block when the mapping space is fully utilized until a slot becomes available. With kmap_local_page() the mappings are per thread, CPU local, can take page faults, and can be called from any context (including interrupts). It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore, the tasks can be preempted and, when they are scheduled to run again, the kernel virtual addresses are restored and still valid. Since kmap_local_page() would not break the strict rules of local mappings (i.e., the thread locality and the stack based nesting), this function can be easily and safely replace the deprecated API. Therefore, replace kmap() with kmap_local_page() in fs/sysv. kunmap_local() requires the mapping address, so return that address from dir_get_page() to be used in dir_put_page(). Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Suggested-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysv/namei.c')
-rw-r--r--fs/sysv/namei.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 981c1d76f342..371cf9012052 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -251,9 +251,9 @@ static int sysv_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
out_dir:
if (dir_de)
- dir_put_page(dir_page);
+ dir_put_page(dir_page, dir_de);
out_old:
- dir_put_page(old_page);
+ dir_put_page(old_page, old_de);
out:
return err;
}