lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yzqary4Fi1sTHVSQ@hyeyoo>
Date:   Mon, 3 Oct 2022 17:17:51 +0900
From:   Hyeonggon Yoo <42.hyeyoo@...il.com>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Roman Gushchin <roman.gushchin@...ux.dev>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: slub: make slab_sysfs_init() a late_initcall

On Fri, Sep 30, 2022 at 12:27:12PM +0200, Rasmus Villemoes wrote:
> Currently, slab_sysfs_init() is an __initcall aka device_initcall. It
> is rather time-consuming; on my board it takes around 11ms. That's
> about 1% of the time budget I have from U-Boot letting go and until
> linux must assume responsibility of keeping the external watchdog
> happy.
> 
> There's no particular reason this would need to run at device_initcall
> time, so instead make it a late_initcall to allow vital functionality
> to get started a bit sooner.
> 
> This actually ends up winning more than just those 11ms, because the
> slab caches that get created during other device_initcalls (and before
> my watchdog device gets probed) now don't end up doing the somewhat
> expensive sysfs_slab_add() themselves. Some example lines (with
> initcall_debug set) before/after:
> 
> initcall ext4_init_fs+0x0/0x1ac returned 0 after 1386 usecs
> initcall journal_init+0x0/0x138 returned 0 after 517 usecs
> initcall init_fat_fs+0x0/0x68 returned 0 after 294 usecs
> 
> initcall ext4_init_fs+0x0/0x1ac returned 0 after 240 usecs
> initcall journal_init+0x0/0x138 returned 0 after 32 usecs
> initcall init_fat_fs+0x0/0x68 returned 0 after 18 usecs
> 
> Altogether, this means I now get to petting the watchdog around 17ms
> sooner. [Of course, the time the other initcalls save is instead spent
> in slab_sysfs_init(), which goes from 11ms to 16ms, so there's no
> overall change in boot time.]

This looks okay and just curious,
can you explain what kind of benefit does enabling watchdog early provides?

> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
> 
> The numbers certainly suggest that someone might want to look into
> making sysfs/kobject/kset perform better. But that would be way more
> complicated than this patch, and could not possibly achieve the same
> win as getting the sysfs_slab_add() overhead completely out of the
> way.
> 
> 
>  mm/slub.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 4b98dff9be8e..dade5c84a7bb 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6070,8 +6070,7 @@ static int __init slab_sysfs_init(void)
>  	mutex_unlock(&slab_mutex);
>  	return 0;
>  }
> -
> -__initcall(slab_sysfs_init);
> +late_initcall(slab_sysfs_init);
>  #endif /* CONFIG_SYSFS */
>  
>  #if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS)
> -- 
> 2.37.2

This is only deferring slub's sysfs initialization step (still before init process) 
So IIUC it shouldn't be serious.

-- 
Thanks,
Hyeonggon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ