Messages in this thread | | | Date | Mon, 11 Jun 2012 10:04:58 -0500 (CDT) | From | Christoph Lameter <> | Subject | Re: [PATCH 1/4] slub: change declare of get_slab() to inline at all times |
| |
On Sun, 10 Jun 2012, JoonSoo Kim wrote:
> 2012/6/9 Christoph Lameter <cl@linux.com>: > > On Sat, 9 Jun 2012, Joonsoo Kim wrote: > > > >> -static struct kmem_cache *get_slab(size_t size, gfp_t flags) > >> +static __always_inline struct kmem_cache *get_slab(size_t size, gfp_t flags) > > > > I thought that the compiler felt totally free to inline static functions > > at will? This may be a matter of compiler optimization settings. I can > > understand the use of always_inline in a header file but why in a .c file? > > Yes, but the compiler with -O2 doesn't inline get_slab() which > declared just 'static'. > I think that inlining get_slab() have a performance benefit, so add > '__always_inline' to declare of get_slab(). > Other functions like slab_alloc, slab_free also use 'always_inline' in > .c file (slub.c)
Yea I thought about removing those since I would think that the compiler should be doing the right thing.
Does gcc inline with higher optimization settings?
| |