From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753713AbbCLJwc (ORCPT ); Thu, 12 Mar 2015 05:52:32 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:39587 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753122AbbCLJwK (ORCPT ); Thu, 12 Mar 2015 05:52:10 -0400 Date: Thu, 12 Mar 2015 09:52:07 +0000 From: Al Viro To: Josef Bacik Cc: linux-fsdevel@vger.kernel.org, david@fromorbit.com, jack@suse.cz, linux-kernel@vger.kernel.org, Dave Chinner Subject: Re: [PATCH 2/9] inode: add IOP_NOTHASHED to avoid inode hash lock in evict Message-ID: <20150312095206.GM29656@ZenIV.linux.org.uk> References: <1426016724-23912-1-git-send-email-jbacik@fb.com> <1426016724-23912-3-git-send-email-jbacik@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426016724-23912-3-git-send-email-jbacik@fb.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2015 at 03:45:17PM -0400, Josef Bacik wrote: > 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. Why bother with flags, etc. when we could just do static inline bool hlist_fake(struct hlist_node *h) { return h->pprev == &h->next; } > - if (!inode_unhashed(inode)) > + if (!((inode->i_opflags & IOP_NOTHASHED) || inode_unhashed(inode))) and turn this check into if (!inode_unhashed(inode) && !hlist_fake(&inode->i_hash)) instead?