From patchwork Tue Mar 10 19:45:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 5980361 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41368BF440 for ; Tue, 10 Mar 2015 19:49:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5195020165 for ; Tue, 10 Mar 2015 19:49:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 468FA20108 for ; Tue, 10 Mar 2015 19:49:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932173AbbCJTt0 (ORCPT ); Tue, 10 Mar 2015 15:49:26 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:20324 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737AbbCJTsS (ORCPT ); Tue, 10 Mar 2015 15:48:18 -0400 Received: from pps.filterd (m0044012 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t2AJkejf015229; Tue, 10 Mar 2015 12:48:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=LRjnoRGxSU2Gcd8NWroVyEvXfaZC397kYRk92VU5QCw=; b=gNy9sXYq9cAX+uEf5xZXWZ/TDELLqK39dKFF4oOFj1xmzsqLWsLkv5HI4h8UUxics2Cq D8FGpgEGCX+H0Et4sKcoy7kmr9ORTdvH+DPTmuIX+UV8vH3BBBmKj/qtoDadrtH2U/IF HS/6g44xaP8SrOJlqN5DLc8iB2uMtZ/69zM= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 1t25u9g52a-7 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 10 Mar 2015 12:48:08 -0700 Received: from localhost (192.168.54.13) by mail.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 10 Mar 2015 12:45:33 -0700 From: Josef Bacik To: , , , , CC: Dave Chinner Subject: [PATCH 2/9] inode: add IOP_NOTHASHED to avoid inode hash lock in evict Date: Tue, 10 Mar 2015 15:45:17 -0400 Message-ID: <1426016724-23912-3-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1426016724-23912-1-git-send-email-jbacik@fb.com> References: <1426016724-23912-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-03-10_07:2015-03-10, 2015-03-10, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.925924926977281 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.925924926977281 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.925924926977281 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1503100201 X-FB-Internal: deliver Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Chinner Some filesystems don't use the VFS inode hash and fake the fact they are hashed so that all the writeback code works correctly. However, this means the evict() path still tries to remove the inode from the hash, meaning that the inode_hash_lock() needs to be taken unnecessarily. Hence under certain workloads the inode_hash_lock can be contended even if the inode is never actually hashed. To avoid this, add an inode opflag to allow inode_hash_remove() to avoid taking the hash lock on inodes have never actually been hashed. Signed-off-by: Dave Chinner Reviewed-by: Jan Kara --- fs/xfs/xfs_iops.c | 2 ++ include/linux/fs.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index e53a903..5068629 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1250,8 +1250,10 @@ xfs_setup_inode( inode->i_state = I_NEW; inode_sb_list_add(inode); + /* make the inode look hashed for the writeback code */ hlist_add_fake(&inode->i_hash); + inode->i_opflags |= IOP_NOTHASHED; inode->i_mode = ip->i_d.di_mode; set_nlink(inode, ip->i_d.di_nlink); diff --git a/include/linux/fs.h b/include/linux/fs.h index b4d71b5..1045132 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -546,6 +546,7 @@ struct posix_acl; #define IOP_FASTPERM 0x0001 #define IOP_LOOKUP 0x0002 #define IOP_NOFOLLOW 0x0004 +#define IOP_NOTHASHED 0x0008 /* inode never hashed, avoid unhashing */ /* * Keep mostly read-only and often accessed (especially for @@ -2528,7 +2529,7 @@ static inline void insert_inode_hash(struct inode *inode) extern void __remove_inode_hash(struct inode *); static inline void remove_inode_hash(struct inode *inode) { - if (!inode_unhashed(inode)) + if (!((inode->i_opflags & IOP_NOTHASHED) || inode_unhashed(inode))) __remove_inode_hash(inode); }