Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755983Ab3CPRyw (ORCPT ); Sat, 16 Mar 2013 13:54:52 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:41746 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752154Ab3CPRyv (ORCPT ); Sat, 16 Mar 2013 13:54:51 -0400 Date: Sat, 16 Mar 2013 17:54:47 +0000 From: Al Viro To: Joe Perches Cc: Andrew Morton , Steven Rostedt , LKML Subject: Re: [RFC PATCH] seq_file: Use seq_puts when seq_printf has only a format with no args Message-ID: <20130316175446.GA21522@ZenIV.linux.org.uk> References: <1363441844.2023.17.camel@joe-AO722> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1363441844.2023.17.camel@joe-AO722> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1435 Lines: 31 On Sat, Mar 16, 2013 at 06:50:44AM -0700, Joe Perches wrote: > Instead of converting the 800 or so uses of seq_printf with > a constant format (without a % substitution) to seq_puts, > maybe there's another way to slightly speed up these outputs. > > Taking a similar approach to commit abd84d60eb > ("tracing: Optimize trace_printk() with one arg to use trace_puts()") > use the preprocessor to convert seq_printf(seq, "string constant") > to seq_puts(seq, "string constant") > > By stringifying __VA_ARGS__, we can, at compile time, determine > the number of args that are being passed to seq_printf() and > call seq_puts or seq_printf appropriately. > > The actual function definition for seq_printf must now > be enclosed in parenthesis to avoid further macro expansion. Joe, would you mind showing me a single real-world case where that "optimization" would really matter? Adding a module that would produce a seq_file in procfs, with contents generated by something like for(i = 0; i < 4000; i++) seq_printf(m, "a"); and application that would keep reading that file in a loop does not count, TYVM. Until then, NAKed-by: Al Viro NAKed-because: GAFL -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/