Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1319478pxk; Fri, 25 Sep 2020 11:31:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRVspSZXuplOXaN2P50eFmPrqlcn4tg/DphMXYxjW5a8MCXEXxf4suqguvy0gOXSacWglx X-Received: by 2002:a50:88c6:: with SMTP id d64mr2774343edd.141.1601058713709; Fri, 25 Sep 2020 11:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601058713; cv=none; d=google.com; s=arc-20160816; b=gdB0WLPgtEVg25JKaLTMTD6YPiaBWVG3ZN948YhKnvyuF8Un/RNmPkkjWaiD+29iUT q3QzZV56a0sDvb/b/NJWfr6wzehsRk2gXeGwXh4TgSi3KLsk4FOaAbkJGHQgiP/bXmtI 1R0KfHuDQHIool8YA/afiKFYqbzuE494wRUgNtLX8oh2lvg5riKcHgxPpCGRMsdYS/Ao GzMsSXLh0xsWjkx8lhjbOf6v4mWy3Kxp+k7WwOH3ws6iatbOUx8sEYoPXcG9hCmtrCqY b00sdPl5nqm5TpkiJftrJ5464im+ZDChMYc26zikNI1mmNLR6EkCH5syIH1V0H/+ZeF+ eABw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature; bh=iL0bUDw4mzTbRn0mPQir1H2iMDlMMQuuu3RzcEtjrtI=; b=joVql1WaQm/MIGXL+NFQEFVrO5FT68c7ofAtHFAwiSyPIPLZtMd2Z6iROFvGy0fUhJ ap37tTN8QZbgFVawog1eXOefQt5k9MYPkx5bTaO85+9p8Skzbypmpwa0EPkcEv61Xmpq vlpuomBGrsc6z8DQE9TvDZVzTpomU7PaAo7poZ9X80oSfdiXWj+u6rRfZE4ovGd1WarV o8qfXLgweex3kMl+m57swkFjYjDl+CCm0t4U5kfsTjbu4MFG4zxCIeBPR6SAB1JgerwR X4rlAEuKuiziMSVU7eXPXpEi5zGHyEQXXghyweW5g4K3wkWq2ES0DXa8TeEYumIm4CK9 LECg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dgpuCv+8; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si2594882edw.41.2020.09.25.11.31.30; Fri, 25 Sep 2020 11:31:53 -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=@redhat.com header.s=mimecast20190719 header.b=dgpuCv+8; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729737AbgIYS1O (ORCPT + 99 others); Fri, 25 Sep 2020 14:27:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46069 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729726AbgIYS1M (ORCPT ); Fri, 25 Sep 2020 14:27:12 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601058431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=iL0bUDw4mzTbRn0mPQir1H2iMDlMMQuuu3RzcEtjrtI=; b=dgpuCv+8dB6wxiu6EDvBDFqYvs+Rq3+h90h6S8oZKWh4C/vW4cToCXEsoX9c2pGZfSAYRL jENKoGxIRlnx/rIwWT3xHoXe7VhHC43uS1MhGs8fgWudsRXxLSjj79FUYg0/S+ASKv7wd6 VTxUxugKJTtsaGKv199QuVinsdoawm8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-wptPqlM6OdSLHFgjXOJGwA-1; Fri, 25 Sep 2020 14:27:07 -0400 X-MC-Unique: wptPqlM6OdSLHFgjXOJGwA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B23E1084C97; Fri, 25 Sep 2020 18:27:05 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA0A578831; Fri, 25 Sep 2020 18:27:03 +0000 (UTC) From: Nitesh Narayan Lal To: 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, helgaas@kernel.org, nitesh@redhat.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, jiri@nvidia.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, lgoncalv@redhat.com Subject: [PATCH v3 1/4] sched/isolation: API to get number of housekeeping CPUs Date: Fri, 25 Sep 2020 14:26:51 -0400 Message-Id: <20200925182654.224004-2-nitesh@redhat.com> In-Reply-To: <20200925182654.224004-1-nitesh@redhat.com> References: <20200925182654.224004-1-nitesh@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a new API housekeeping_num_online_cpus(), that can be used to retrieve the number of online housekeeping CPUs based on the housekeeping flag passed by the caller. Some of the consumers for this API are the device drivers that were previously relying only on num_online_cpus() to determine the number of MSIX vectors to create. In real-time environments to minimize interruptions to isolated CPUs, all device-specific IRQ vectors are often moved to the housekeeping CPUs, having excess vectors could cause housekeeping CPU to run out of IRQ vectors. Signed-off-by: Nitesh Narayan Lal --- include/linux/sched/isolation.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h index cc9f393e2a70..e021b1846c1d 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -57,4 +57,13 @@ static inline bool housekeeping_cpu(int cpu, enum hk_flags flags) return true; } +static inline unsigned int housekeeping_num_online_cpus(enum hk_flags flags) +{ +#ifdef CONFIG_CPU_ISOLATION + if (static_branch_unlikely(&housekeeping_overridden)) + return cpumask_weight(housekeeping_cpumask(flags)); +#endif + return num_online_cpus(); +} + #endif /* _LINUX_SCHED_ISOLATION_H */ -- 2.18.2