Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp612279pxk; Thu, 24 Sep 2020 13:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh9cOp1yR/ibakYbJVqxw3702xh++1JqLKQYkLAptKBMQPts7Dur+owEbkH6xM4aiUppAo X-Received: by 2002:aa7:de82:: with SMTP id j2mr667640edv.3.1600980567439; Thu, 24 Sep 2020 13:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600980567; cv=none; d=google.com; s=arc-20160816; b=KUYjSbczO3f/z+QqcLNPMGptAgcN7MhAHQiK2FXC5/prSfqFT45rBSYK46yXddiFDw /bU+hZ1HQ7XCpSaDrxMwsGycJa1fEPvSidzOASerGd3Q51nzA9eYUszK6YZctrvLgX/D /3EyBGRu0X5o5jsIVeLSUyOZYTXhxZKdCUSfB6/f1tnhLtEDo8nyjrM0389Y3Eo8S4k7 qA9ydI3UivL0DK5zvpd+9cDbtfRqgro93PD5SGkoB8IaI/5YGKG98Bx2Jcpl5oOEmH9l +dfEbZAWxzIhdyRgTuc619sZ4efuDXXmE4eH5hD6xrGVks8PmreKzhLs5hbSjYbY2g7+ yEdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=dk7MMycD93MFAppfmYxAA4Gz9v+X6vnCCRANDZ4iZ7w=; b=FBRiXzb3ifwv/BJ8X9KK6tACIEv2eo7aojWU4Fz63VQcAJo9o9tVPDrwNJTlVwSmQr khYfydAv+mZCdfgc79LL7lt+LLn6SRLPxXaYqoC/A1gBa+EQ5b9t8StVU2HFRmMYEkbZ Av5kh4W88IHLsGzOsoy8q74Kst9Fkx4SGKB2N2CH4mDfdH5ZGJEx6Vxk8arZHjGlSsCf hY383wdDVRYlzTluZeiDmbNvmOv2901LP3/rvQip0hEAEb9jZzb8k5YAxGTlp3JwyYJi iBNHxG1oCeQR9CgBbgyenr3B/E9Za/gnS/nmZAW6UH3q064Sy0odwlg9Deds/spDWvv/ E1ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dWf495VG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si390022edl.408.2020.09.24.13.49.02; Thu, 24 Sep 2020 13:49:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dWf495VG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbgIXUsB (ORCPT + 99 others); Thu, 24 Sep 2020 16:48:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:44730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgIXUsB (ORCPT ); Thu, 24 Sep 2020 16:48:01 -0400 Received: from localhost (52.sub-72-107-123.myvzw.com [72.107.123.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DF20221EB; Thu, 24 Sep 2020 20:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600980480; bh=TDET0KJhptmVV4U8HQItYgWqOFf8omZjfxwMJ+5agMU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=dWf495VGJ3RD0bVS+U8XzYa7chztO2nbrjbuq6mP8pxvrgwyBakjREbEpiAH8iA/j q8RdZOWrBC9/rf8FUkAq2qFpo/Cj9bw0BIOgxEnOBR/3sb7m/9vewM6AHeKrcS4kr2 G6VvZMaqsuCzkjvm+htdbZuD0cV6fRN7kpswGxSQ= Date: Thu, 24 Sep 2020 15:47:59 -0500 From: Bjorn Helgaas To: Nitesh Narayan Lal Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, intel-wired-lan@lists.osuosl.org, frederic@kernel.org, mtosatti@redhat.com, sassmann@redhat.com, jesse.brandeburg@intel.com, lihong.yang@intel.com, jeffrey.t.kirsher@intel.com, jacob.e.keller@intel.com, jlelli@redhat.com, hch@infradead.org, bhelgaas@google.com, mike.marciniszyn@intel.com, dennis.dalessandro@intel.com, thomas.lendacky@amd.com, jerinj@marvell.com, mathias.nyman@intel.com, jiri@nvidia.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Subject: Re: [PATCH v2 1/4] sched/isolation: API to get housekeeping online CPUs Message-ID: <20200924204759.GA2342589@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200923181126.223766-2-nitesh@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 02:11:23PM -0400, Nitesh Narayan Lal wrote: > Introduce a new API hk_num_online_cpus(), that can be used to > retrieve the number of online housekeeping CPUs that are meant to handle > managed IRQ jobs. > > This API is introduced for the drivers that were previously relying only > on num_online_cpus() to determine the number of MSIX vectors to create. > In an RT environment with large isolated but fewer housekeeping CPUs this > was leading to a situation where an attempt to move all of the vectors > corresponding to isolated CPUs to housekeeping CPUs were failing due to > per CPU vector limit. > > Signed-off-by: Nitesh Narayan Lal > --- > include/linux/sched/isolation.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h > index cc9f393e2a70..2e96b626e02e 100644 > --- a/include/linux/sched/isolation.h > +++ b/include/linux/sched/isolation.h > @@ -57,4 +57,17 @@ static inline bool housekeeping_cpu(int cpu, enum hk_flags flags) > return true; > } > > +static inline unsigned int hk_num_online_cpus(void) > +{ > +#ifdef CONFIG_CPU_ISOLATION > + const struct cpumask *hk_mask; > + > + if (static_branch_unlikely(&housekeeping_overridden)) { > + hk_mask = housekeeping_cpumask(HK_FLAG_MANAGED_IRQ); > + return cpumask_weight(hk_mask); > + } > +#endif > + return cpumask_weight(cpu_online_mask); Just curious: why is this not #ifdef CONFIG_CPU_ISOLATION ... #endif return num_online_cpus(); > +} > + > #endif /* _LINUX_SCHED_ISOLATION_H */ > -- > 2.18.2 >