From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942771AbdAJTZd (ORCPT ); Tue, 10 Jan 2017 14:25:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:54729 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932326AbdAJTYX (ORCPT ); Tue, 10 Jan 2017 14:24:23 -0500 Date: Tue, 10 Jan 2017 20:24:18 +0100 From: "Luis R. Rodriguez" To: "Luis R. Rodriguez" Cc: Petr Mladek , shuah@kernel.org, jeyu@redhat.com, rusty@rustcorp.com.au, ebiederm@xmission.com, dmitry.torokhov@gmail.com, acme@redhat.com, corbet@lwn.net, martin.wilck@suse.com, mmarek@suse.com, hare@suse.com, rwright@hpe.com, jeffm@suse.com, DSterba@suse.com, fdmanana@suse.com, neilb@suse.com, linux@roeck-us.net, rgoldwyn@suse.com, subashab@codeaurora.org, xypron.glpk@gmx.de, keescook@chromium.org, atomlin@redhat.com, mbenes@suse.cz, paulmck@linux.vnet.ibm.com, dan.j.williams@intel.com, jpoimboe@redhat.com, davem@davemloft.net, mingo@redhat.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 03/10] kmod: add dynamic max concurrent thread count Message-ID: <20170110192418.GH13946@wotan.suse.de> References: <20161208184801.1689-1-mcgrof@kernel.org> <20161208194814.2485-1-mcgrof@kernel.org> <20161214153827.GH16064@pathway.suse.cz> <20161216083956.GG13946@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161216083956.GG13946@wotan.suse.de> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 16, 2016 at 09:39:56AM +0100, Luis R. Rodriguez wrote: > On Wed, Dec 14, 2016 at 04:38:27PM +0100, Petr Mladek wrote: > > On Thu 2016-12-08 11:48:14, Luis R. Rodriguez wrote: > > > diff --git a/init/Kconfig b/init/Kconfig > > > index 271692a352f1..da2c25746937 100644 > > > --- a/init/Kconfig > > > +++ b/init/Kconfig > > > @@ -2111,6 +2111,29 @@ config TRIM_UNUSED_KSYMS > > > > > > If unsure, or if you need to build out-of-tree modules, say N. > > > > > > +config MAX_KMOD_CONCURRENT > > > + int "Max allowed concurrent request_module() calls (6=>64, 10=>1024)" > > > + range 0 14 > > > > Would not too small range break loading module dependencies? > > No, dependencies are resolved by depmod, so userspace looks at the list and > just finit_module() the depenencies, skipping kmod. So the limit is > really only for kernel acting like a boss. > > > I am not sure how it is implemented but it might require having > > some more module loads in progress. > > Dependencies should be OK, a more serious concern with dependencies is > the aggregate memory it takes to load all dep modules for one required > module since finit_module() ends up allocating the struct module to copy > over data from userspace. A simple change can enable us to bail out on finit_module() if a module is already present by looking at the passed userspace data. I have this change now but as discussed, whether or not its desirable should be a matter of whether or not in the typical case (bootup time) things improve. >>From some initial tests it would seem this doesn't help much but it does help with trying to load the same module over and over again, the explanation I can think of for this is by introducing a lookup on finit_module() we also delay module loading by the lookup time, in the general case we would not need this, so this is likely not worth merging. Will run some final tests to confirm. Luis