Received: by 10.192.165.148 with SMTP id m20csp1011125imm; Wed, 25 Apr 2018 11:05:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx48JctVYU2lMfkXjtYIKqwaErlujoPSCUW3UCqGrz7u2n+fypwbmpZI29FzSOfqrOsyghY6a X-Received: by 2002:a17:902:ea:: with SMTP id a97-v6mr29349714pla.28.1524679557314; Wed, 25 Apr 2018 11:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524679557; cv=none; d=google.com; s=arc-20160816; b=gUWhzRmoKSMbYRoH7yxNt+C6i+G/eKtpUFrIe8JP3Zk1rLfAQoxmwr9Z00hgiqRgTd ANC2jTtCSPxWVOzlbQO/OmBfS9HpUoleIYEh2X5sM79BgBpNglLWpk16s2A/CL3dBOOH apLclamN4l5CZ1TmXxfb+OL6DgcCxQPa9bUw9JdDMMpOFdooUqIvqYAAdTqKYLWGm5zq FqcH8kffwaZR2GGN02NFlI4bzSbIF3BPB5D2VMZCBbfm+nvB2BOYYcd1WAi5KQ7CQnvD 9U3GCSmHy9z35vNEobn6gUQuHGglrRlDzDD9mLY/ycsdrvfCmW6C+mZ6bbN7hMub4cls 3fiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=k5pgxvDpoHEq7/lxwwQiURJG56/UJIbITs7uhLYIX18=; b=US/0EvvPuvBbmv0+BQf5cESEXgE/0B9KnfZL3pC/tBWW5+Qkx5r4LBHaa4H8AKhLbP 0xZIGuc4UNEYYNm9jhKUVp/fB/RpN4JEcHBog5ojM/JMVRUQ5pZnjNSmXQdzXizJZmCQ Z0/Sbw8wI9v3ftgeF85DScu1moSHpAuVMmH6/qmdk1pyGQwT6S00tR8ksewpIlSxbVxs Di+qZ173VO6wq+1WmIyoxKWpmjk+N1z6UyTRbBMCnYLOZD8P6e41TmNLG2NcwLNZAw0U PpfHbeHcyOpA0+r4kIWg4oHr0Og+zM9xEzeDLOkJ6y6wEEHHqu45LsZvxX2hQRJr4NnE NQ/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si592845pgp.95.2018.04.25.11.05.42; Wed, 25 Apr 2018 11:05:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755421AbeDYSEg (ORCPT + 99 others); Wed, 25 Apr 2018 14:04:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:38556 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935AbeDYSEe (ORCPT ); Wed, 25 Apr 2018 14:04:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5ECC8AC4F; Wed, 25 Apr 2018 18:04:33 +0000 (UTC) Subject: Re: [RFC] [PATCH 0/5] procfs: reduce duplication by using symlinks To: Alexey Dobriyan Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Al Viro , "Eric W . Biederman" , Oleg Nesterov References: <20180424022106.16952-1-jeffm@suse.com> <20180424061700.GA3689@avx2> From: Jeff Mahoney Openpgp: preference=signencrypt Message-ID: <43fd713e-1ebf-7250-5ddb-e0326e0c3376@suse.com> Date: Wed, 25 Apr 2018 14:04:30 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180424061700.GA3689@avx2> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/24/18 2:17 AM, Alexey Dobriyan wrote: > On Mon, Apr 23, 2018 at 10:21:01PM -0400, jeffm@suse.com wrote: >> Memory pressure isn't really an issue on this machine, so we >> end up using well over 100GB for proc files. > > Text files at scale! > >> With these patches applied, running the same testcase, the proc_inode >> cache only gets to about 600k objects, which is about 99.7% fewer. I >> get that procfs isn't supposed to be scalable, but this is kind of >> extreme. :)> > Easy stuff: > * all ->get_link hooks are broken in RCU lookup (use GFP_KERNEL), It's a pretty common pattern in the kernel, but it's just as easy to set inode->i_link during instantiation and keep RCU lookup. There aren't so many of these to make it a real burden on memory. > * "%.*s" for dentry names is probably unnecessary, > they're always NUL terminated Ack. > * kasprintf() does printing twice, since we're kind of care about /proc > performance, allocate for the worst case. Ack, integrated with ->get_link fix. > * "int nlinks = nlink_tgid;" > Unsigned police. Ack. nlink_t{,g}id are both u8, but it's easy to make it consistent. > * (inode->i_mode & S_IFLNK) > this is sketchy, S_ISLNK exists. > Ack. Notes of my own: proc_task_count_links also had the logic backward. It would add an extra link to the count for the symlink rather than the dir. proc_pid_files_revalidate only needs to check if the tasks share files since it won't be called if it's not a symlink. Thanks for the review, -Jeff -- Jeff Mahoney SUSE Labs