Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757341AbbDWCeu (ORCPT ); Wed, 22 Apr 2015 22:34:50 -0400 Received: from smtprelay0141.hostedemail.com ([216.40.44.141]:50992 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756181AbbDWCeo (ORCPT ); Wed, 22 Apr 2015 22:34:44 -0400 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:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2691:2693:2828:3138:3139:3140:3141:3142:3355:3622:3743:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4605:5007:6119:6261:7875:7903:8531:8603:10004:10400:10450:10455:10848:10967:11026:11232:11473:11658:11914:12296:12517:12519:12555:12740:13161:13229:14096:14097:19904:19999:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: box09_46344056af862 X-Filterd-Recvd-Size: 3752 Message-ID: <1429756481.32612.26.camel@perches.com> Subject: Re: [PATCH next] ocfs2: Reduce object size of mlog uses From: Joe Perches To: Andrew Morton Cc: Mark Fasheh , Joel Becker , ocfs2-devel@oss.oracle.com, LKML Date: Wed, 22 Apr 2015 19:34:41 -0700 In-Reply-To: <20150422154604.3cb62467b66b1e313a30132c@linux-foundation.org> References: <1429255070.2850.84.camel@perches.com> <20150422154604.3cb62467b66b1e313a30132c@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2963 Lines: 92 On Wed, 2015-04-22 at 15:46 -0700, Andrew Morton wrote: > On Fri, 17 Apr 2015 00:17:50 -0700 Joe Perches wrote: > > > Using a function for __mlog_printk instead of a macro > > reduces the object size of built-in.o more than 120KB, or > > ~10% overall (x86-64 defconfig with all ocfs2 options) > > > > $ size fs/ocfs2/built-in.o* > > text data bss dec hex filename > > 936255 118071 134408 1188734 12237e fs/ocfs2/built-in.o.new > > 1064081 118071 134408 1316560 1416d0 fs/ocfs2/built-in.o.old > > It's a start. > > > --- a/fs/ocfs2/cluster/masklog.c > > +++ b/fs/ocfs2/cluster/masklog.c > > @@ -64,6 +64,23 @@ static ssize_t mlog_mask_store(u64 mask, const char *buf, size_t count) > > return count; > > } > > > > +void __mlog_printk(const char *level, const char *func, int line, > > + const char *fmt, ...) > > +{ > > + struct va_format vaf; > > + va_list args; > > + > > + va_start(args, fmt); > > + > > + vaf.fmt = fmt; > > + vaf.va = &args; > > + > > + printk("%s(%s,%u,%lu):%s:%d %pV", > > + level, current->comm, task_pid_nr(current), __mlog_cpu_guess, > > + func, line, &vaf); > > + > > + va_end(args); > > +} > > Logging function-name and line-number was a bit weird. I wonder if > anyone will mind if this is converted to file-n-line, as God intended. > That will shrink rodata a bit, because number-of-files is a lot less > than number-of-functions. I don't care one way or another. Using __FILE__ vs __func__ reduces built-in.o by about 25K. I didn't bother to determine the actual total reduction in a vmlinux.o > > -#define mlog(mask, fmt, args...) do { \ > > +#define mlog(mask, fmt, ...) \ > > +do { \ > > u64 __m = MLOG_MASK_PREFIX | (mask); \ > > if ((__m & ML_ALLOWED_BITS) && \ > > __mlog_test_u64(__m, mlog_and_bits) && \ > > !__mlog_test_u64(__m, mlog_not_bits)) { \ > > if (__m & ML_ERROR) \ > All this goop can also be uninlined? You have to convert the level pointer to a u64 pointer passing &__m, but yeah, it's becomes about 65K smaller. The macro becomes simpler too as the (__m & ML_) tests go into the function. So that's another 7 or 8 % or more total shrinking. > I guess this patch is a step on the way - a 10% shrink is decent. But > I believe that with full uninlining of the ocfs2 logging code we can > shrink the filesystem's footprint by 50%. Nope. Even if CONFIG_PRINTK is not set and the mlog #define is a no-op, it's not quite that big a reduction. You have to turn the function tracing code off too for that 50%. > If you feel like undertaking such a rotorooting then go wild - that should > wake 'em up ;) One step at a time... -- 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/