From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbcKUBgC (ORCPT ); Sun, 20 Nov 2016 20:36:02 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:40142 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbcKUBgA (ORCPT ); Sun, 20 Nov 2016 20:36:00 -0500 Date: Mon, 21 Nov 2016 01:35:58 +0000 From: Al Viro To: Linus Torvalds Cc: Eric Dumazet , Linux Kernel Mailing List Subject: Re: Linux 4.9-rc6 Message-ID: <20161121013558.GG1555@ZenIV.linux.org.uk> References: <1479680873.8455.386.camel@edumazet-glaptop3.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 20, 2016 at 03:27:07PM -0800, Linus Torvalds wrote: > On Sun, Nov 20, 2016 at 2:27 PM, Eric Dumazet wrote: > > > > Hosts with ~100,000 threads have an issue with /prov/vmallocinfo > > > > It can take about 800 usec to skip over ~100,000 struct vmap_area > > in s_start(), while holding vmap_area_lock spinlock, and therefore > > blocking fork()/pthread_create(). > > > > I presume we can not switch to the rbtree (vmap_area_root) > > for /proc/vmallocinfo, because this file is seek-able, right ? > > Well, the good news is that the file is root-only anyway, which means > that at least it won't have the issue that a lot of other /proc files > have had - namely being opened by random user programs or libraries. > > Which means that the users of it are likely fairly limited. > > Which in turn means that we can probably afford to play more games > with it. Including, for example, possibly marking it non-seekable. > > Or even just limit the maximum entries we are willing to walk. > > Or we could decide that that file shouldn't be a seq_file at all, use > the old "one page buffer" approach that was so common for /proc files, > and make the position encode the vmalloc address in it (make the lower > PAGE_MASK bits be the offset in the line), and then we *could* just > look things up using the btree method. > > Al, do you have any clever ideas? Umm... One possibility would be something like fs/namespace.c:m_start() - if nothing has changed since the last time, just use a cached pointer. That has sped the damn thing (/proc/mounts et.al.) big way, but it's dependent upon having an event count updated whenever we change the mount tree - doing the same for vma_area list might or might not be a good idea. /proc/mounts and friends get ->poll() on that as well; that probably would _not_ be a good idea in this case.