From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754798Ab0JNHJr (ORCPT ); Thu, 14 Oct 2010 03:09:47 -0400 Received: from freeflow.nu ([178.79.134.28]:45023 "EHLO freeflow.nu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752262Ab0JNHJq (ORCPT ); Thu, 14 Oct 2010 03:09:46 -0400 Message-ID: <4CB6ACB7.8060006@kernel.org> Date: Thu, 14 Oct 2010 10:09:43 +0300 From: Pekka Enberg User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Richard Kennedy CC: Christoph Lameter , lkml , linux-mm , Steven Rostedt Subject: Re: [PATCH] [RFC] slub tracing: move trace calls out of always inlined functions to reduce kernel code size References: <1286986178.1901.60.camel@castor.rsk> In-Reply-To: <1286986178.1901.60.camel@castor.rsk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/10 7:09 PM, Richard Kennedy wrote: > Having the trace calls defined in the always inlined kmalloc functions > in include/linux/slub_def.h causes a lot of code duplication as the > trace functions get instantiated for each kamalloc call site. This can > simply be removed by pushing the trace calls down into the functions in > slub.c. > > On my x86_64 built this patch shrinks the code size of the kernel by > approx 29K and also shrinks the code size of many modules -- too many to > list here ;) > > size vmlinux.o reports > text data bss dec hex filename > 4777011 602052 763072 6142135 5db8b7 vmlinux.o > 4747120 602388 763072 6112580 5d4544 vmlinux.o.patch Impressive kernel text savings! > index 13fffe1..32b89ee 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > +void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) > +{ > + void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); > + > + kmemleak_alloc(ret, size, 1, flags); > + trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE<< order, flags); > + > + return ret; > +} > +EXPORT_SYMBOL(kmalloc_order); > + This doesn't make sense to be out-of-line for the !CONFIG_TRACE case. I'd just wrap that with "#ifdef CONFIG_TRACE" and put an inline version in the header for !TRACE. Pekka