From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756998AbcIUMX6 (ORCPT ); Wed, 21 Sep 2016 08:23:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50460 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756883AbcIUMX4 (ORCPT ); Wed, 21 Sep 2016 08:23:56 -0400 Date: Wed, 21 Sep 2016 14:29:44 +0200 From: Alexander Gordeev To: Christoph Hellwig Cc: axboe@fb.com, tglx@linutronix.de, keith.busch@intel.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/13] genirq/affinity: Provide smarter irq spreading infrastructure Message-ID: <20160921122943.GE26808@agordeev.lab.eng.brq.redhat.com> References: <1473862739-15032-1-git-send-email-hch@lst.de> <1473862739-15032-3-git-send-email-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1473862739-15032-3-git-send-email-hch@lst.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 21 Sep 2016 12:23:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 14, 2016 at 04:18:48PM +0200, Christoph Hellwig wrote: > +/** > + * irq_calc_affinity_vectors - Calculate to optimal number of vectors for a given affinity mask > + * @affinity: The affinity mask to spread. If NULL cpu_online_mask > + * is used > + * @maxvec: The maximum number of vectors available > + */ > +int irq_calc_affinity_vectors(const struct cpumask *affinity, int maxvec) > +{ > + int cpus, ret; > + > + /* Stabilize the cpumasks */ > + get_online_cpus(); > + /* If the supplied affinity mask is NULL, use cpu online mask */ > + if (!affinity) > + affinity = cpu_online_mask; > + > + cpus = cpumask_weight(affinity); Should not we consider the result of AND of affinity and cpu_online_mask? > + ret = (cpus < maxvec) ? cpus : maxvec; > + > + put_online_cpus(); > + return ret; > +} > + > static int get_first_sibling(unsigned int cpu) > { > unsigned int ret; > -- > 2.1.4 >