From owner-freebsd-fs@freebsd.org Thu Nov 5 20:25:40 2015 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72B47A278F1 for ; Thu, 5 Nov 2015 20:25:40 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0F511A7 for ; Thu, 5 Nov 2015 20:25:40 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: by mailman.ysv.freebsd.org (Postfix) id 5BCA6A278F0; Thu, 5 Nov 2015 20:25:40 +0000 (UTC) Delivered-To: fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B623A278EF for ; Thu, 5 Nov 2015 20:25:40 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [IPv6:2001:5a8:4:7e72:d250:99ff:fe57:4030]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 409A111A6 for ; Thu, 5 Nov 2015 20:25:40 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (localhost [IPv6:::1]) by chez.mckusick.com (8.15.2/8.14.9) with ESMTP id tA5KPcLF066724; Thu, 5 Nov 2015 12:25:38 -0800 (PST) (envelope-from mckusick@chez.mckusick.com) Message-Id: <201511052025.tA5KPcLF066724@chez.mckusick.com> From: Kirk McKusick To: Konstantin Belousov Subject: Re: an easy (?) question on namecache sizing cc: fs@freebsd.org In-reply-to: <20151105195648.GK2257@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <66722.1446755138.1@chez.mckusick.com> Date: Thu, 05 Nov 2015 12:25:38 -0800 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2015 20:25:40 -0000 > Date: Thu, 5 Nov 2015 21:56:48 +0200 > From: Konstantin Belousov > To: Kirk McKusick > Subject: Re: an easy (?) question on namecache sizing > Cc: fs@freebsd.org > > On Thu, Nov 05, 2015 at 10:56:55AM -0800, Kirk McKusick wrote: >> >> I propose that we update wantfreevnodes in sysctl_update_desiredvnodes() >> so that it tracks the change in desiredvnodes: >> >> Index: /sys/kern/vfs_subr.c >> =================================================================== >> --- /sys/kern/vfs_subr.c (revision 290387) >> +++ /sys/kern/vfs_subr.c (working copy) >> @@ -293,6 +293,7 @@ >> if (old_desiredvnodes != desiredvnodes) { >> + wantfreevnodes = desiredvnodes / 4; >> vfs_hash_changesize(desiredvnodes); >> cache_changesize(desiredvnodes); >> } >> return (0); >> } >> >> Otherwise bumping up desiredvnodes will be less effective than expected. >> >> I see that Bruce has also suggested this change in his more extensive >> revisions. > > I think the idea is right, but the implementation is not. Just changing > wantfreevnodes after desirevnodes was reduced, creates a window where an > other thread could see small value for desiredvnodes, but large value > for wantfreevnodes. Then, e.g. vlrureclaim() would go wild. IMO it should > ensure that the observable values are non-contradictory. Does moving the setting of wantfreevnodes before the cache size changes (as redone above) close the window enough? The vlrureclaim() function operates slowly enough that a brief period of inconsistency seems unimportant. Changing desiredvnodes happens very rarely. And at the moment we are not correcting wantfreevnodes at all. Or am I missing some key point? Kirk McKusick