linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shaokun Zhang <zhangshaokun@hisilicon.com>
To: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Yuqi Jin <jinyuqi@huawei.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Shaokun Zhang <zhangshaokun@hisilicon.com>
Subject: [PATCH] fs: Optimized file struct to improve performance
Date: Fri, 9 Apr 2021 11:47:37 +0800	[thread overview]
Message-ID: <1617940057-52843-1-git-send-email-zhangshaokun@hisilicon.com> (raw)

From: Yuqi Jin <jinyuqi@huawei.com>

In the syscall process, @f_count and @f_mod are frequently used, if
we put them together with each other and they will share the same
cacheline. It is useful for the performance.

syscall of unixbench is tested on Intel 8180.
before this patch
80 CPUs in system; running 80 parallel copies of tests

System Call Overhead                    3789860.2 lps   (10.0 s, 1 samples)

System Benchmarks Partial Index              BASELINE       RESULT    INDEX
System Call Overhead                          15000.0    3789860.2   2526.6
                                                                   ========
System Benchmarks Index Score (Partial Only)                         2526.6

after this patch
80 CPUs in system; running 80 parallel copies of tests

System Call Overhead                    3951328.1 lps   (10.0 s, 1 samples)

System Benchmarks Partial Index              BASELINE       RESULT    INDEX
System Call Overhead                          15000.0    3951328.1   2634.2
                                                                   ========
System Benchmarks Index Score (Partial Only)                         2634.2

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Yuqi Jin <jinyuqi@huawei.com>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
---
 include/linux/fs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3fbb98126248..cfc91d2dd6a7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -917,7 +917,6 @@ struct file {
 		struct llist_node	fu_llist;
 		struct rcu_head 	fu_rcuhead;
 	} f_u;
-	struct path		f_path;
 	struct inode		*f_inode;	/* cached value */
 	const struct file_operations	*f_op;
 
@@ -926,13 +925,14 @@ struct file {
 	 * Must not be taken from IRQ context.
 	 */
 	spinlock_t		f_lock;
-	enum rw_hint		f_write_hint;
 	atomic_long_t		f_count;
 	unsigned int 		f_flags;
 	fmode_t			f_mode;
 	struct mutex		f_pos_lock;
 	loff_t			f_pos;
 	struct fown_struct	f_owner;
+	enum rw_hint		f_write_hint;
+	struct path		f_path;
 	const struct cred	*f_cred;
 	struct file_ra_state	f_ra;
 
-- 
2.7.4


             reply	other threads:[~2021-04-09  3:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  3:47 Shaokun Zhang [this message]
2021-04-20  6:10 ` [fs] aec499039e: unixbench.score 19.2% improvement kernel test robot
2021-05-10 12:03   ` Shaokun Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617940057-52843-1-git-send-email-zhangshaokun@hisilicon.com \
    --to=zhangshaokun@hisilicon.com \
    --cc=jinyuqi@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).