From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: [PATCH 1/2] kvm: use modern cpumask primitives, no cpumask_t on stack Date: Mon, 8 Dec 2008 16:38:07 +1030 Message-ID: <200812081638.07526.rusty@rustcorp.com.au> References: <200812072125.14416.rusty@rustcorp.com.au> <493BF144.9080106@redhat.com> <493BF648.6060504@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: "kvm-devel" , linux-kernel@vger.kernel.org, Mike Travis To: Avi Kivity Return-path: Received: from ozlabs.org ([203.10.76.45]:57349 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbYLHGIN (ORCPT ); Mon, 8 Dec 2008 01:08:13 -0500 In-Reply-To: <493BF648.6060504@redhat.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Monday 08 December 2008 02:44:00 Avi Kivity wrote: > Avi Kivity wrote: > > Rusty Russell wrote: > >> We're getting rid on on-stack cpumasks for large NR_CPUS. > >> > >> 1) Use cpumask_var_t and alloc_cpumask_var (a noop normally). Fallback > >> code is inefficient but never happens in practice. > > > > Wow, code duplication from Rusty. Things must be bad. > > > > Since we're in a get_cpu() here, how about a per_cpu static cpumask > > instead? I don't mind the inefficient fallback, just the duplication. > > > > Btw, for the general case, instead of forcing everyone to duplicate, how > about: > > cpumask_var_t cpus; > > with_cpumask(cpus) { > ... code to populate cpus > smp_call_function_some(...); > } end_with_cpumask(cpus); > > Where with_cpumask() allocates cpus, and uses a mutex + static fallback > on failure. I'd prefer not to hide deadlocks that way :( I'll re-battle with that code to neaten it. There are only a few places which have these kind of issues. Thanks, Rusty.