Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp318059imu; Wed, 7 Nov 2018 18:08:33 -0800 (PST) X-Google-Smtp-Source: AJdET5dy5yOrrE08a8yh5dNEmLfpGFEZjAlSHi7bvrCEN2l4SgG7kuCH4TzJcJHJmI+YQumMHvhG X-Received: by 2002:a62:43cd:: with SMTP id l74-v6mr2812561pfi.240.1541642913216; Wed, 07 Nov 2018 18:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541642913; cv=none; d=google.com; s=arc-20160816; b=IuuyaN9oKmaRkfdwSF/T4qJHXWLBzlbw/aOTE49sRN73bY2AdFRGPAymaLxkC2Dhy0 BcfF9CIeSvUAq7dcSlF7kQkNUx+2BseOlpR4BC3jPL5CUxvICU8etilPi1fga/nwwneZ WrI47qOe2IauK7E074SL6RpGN8ltnqcBQE4s6JYU/GVKEox47U23xBe0rRyRBHgC353x WwE+Ic8k8Uwn9eLg+wk6lyGI93YAXlXR2+zgRyAb9qfUKaxMIGhNx2T1VzKYsa5kg2Xp ULtoz4jzFpUnuO51LLw8FFnJIKp+x8ddpI1IJLsewRDB5u7LL3JDaJgPxL1tXzUfIeR7 nCCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OA4JHbJQeub3nrMAYaki/bgiFLuliwAMaSRQ8M+ISVw=; b=C1QeFTriOr50PmDN6jhdCVBtSbvXSKXwJpiniGJ3GK510Tj01eBXaA4msNd9wuGWKj 4FoB8Mck1CheHXSymOPQOV0KZN/cRjf3aO46mbK4xaIGBgf0zBJZLxr6MfATMsO9CgGs jS3y12tqwcSpOYdXsukTavLc/GWtnAYedciSs9XbaRMFd5Kjth0LKwLaT0niFelsVNTi ITFMDJSr3UfoqwnyLSsN7zicFML1tP/smNPtdPCsLE8Dpim5Md6x8sqwW3Tj8dCtt5Bm 5haam53bVBq20SdsC6pnYkOS5dNjXr/vWlitGEk3TnQ1xdHO1i0WvMqkMZogZJJg3ZTJ MxBg== 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 y73si2185960pgd.478.2018.11.07.18.08.17; Wed, 07 Nov 2018 18:08:33 -0800 (PST) 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 S1728572AbeKHLlD (ORCPT + 99 others); Thu, 8 Nov 2018 06:41:03 -0500 Received: from ipmail01.adl6.internode.on.net ([150.101.137.136]:58236 "EHLO ipmail01.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728460AbeKHLlD (ORCPT ); Thu, 8 Nov 2018 06:41:03 -0500 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail01.adl6.internode.on.net with ESMTP; 08 Nov 2018 12:37:51 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1gKZja-0000rf-Bk; Thu, 08 Nov 2018 13:07:50 +1100 Date: Thu, 8 Nov 2018 13:07:50 +1100 From: Dave Chinner To: Miklos Szeredi Cc: Andrew Morton , Daniel Colascione , Davidlohr Bueso , longman@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel , Davidlohr Bueso Subject: Re: [PATCH] fs/proc: introduce /proc/stat2 file Message-ID: <20181108020750.GZ6311@dastard> References: <20181029192521.23059-1-dave@stgolabs.net> <20181106154840.3b448356214afa63dc8cb28c@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 11:03:06AM +0100, Miklos Szeredi wrote: > On Wed, Nov 7, 2018 at 12:48 AM, Andrew Morton > wrote: > > On Mon, 29 Oct 2018 23:04:45 +0000 Daniel Colascione wrote: > > > >> On Mon, Oct 29, 2018 at 7:25 PM, Davidlohr Bueso wrote: > >> > This patch introduces a new /proc/stat2 file that is identical to the > >> > regular 'stat' except that it zeroes all hard irq statistics. The new > >> > file is a drop in replacement to stat for users that need performance. > >> > >> For a while now, I've been thinking over ways to improve the > >> performance of collecting various bits of kernel information. I don't > >> think that a proliferation of special-purpose named bag-of-fields file > >> variants is the right answer, because even if you add a few info-file > >> variants, you're still left with a situation where a given file > >> provides a particular caller with too little or too much information. > >> I'd much rather move to a model in which userspace *explicitly* tells > >> the kernel which fields it wants, with the kernel replying with just > >> those particular fields, maybe in their raw binary representations. > >> The ASCII-text bag-of-everything files would remain available for > >> ad-hoc and non-performance critical use, but programs that cared about > >> performance would have an efficient bypass. One concrete approach is > >> to let users open up today's proc files and, instead of read(2)ing a > >> text blob, use an ioctl to retrieve specified and targeted information > >> of the sort that would normally be encoded in the text blob. Because > >> callers would open the same file when using either the text or binary > >> interfaces, little would have to change, and it'd be easy to implement > >> fallbacks when a particular system doesn't support a particular > >> fast-path ioctl. > > Please. Sysfs, with the one value per file rule, was created exactly > for the purpose of eliminating these sort of problems with procfs. So > instead of inventing special purpose interfaces for proc, just make > the info available in sysfs, if not already available. This doesn't solve the problem. The problem is that this specific implementation of per-cpu counters need to be summed on every read. Hence when you have a huge number of CPUs each per-cpu iteration that takes a substantial amount of time. If only we had percpu counters that had a fixed, extremely low read overhead that doesn't care about the number of CPUs in the machine.... Oh, wait, we do: percpu_counters.[ch]. This all seems like a counter implementation deficiency to me, not an interface problem... Cheers, Dave. -- Dave Chinner david@fromorbit.com