Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1036247pxf; Thu, 8 Apr 2021 20:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRyFRT3jGTxyMah7FpOkV9JKc4BSzqUtvgeFxeMSFCHGTjlQYNDilFZhbsL9qMLl4Ilid8 X-Received: by 2002:a17:906:a103:: with SMTP id t3mr14427253ejy.334.1617940288031; Thu, 08 Apr 2021 20:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617940288; cv=none; d=google.com; s=arc-20160816; b=YBOzk7TQbBlgBpxcqdkK00zbJufn0vIj2dViXEwASaj4UGYKNlH8jVIXq59KcjlbSc 7FDBetzNL5ygVXnJaaWnoIWuMof4Vg00WONG/fDqSfNkUutHFUMOdek1Lzo2vyAf+mlu WMF+Qjfwz9VqVPpdZYC+gjV+Cj5EYKwTgO/isR5oCqUHoyEsu0qvyg7yEb2Afx30SQC0 jUdmkr6ZkY/sylueoCrPKi7tvHbsOjxES82WzKjKYdf32oDTf2/V2e+I7+mjZ64fFOUl DOCfQfj1/vw+SJCsUgm4tMMNkPcb5K/AFGBmq2Kc3up5GsdZ4R1x+NLNc814EzJjkxYC nr3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=suPiVCt8qteATY+nya3e+aW8IU1ZoYE5rGB0VJhnsBA=; b=X9aHWFGycDEzgcVNH0e89Ier3aq/vwu8KcD2mdIbKfIHlwYg+Hm2UkOGz7DgwE09/n bx+HD1sNZnvnB1YFACoLM/UBZKDQPV2iKSJyARc0MLrbNlNvjntd9ebIpi6jb1exwQ+/ Czfs9NCMu9rjCmqyQWcODPLAXoeBG5j5abmF5lW/bqlamsm9gCk3VCxymQ1USlSGSiXh Qr0USs0qsk3x+pdDhg5oxSkqbHD1od5o75fFZM5SOv7FN11mwz9/6lwciLg39qGUqgrd bX24OC6gw9psyhTPXE5i7ETV2XTGFqXYDTpCEmIJ4tKPpZBRz0HkbwKfDH2nV4Vv9Jkr i1nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si1321812edd.446.2021.04.08.20.51.01; Thu, 08 Apr 2021 20:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233187AbhDIDru (ORCPT + 99 others); Thu, 8 Apr 2021 23:47:50 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16059 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbhDIDrt (ORCPT ); Thu, 8 Apr 2021 23:47:49 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FGkXc1HR8zPpPs; Fri, 9 Apr 2021 11:44:48 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Fri, 9 Apr 2021 11:47:29 +0800 From: Shaokun Zhang To: , CC: Yuqi Jin , Alexander Viro , Shaokun Zhang Subject: [PATCH] fs: Optimized file struct to improve performance Date: Fri, 9 Apr 2021 11:47:37 +0800 Message-ID: <1617940057-52843-1-git-send-email-zhangshaokun@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yuqi Jin 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 Signed-off-by: Yuqi Jin Signed-off-by: Shaokun Zhang --- 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