From: Ian Campbell Subject: Re: [PATCH v3 03/13] xen: introduce cpumask_from_bitmap Date: Thu, 25 Apr 2013 11:01:12 +0100 Message-ID: <1366884072.20256.448.camel@zakaz.uk.xensource.com> References: <1366830463-12153-3-git-send-email-stefano.stabellini@eu.citrix.com> <5179127802000078000D0A0D@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5179127802000078000D0A0D@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Julien Grall , "Tim (Xen.org)" , xen-devel , "Keir (Xen.org)" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 2013-04-25 at 10:24 +0100, Jan Beulich wrote: > >>> On 24.04.13 at 21:07, Stefano Stabellini wrote: > > +static inline cpumask_t cpumask_from_bitmap(unsigned long *bits, int nr_bits) > > +{ > > + cpumask_t mask; > > + int len = nr_bits < nr_cpumask_bits ? nr_bits : nr_cpumask_bits; > > min(nr_bits, nr_cpumask_bits) > > > + > > + memset(&mask, 0x00, sizeof(mask)); > > bitmap_zero(). > > > + bitmap_copy(mask.bits, bits, len); > > Hard tab. > > > + > > + return mask; > > +} > > And most importantly: Why? This isn't an operation that should > commonly be done, and hence having a utility function for this > seems to invite for abuse rather than really help. I suggested it, we are emulating an instruction which provides a bitmap of the CPUs to operate on. It seemed nicer to me to have a helper rather than to open-code accesses under the hood of the cpumask interface. Ian.