You are not logged in.

#1 2019-11-19 00:56:59

CyrIng
Member
From: France
Registered: 2010-07-17
Posts: 109
Website

CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON

Noticing in trunk/config that CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y , will this be the default setting for next Arch kernel release ?

By zeroing the slab allocations, those options have a performance impact. See kernel commit

Offline

#2 2019-11-19 01:53:57

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON

https://git.archlinux.org/svntogit/pack … c2c395f22f

# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set

hence is not on.  As the commit message you referenced and https://outflux.net/blog/archives/2019/ … inux-v5-3/ notes

The performance impact of the former under most workloads appears to be under 1%, if it’s measurable at all.

former being init_on_alloc.

Offline

#3 2019-11-19 10:20:18

CyrIng
Member
From: France
Registered: 2010-07-17
Posts: 109
Website

Re: CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON

I got it enable in trunk/config. So will it stay disable in repos/core-x86_64/config ...

What may cost in slab.c are the command line option conditions, even if staticaly built without CONFIG_INIT_ON_XXX

Such as:

if (unlikely(slab_want_init_on_alloc(flags, cachep)) && objp)
 		memset(objp, 0, cachep->object_size);
if (unlikely(slab_want_init_on_free(cachep)))
		memset(objp, 0, cachep->object_size);

Offline

#4 2019-11-19 15:51:49

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON

CyrIng wrote:

I got it enable in trunk/config. So will it stay disable in repos/core-x86_64/config ...

It is not in repos/core-x86_64 as there has been no new release since the change to trunk

CyrIng wrote:

What may cost in slab.c are the command line option conditions, even if staticaly built without CONFIG_INIT_ON_XXX

Such as:

if (unlikely(slab_want_init_on_alloc(flags, cachep)) && objp)
 		memset(objp, 0, cachep->object_size);
if (unlikely(slab_want_init_on_free(cachep)))
		memset(objp, 0, cachep->object_size);

You can benchmark with and without the following reverted so the functions you reference would never be called

-	if (mem_flags & __GFP_ZERO)
+	if (want_init_on_alloc(mem_flags))

and

+	if (want_init_on_free())
+		memset(vaddr, 0, pool->size);

Offline

#5 2019-11-21 20:57:12

CyrIng
Member
From: France
Registered: 2010-07-17
Posts: 109
Website

Re: CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON

As of version 5.3.12, linux/repos/core-x86_64/config now has the following definitions

CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set

To save a few cycles, I would have wished those macros conditionally compile or not the memset rather than branching.
https://elixir.bootlin.com/linux/latest … ab.c#L3259
https://elixir.bootlin.com/linux/latest … ub.c#L2746

Offline

#6 2019-11-21 21:19:20

loqs
Member
Registered: 2014-03-06
Posts: 18,928

Re: CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON

You could submit such a patch for that upstream.
How would you perform it though without removing support for the boot parameters init_on_alloc and init_on_free?

Offline

Board footer

Powered by FluxBB