From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:36352 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755155AbdKIXTy (ORCPT ); Thu, 9 Nov 2017 18:19:54 -0500 Date: Thu, 9 Nov 2017 23:19:52 +0000 From: Al Viro To: NeilBrown Cc: Linus Torvalds , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH 2/3] Improve fairness when locking the per-superblock s_anon list Message-ID: <20171109231952.GF21978@ZenIV.linux.org.uk> References: <151019756744.30101.3832608128627682973.stgit@noble> <151019772760.30101.8513274540570798315.stgit@noble> <20171109205029.GD21978@ZenIV.linux.org.uk> <87zi7vdp7u.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zi7vdp7u.fsf@notabene.neil.brown.name> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Nov 10, 2017 at 10:09:09AM +1100, NeilBrown wrote: > So if an NFS server is getting lots of read/write request without opens > or other pathname lookups, it could easily have lots of disconnected > files being repeatedly accessed. Keeping the dentries on d_anon means > we don't need to keep allocating new ones for every request. > > So I'm not keen on dropping an IS_ROOT() dentry at final dput(), but > it might make sense to add the dentry to the per-fs list of IS_ROOT > dentries at that time. Watch out for dput() fast path (see fast_dput()) if you go that way. > One possible approach would be to use d_child rather than d_hash to link > together dentries that don't have a parent. > We could assign a random number to d_name.hash so it could appear to be > hashed without imposing on any one hash chain. We would still need a > spinlock in the superblock to manage the d_anon list that links the > d_child's together... > I might try to see how the code looks. Keep in mind that d_hash() includes bits of ->d_parent, aka. dentry itself. So no need for fake ->d_name.hash; you'll get spread from that part. ->d_child is... delicate. There are very interesting games around d_walk vs. dput already; I'd be very careful with that one.