Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7406863imm; Tue, 28 Aug 2018 11:28:04 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaxMhM8Iju1PRsjeSb6ATCEqqJiv/d06t3tEjWTMR0Nb/ZPrEkL0EzDyms4QBJKA7cFkmkj X-Received: by 2002:a63:b914:: with SMTP id z20-v6mr2599362pge.396.1535480884413; Tue, 28 Aug 2018 11:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535480884; cv=none; d=google.com; s=arc-20160816; b=vc+mqE9N35dS3lPhr+HaNwyT/b37h1CmvJKplzePBcz9S43DZw4eS2QfRCYj5emblH uEAg34Kx7G9hNYDYXnVvepj99ardUEYaNw67ZMvwzyjT+AMRGVMix4sW/u5LNGGbW8bh xtJ6cRT5+RueUknsy5J6GFk017nkOZzFpeNRHYq5RNWmQEif+9+WRk5+ZLnMFUIR2py2 CXUtcSoK30rU7odmBgjNkuJECT3OQ8G8HM6H7zoe3YRi1RYzdr7Ed5cUMFX1eyLPe1DB BfaBE9Mg7EL22ayLXx/tk3r0kWuLEWirgjhDFj5rtbYIxJg/v/mlTWayE68Hw6Q2vZ// TP0w== 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:date:cc:to:from:subject:message-id :arc-authentication-results; bh=ow9XDq4BQlWFWnnApx2rW339uYvYruBfvh7qT7LjZL0=; b=beJls+nspo4AojqMy810Zwq5nwZ4cEh6xtnJ79TDzqlc+wlsQuxNn6gvudgn0djEfc vC18FnZFBZvEuOX2IYzVaY87g+ILwT2A6mfVwHej/jZSVWzTopA6kyHEFjlARjFFFbiE gLkgsnvtPugUDiRCc8AyoWY0TXz/BzjXcUvt+ONba9CHKYnk1ygR3ojcH8VdxuCR4drC dug9Qxnpc9brklkKquO0BZ1CrcqOwBhijua/a1jAU0saomdhPZMtvXHWeuhHQm3yPZ45 KxwxnkWiSOmHSpmAp3ZtNbAtmsmbwu6mInxvZDCLt8bZyK7vyF1hSi/wC3nem6DyMbfR rwUw== 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 d20-v6si1596733pgj.535.2018.08.28.11.27.23; Tue, 28 Aug 2018 11:28:04 -0700 (PDT) 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 S1727130AbeH1WRb (ORCPT + 99 others); Tue, 28 Aug 2018 18:17:31 -0400 Received: from smtprelay0126.hostedemail.com ([216.40.44.126]:34081 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726383AbeH1WRb (ORCPT ); Tue, 28 Aug 2018 18:17:31 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id CABAC181D341D; Tue, 28 Aug 2018 18:24:37 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2740:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3868:3871:4321:4605:5007:6119:7514:8603:9040:10004:10400:10848:11026:11232:11658:11914:12296:12555:12740:12760:12895:12986:13069:13311:13357:13439:14096:14097:14181:14659:14721:21080:21451:21611:21627:30054:30091,0,RBL:172.56.41.215:@perches.com:.lbl8.mailshell.net-62.8.0.180 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:32,LUA_SUMMARY:none X-HE-Tag: rub94_626d1bed7d363 X-Filterd-Recvd-Size: 1722 Received: from XPS-9350 (unknown [172.56.41.215]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Tue, 28 Aug 2018 18:24:36 +0000 (UTC) Message-ID: <9229927125ab9d36bd38cf0c20fb5dfb45802fcb.camel@perches.com> Subject: Re: [PATCH 01/13] seq_file: rewrite seq_puts() in terms of seq_write() From: Joe Perches To: Alexey Dobriyan , akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org Date: Tue, 28 Aug 2018 11:24:34 -0700 In-Reply-To: <20180827231503.26899-1-adobriyan@gmail.com> References: <20180827231503.26899-1-adobriyan@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-08-28 at 02:14 +0300, Alexey Dobriyan wrote: > Space savings -- 42 bytes! > > seq_puts 71 29 [-42] > > Signed-off-by: Alexey Dobriyan > --- > fs/seq_file.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/fs/seq_file.c b/fs/seq_file.c > index 1dea7a8a5255..0c282a88a896 100644 > --- a/fs/seq_file.c > +++ b/fs/seq_file.c > @@ -653,14 +653,7 @@ EXPORT_SYMBOL(seq_putc); > > void seq_puts(struct seq_file *m, const char *s) > { > - int len = strlen(s); > - > - if (m->count + len >= m->size) { > - seq_set_overflow(m); > - return; > - } > - memcpy(m->buf + m->count, s, len); > - m->count += len; > + seq_write(m, s, strlen(s)); > } > EXPORT_SYMBOL(seq_puts); > If execution speed is really an issue, as almost all of the uses are for const strings, why not use a #define and avoid the runtime cost of strlen where possible.