From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:56886 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbeJ3Fv5 (ORCPT ); Tue, 30 Oct 2018 01:51:57 -0400 Subject: Re: [PATCH] fs/proc: introduce /proc/stat2 file To: Davidlohr Bueso , akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso References: <20181029192521.23059-1-dave@stgolabs.net> From: Waiman Long Message-ID: <65a3a4b8-bb7b-5cb2-3f50-af4b2717f81d@redhat.com> Date: Mon, 29 Oct 2018 17:01:32 -0400 MIME-Version: 1.0 In-Reply-To: <20181029192521.23059-1-dave@stgolabs.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 10/29/2018 03:25 PM, Davidlohr Bueso wrote: > A recent report from a large database vendor which I shall not name > shows concerns about poor performance when consuming /proc/stat info. > Particularly kstat_irq() pops up in the profiles and most time is > being spent there. The overall system is under a lot of irqs and > almost 1k cores, thus this comes to little surprise. > > Granted that procfs in general is not known for its performance, > nor designed for it, for that matter. Some users, however may be able > to overcome this performance limitation, some not. Therefore it isn't > bad having a kernel option for users that don't want any hard irq info > -- and care enough about this. > > 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. > > The stat file is not touched, of course -- this was also previously > suggested by Waiman: > https://lore.kernel.org/lkml/1524166562-5644-1-git-send-email-longman@redhat.com/ > > Signed-off-by: Davidlohr Bueso > --- > Documentation/filesystems/proc.txt | 12 +++++++--- > fs/proc/stat.c | 45 ++++++++++++++++++++++++++++++++------ > 2 files changed, 47 insertions(+), 10 deletions(-) > > diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt > index 12a5e6e693b6..563b01decb1e 100644 > --- a/Documentation/filesystems/proc.txt > +++ b/Documentation/filesystems/proc.txt > @@ -27,7 +27,7 @@ Table of Contents > 1.5 SCSI info > 1.6 Parallel port info in /proc/parport > 1.7 TTY info in /proc/tty > - 1.8 Miscellaneous kernel statistics in /proc/stat > + 1.8 Miscellaneous kernel statistics in /proc/stat and /proc/stat2 > 1.9 Ext4 file system parameters > > 2 Modifying System Parameters > @@ -140,6 +140,7 @@ Table 1-1: Process specific entries in /proc > mem Memory held by this process > root Link to the root directory of this process > stat Process status > + stat2 Process status without irq information > statm Process memory status information > status Process status in human readable form > wchan Present with CONFIG_KALLSYMS=y: it shows the kernel function > @@ -1301,8 +1302,8 @@ To see which tty's are currently in use, you can simply look into the file > unknown /dev/tty 4 1-63 console > > > -1.8 Miscellaneous kernel statistics in /proc/stat > -------------------------------------------------- > +1.8 Miscellaneous kernel statistics in /proc/stat and /proc/stat2 > +----------------------------------------------------------------- > > Various pieces of information about kernel activity are available in the > /proc/stat file. All of the numbers reported in this file are aggregates > @@ -1371,6 +1372,11 @@ of the possible system softirqs. The first column is the total of all > softirqs serviced; each subsequent column is the total for that particular > softirq. > > +The stat2 file acts as a performance alternative to /proc/stat for workloads A "performant alternative", right? -Longman