提交 2b34be30 编写于 作者: Y Yang Yingliang

fs/stat: make tmp variable 16-bytes aligned in copy stat

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: NYang Yingliang <yangyingliang@huawei.com>
上级 2fcd3e30
...@@ -225,7 +225,7 @@ int vfs_fstatat(int dfd, const char __user *filename, ...@@ -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 cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * statbuf)
{ {
static int warncount = 5; static int warncount = 5;
struct __old_kernel_stat tmp; struct __old_kernel_stat __aligned(16) tmp;
if (warncount > 0) { if (warncount > 0) {
warncount--; warncount--;
...@@ -312,7 +312,7 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat ...@@ -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) 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)) if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev))
return -EOVERFLOW; return -EOVERFLOW;
...@@ -457,7 +457,7 @@ SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf, ...@@ -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) 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); INIT_STRUCT_STAT64_PADDING(tmp);
#ifdef CONFIG_MIPS #ifdef CONFIG_MIPS
...@@ -541,7 +541,7 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, const char __user *, filename, ...@@ -541,7 +541,7 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, const char __user *, filename,
static noinline_for_stack int static noinline_for_stack int
cp_statx(const struct kstat *stat, struct statx __user *buffer) cp_statx(const struct kstat *stat, struct statx __user *buffer)
{ {
struct statx tmp; struct statx __aligned(16) tmp;
memset(&tmp, 0, sizeof(tmp)); memset(&tmp, 0, sizeof(tmp));
...@@ -613,7 +613,7 @@ SYSCALL_DEFINE5(statx, ...@@ -613,7 +613,7 @@ SYSCALL_DEFINE5(statx,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf) 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)) if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev))
return -EOVERFLOW; return -EOVERFLOW;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册