Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3229021pxk; Mon, 28 Sep 2020 11:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIw7zDbcU+GsZzri4XJHFdjqCrQyYkiQWE8hSAejj09WmqP2MVPg7LignPQMNBvDiA284/ X-Received: by 2002:a05:6402:2d9:: with SMTP id b25mr3344134edx.131.1601318270307; Mon, 28 Sep 2020 11:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601318270; cv=none; d=google.com; s=arc-20160816; b=dZkgoCIanBLl+4kHYgW+woZ9uKl1PTVwrNpsPoZigsmza3Ce4n9u10rcNNuGnDzzLo Pgj/ik3ybQNlvcaeOc3/it73GsjFyi8UkrCYQm1ffWxc6TVf5dxyG37phZSsT6d4UDOe 8P1Iov41duB4kVV3Asck6DthCTD0dcxqk817TT2ApatvLbA2W4SLEba1rwXBqyzZPoxR nMl2r92JfiUkRrLC0i7jx3mzr+FJoaMSMc2656QDPOTWSbwpU2yHSmBGYsqgHbgA8noF P1vlfpYi+o1e39VsXXCPVSdHhnaixLrjiV4+A0JZ6blxTEhiqv9MCAx8mK4Bo+gDxjc3 xoXA== 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=lvsT0zwXtohoIlb/B8Ec03JJskGnGs4uD31uLzx6uXFwPROfSOcMcTIrfXWIhikAJC m+Mzg8w43/lb4JAB1djyEzIUGVcdBRVvqr00oYSE1pSPq05mnCECAcW/MFc4twB2a8A7 BTT4GQG97q490DlT8rvO+bug+D/pLglCreZYHYa90h7ju8csB2VeluEIWZPIbibe/AS7 o8tbPJoAJjifQODvJuDHkSdcwm0lZeAPBG9q/ZP0k50oJ4/HB0mJMNfW8quwJHnJR0SI Shp7IzrBIoTW6dP3JYPdBfh0KTfrpz278UJxMl5tIxolRHxjBlZ1CTEKzH9LOB3IaT47 yccA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I0UWEWPB; 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 y22si1163528ejm.431.2020.09.28.11.37.27; Mon, 28 Sep 2020 11:37:50 -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=I0UWEWPB; 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 S1726817AbgI1SgV (ORCPT + 99 others); Mon, 28 Sep 2020 14:36:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38093 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726461AbgI1SgT (ORCPT ); Mon, 28 Sep 2020 14:36:19 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601318178; 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=I0UWEWPBKgynHrcG7x2mu74D7cUGGhIH07sUiUIgCvO+RxHn0oECHJcdAz/qykeoZSLXYE dQEbHqQv94xAD9AEYUdOBaEWQnbr9vKu4ugqD68pk4Gcd9653Mo9t/2cXxvIXWGAJJUIMF RhYyiK4uq0U8qoO53vsl3GEvXM6FsAU= 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-205-QOoB4A-NNji0hBs9kJXzaw-1; Mon, 28 Sep 2020 14:36:14 -0400 X-MC-Unique: QOoB4A-NNji0hBs9kJXzaw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28462ADC25; Mon, 28 Sep 2020 18:36:08 +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 4E07860C13; Mon, 28 Sep 2020 18:36:06 +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 v4 1/4] sched/isolation: API to get number of housekeeping CPUs Date: Mon, 28 Sep 2020 14:35:26 -0400 Message-Id: <20200928183529.471328-2-nitesh@redhat.com> In-Reply-To: <20200928183529.471328-1-nitesh@redhat.com> References: <20200928183529.471328-1-nitesh@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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