The tmp variable is used to copy_to_user(), it has better performance if the address accesseed by ldp instruction is 16 bytes aligned on arm64.
The performance of nginx test is improved after this patch: http "Connection: close" 1.11% http "Connection: keep-alive" 2.11% https "Connection: close" 1.56% https "Connection: keep-alive" 0.18%
Yang Yingliang (1): fs/stat: make tmp variable 16-bytes aligned in copy stat
fs/stat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hulk inclusion category: performance bugzilla: https://gitee.com/openeuler/kernel/issues/I7F4XV
--------------------------------
The tmp variable is used to copy_to_user(), it has better performance if the address accesseed by ldp instruction is 16 bytes aligned on arm64.
The performance of nginx test is improved after this patch: http "Connection: close" 1.11% http "Connection: keep-alive" 2.11% https "Connection: close" 1.56% https "Connection: keep-alive" 0.18%
Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/stat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/stat.c b/fs/stat.c index 04550c0ba540..a8bf565886a8 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -225,7 +225,7 @@ int vfs_fstatat(int dfd, const char __user *filename, static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * statbuf) { static int warncount = 5; - struct __old_kernel_stat tmp; + struct __old_kernel_stat __aligned(16) tmp;
if (warncount > 0) { warncount--; @@ -312,7 +312,7 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat
static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) { - struct stat tmp; + struct stat __aligned(16) tmp;
if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev)) return -EOVERFLOW; @@ -457,7 +457,7 @@ SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) { - struct stat64 tmp; + struct stat64 __aligned(16) tmp;
INIT_STRUCT_STAT64_PADDING(tmp); #ifdef CONFIG_MIPS @@ -541,7 +541,7 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, const char __user *, filename, static noinline_for_stack int cp_statx(const struct kstat *stat, struct statx __user *buffer) { - struct statx tmp; + struct statx __aligned(16) tmp;
memset(&tmp, 0, sizeof(tmp));
@@ -613,7 +613,7 @@ SYSCALL_DEFINE5(statx, #ifdef CONFIG_COMPAT static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf) { - struct compat_stat tmp; + struct compat_stat __aligned(16) tmp;
if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev)) return -EOVERFLOW;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/1196 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/O...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/1196 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/O...