From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751529AbcHGBfh (ORCPT ); Sat, 6 Aug 2016 21:35:37 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:38354 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbcHGBfg (ORCPT ); Sat, 6 Aug 2016 21:35:36 -0400 Date: Sun, 7 Aug 2016 02:35:13 +0100 From: Al Viro To: Alexey Dobriyan Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] proc: much faster /proc/vmstat Message-ID: <20160807013510.GM2356@ZenIV.linux.org.uk> References: <20160806125455.GA1187@p183.telecom.by> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160806125455.GA1187@p183.telecom.by> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 06, 2016 at 03:54:56PM +0300, Alexey Dobriyan wrote: [sprintf sucks, let's convert numbers manually] > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -1592,7 +1592,10 @@ static int vmstat_show(struct seq_file *m, void *arg) > { > unsigned long *l = arg; > unsigned long off = l - (unsigned long *)m->private; > - seq_printf(m, "%s %lu\n", vmstat_text[off], *l); > + > + seq_puts(m, vmstat_text[off]); > + seq_put_decimal_ull(m, ' ', *l); > + seq_putc(m, '\n'); > return 0; > } If that manages to be a hotspot, we really should * educate the wankers responsible for the userland code in question, until they repent and cease committing such abominations. * look into fixing vsnprintf(). Seriously, what the hell is vsnprintf() doing that takes so much time? It's not as if it was a complex format anyway. WTF is going on there? Where is it spending that much time?