From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbdHCROm (ORCPT ); Thu, 3 Aug 2017 13:14:42 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36546 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbdHCROl (ORCPT ); Thu, 3 Aug 2017 13:14:41 -0400 Date: Thu, 3 Aug 2017 19:14:29 +0200 From: Guillaume Knispel To: Davidlohr Bueso Cc: Andrew Morton , Manfred Spraul , Kees Cook , Alexey Dobriyan , "Eric W. Biederman" , "Peter Zijlstra (Intel)" , Ingo Molnar , Sebastian Andrzej Siewior , Serge Hallyn , Andrey Vagin , Marc Pardo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Message-ID: <20170803171429.GA2237@ubuntu> References: <20170731084237.GA123231@ubuntu> <20170802200644.GA2395@linux-80c1.suse> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170802200644.GA2395@linux-80c1.suse> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 02, 2017 at 01:06:44PM -0700, Davidlohr Bueso wrote: > On Mon, 31 Jul 2017, Guillaume Knispel wrote: > >static int __init ipc_init(void) > >{ > >- sem_init(); > >- msg_init(); > >+ int err_sem, err_msg; > >+ > >+ err_sem = sem_init(); > >+ WARN(err_sem, "ipc: sysV sem_init failed: %d\n", err_sem); > >+ err_msg = msg_init(); > >+ WARN(err_msg, "ipc: sysV msg_init failed: %d\n", err_msg); > > shm_init(); > > This shows the ugliness of the underlying ipc init asymmetry. Specifically, > 140d0b2108f (Do 'shm_init_ns()' in an early pure_initcall) was the final > nail in the coffin to fix an exit_shm() race. > > While normally we could just initialize the ipc_ids fields statically and > be over with initcall dependencies, your patch will require inits be done > dynamically for the rhashtable_init(). Oh well. > > Also, why do you do this? > > >-pure_initcall(ipc_ns_init); > >+core_initcall(ipc_ns_init); In linux/init.h I saw that a pure_initcall is reserved to only initialize variables and must have no dependency on anything else; I interpreted that, + "pure" in the name, thinking we should not e.g. allocate in a pure_initcall, however I see that net_ns_init() calls kmem_cache_create() and others, so maybe we can keep ipc_ns_init() as a pure_initcall? Guillaume