From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:50270 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfAGQTQ (ORCPT ); Mon, 7 Jan 2019 11:19:16 -0500 Subject: Re: [PATCH 2/2] /proc/stat: Add sysctl parameter to control irq counts latency To: Matthew Wilcox Cc: Andrew Morton , Alexey Dobriyan , Luis Chamberlain , Kees Cook , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, Davidlohr Bueso , Miklos Szeredi , Daniel Colascione , Dave Chinner , Randy Dunlap References: <1546873978-27797-1-git-send-email-longman@redhat.com> <1546873978-27797-3-git-send-email-longman@redhat.com> <20190107155840.GY6310@bombadil.infradead.org> <20190107161442.GZ6310@bombadil.infradead.org> From: Waiman Long Message-ID: Date: Mon, 7 Jan 2019 11:19:14 -0500 MIME-Version: 1.0 In-Reply-To: <20190107161442.GZ6310@bombadil.infradead.org> 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 01/07/2019 11:14 AM, Matthew Wilcox wrote: > On Mon, Jan 07, 2019 at 11:07:47AM -0500, Waiman Long wrote: >>> Why are you caching the _output_ of calling sprintf(), rather than caching the >>> values of each interrupt? >>> >> It is just faster to dump the whole string buffer than redoing the >> number formatting each time when the values don't change. I can cache >> the individual sums instead if it is the preferred by most. > But it also consumes more memory. Can you gather some measurements to > find out what the performance difference is if you cache the values > instead of the strings? I allocate 11 bytes (10 digits + space) for each unsigned int IRQ value. I needs 4 bytes for the unsigned value itself. So it is a saving of 7 bytes. With 4k irqs, it will be 28k. I will run some measurements of caching the values versus saving the string later this week. Thanks, Longman