Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2487673imu; Tue, 6 Nov 2018 15:49:53 -0800 (PST) X-Google-Smtp-Source: AJdET5euo4I1T9LG4rLkGa3vc+aMQrP5wLYUiX4OxOipz9+wgOq5qdvTlDQxRBs5rp0q4Z3K9584 X-Received: by 2002:a17:902:7784:: with SMTP id o4-v6mr22117402pll.292.1541548193250; Tue, 06 Nov 2018 15:49:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541548193; cv=none; d=google.com; s=arc-20160816; b=P7pJGzJjZrlyGV5zGh950shVlvvdjtETyaenQxds8hfANqAgy5mif7rHNRLyc8GAjv tBtPVSg2bGADyTrItmZPJYzcROUDzrFJQjQkk8Q/m4VUDyyZ612anKJcecfBJl80JmiL vbcfgUroavpMpojKDw2hHknz+zBBw8wpOgWHC+xzRII18GCh/XIYlmfo2ojurGKGQVnU EZhi+5klejdGr5NuETUQmv1JlT30kRct/XkBQ1tBRXMw6r7q/rAF3oYAlIXHjbjTu1CE OjfO9fN15ot/5+RKHlUDRQvt1RCRXd7Gw60YmZGd80Yvo4/CmVcZ8qbmeo/Togn8NMUn Y4EA== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=tOSJWA3lxLvbPPXERd8TpOoCPjipvYQlQnRzSOntmBQ=; b=jBLcP84V8S6M7E1/4vwVcXtkLGQyZUq1I+r+8jW+HdMTGxvs84YXL1qffHrWNVxpkJ x1Cx8k3JN5gzDIsSoCWb16iXXoRdR5LG3b/5PI80Zq2lHywDcD6Kh937mCeMMm4KiINe QVOP0cTUbYzGNLF7qFEsK0w25u24n4llkkSeLTiARD6o6/gFd5RE/LMU1fw0Xj2zQgkX CqFgDCXgpfpSKMZR/Xxiw27wOmUCn7xTkl7Wzunu/O1o8ZOi3Kt6hNUaF0FIQtrxN87f HHI16y3lGGA2nDey25eMyQTIchxqqp9iPCwGAoQLTsowEee6hAPLohRKzDpty1Q2G2QX 4R3g== 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 k71si33707799pgd.351.2018.11.06.15.49.37; Tue, 06 Nov 2018 15:49:53 -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 S1730931AbeKGJQ2 (ORCPT + 99 others); Wed, 7 Nov 2018 04:16:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47846 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbeKGJQ1 (ORCPT ); Wed, 7 Nov 2018 04:16:27 -0500 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5D5B48F5; Tue, 6 Nov 2018 23:48:42 +0000 (UTC) Date: Tue, 6 Nov 2018 15:48:40 -0800 From: Andrew Morton To: Daniel Colascione Cc: 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: <20181106154840.3b448356214afa63dc8cb28c@linux-foundation.org> In-Reply-To: References: <20181029192521.23059-1-dave@stgolabs.net> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Yup. There are better ways of getting information out of the kernel, to say the least. It would be interesting to know precisely which stat fields the database-which-shall-not-be-named is looking for. Then we could cook up a very whizzy way of getting at the info. A downside of the stat2 approach is that applications will need to be rebuilt. And hopefully when people do this, they'll open "/etc/my-app-name/symlink-to-proc-stat" (or use per-application config) so they won't need a rebuild when we add /proc/stat3! A /proc/change-how-stat-works tunable would avoid the need to rebuild applications. But if a system still has some applications which want the irq info then that doesn't work. It's all very sad, really. btw, > +The stat2 file acts as a performance alternative to /proc/stat for workloads > +and systems that care and are under heavy irq load. In order to to be completely > +compatible, /proc/stat and /proc/stat2 are identical with the exception that the > +later will show 0 for any (hard)irq-related fields. This refers particularly "latter" > +to the "intr" line and 'irq' column for that aggregate in the cpu line. btw2, please quantify "poor performance". That helps us determine how much we care about all of this!