From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Herrmann Subject: Re: [PATCH] kvmtool: Add parameter to specifiy number of threads in thread_pool Date: Mon, 29 Jun 2015 12:14:02 +0200 Message-ID: <20150629101402.GA3379@alberich> References: <20150629074544.GA15313@alberich> <20150629094502.GA17474@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: "kvm@vger.kernel.org" To: Will Deacon Return-path: Received: from mail-bn1bon0084.outbound.protection.outlook.com ([157.56.111.84]:52096 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752154AbbF2KOS (ORCPT ); Mon, 29 Jun 2015 06:14:18 -0400 Content-Disposition: inline In-Reply-To: <20150629094502.GA17474@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jun 29, 2015 at 10:45:03AM +0100, Will Deacon wrote: > On Mon, Jun 29, 2015 at 08:45:44AM +0100, Andreas Herrmann wrote: > > > > With current code the number of threads added to the thread_pool > > equals number of online CPUs. Thus on an OcteonIII cn78xx system we > > usually have 48 threads per guest just for the thread_pool. IMHO this > > is overkill for guests that just have a few vCPUs and/or if a guest is > > pinned to a subset of host CPUs. E.g. > > > > # numactl -C 4,5,7,8 ./lkvm run -c 2 -m 256 -k paravirt -d rootfs.ext3 ... > > # ps -La | grep threadpool-work | wc -l > > 48 > > > > Don't change default behaviour (for sake of compatibility) but > > introduce a new parameter ("-t" or "--threads") that allows to specify > > number of threads to be created for the thread_pool: > > > > # numactl -C 4,5,7,8 ./lkvm run -c 2 -m 256 --threads 4 -k paravirt -d ... > > # ps -La | grep threadpool-work | wc -l > > 4 > > We should probably bound this on some minimum value. I assume things go > pear-shaped if you pass --threads 1 (or 0, or -1)? Ouch, yes, range must be checked (esp. for -1). I think the passed value should be in [1, number of online CPUs]. Andreas