Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp614799pxk; Wed, 23 Sep 2020 11:19:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrnMhKgTFHpPIJWeTS5tfnzSsdX87y3Hq+90e6jU1pMWFFYA85V7xFaKhVTIk5cAWiY5lX X-Received: by 2002:aa7:c9c7:: with SMTP id i7mr644181edt.336.1600885158442; Wed, 23 Sep 2020 11:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600885158; cv=none; d=google.com; s=arc-20160816; b=Wmkmjd4TWw0TCQjeR/vC2hUW0prKZ59RuLrlSUy1ZwtWj2dNVh4U5FoxbuNuUm6YL0 BNz31J/ZFEcS0WoNEM6N6/SiK0PcekfMUQLk6X33c9YdGAzQyIbrOQyhOwe1P/ZD8oAF GWE/D5Gy4jgIzH7lUEY0msRTv97rRjHLjm0REslYmwXRIDMQ9AXnXJhCOgXk1DXz2HJO yXZ9/D4suJlQzPIlU2n1Bw87FjonWc/Qm9m2CvnfQ6+1m8XiBU2yiqN7LC/UQVbLuRO6 +2IzgNerWOZ2/fGirdUrBB2o55dCjRmKrpMMXY7f6uic1/6syPFY7zXDUjwPf8bdvXTC RfPA== 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=7UUuowF4weSLiWMwKfPo+YyNGAQzoPK/8GZlRbYkNkk=; b=fHQedEuIzUbu4+hz4jYCh08l2eCt4TpOom4P3XwPbcBWLwcS0qENRIhuXMCz5XpC6L XE+CIt74yaEa8kMVrZ+UHVVipigCw8pXXNFvqUJxME4E6fsZF4LKq3KDeVnhPJ7ut04M 5WWFX0TpnhN2kDFNXb+2xe/4aDdwEmAX+YXAKW1mtSojgSNMBwg+zaYds+it7VzFVFiy risaNeQoCFZue+yweKoniuEzuul9qmxZJT+ppKLrUK9TIIfCN1vDzC5wyuk4wwcqVp6E k6cdCw8KAgSreJeEx75oNl46zzVzl7agP86OiAZqQwpWJ/TucAEzVEgDotGXzQ1cfz0F fHag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I8QYLP66; 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 v10si421386eds.459.2020.09.23.11.18.55; Wed, 23 Sep 2020 11:19:18 -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=I8QYLP66; 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 S1726735AbgIWSRr (ORCPT + 99 others); Wed, 23 Sep 2020 14:17:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32888 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbgIWSRk (ORCPT ); Wed, 23 Sep 2020 14:17:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600885059; 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=7UUuowF4weSLiWMwKfPo+YyNGAQzoPK/8GZlRbYkNkk=; b=I8QYLP66k8iaRsXuhrPg/C1NqcWhF4LUcp2rmdEDrgzT87ObeVzpQgDozx3wNF534pL5N/ gDvs11ADuZiqAAwS2aWjcg9eYf0TovVjM9pgFv20JztwE1tY2sjWwMYkfTXT7jMh4K4cJC 4nWSkqmqWSGP+EHx/C91RtgHviQw6CI= 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-265-MU8ey5c0MkewCvWXYfJEOw-1; Wed, 23 Sep 2020 14:17:35 -0400 X-MC-Unique: MU8ey5c0MkewCvWXYfJEOw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3350802B70; Wed, 23 Sep 2020 18:17:32 +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 EDE755C1C7; Wed, 23 Sep 2020 18:17:30 +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, 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: [PATCH v2 1/4] sched/isolation: API to get housekeeping online CPUs Date: Wed, 23 Sep 2020 14:11:23 -0400 Message-Id: <20200923181126.223766-2-nitesh@redhat.com> In-Reply-To: <20200923181126.223766-1-nitesh@redhat.com> References: <20200923181126.223766-1-nitesh@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); +} + #endif /* _LINUX_SCHED_ISOLATION_H */ -- 2.18.2