[lkml]   [2020]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v2 1/4] sched/isolation: API to get housekeeping online CPUs
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)
+ const struct cpumask *hk_mask;
+ if (static_branch_unlikely(&housekeeping_overridden)) {
+ hk_mask = housekeeping_cpumask(HK_FLAG_MANAGED_IRQ);
+ return cpumask_weight(hk_mask);
+ }
+ return cpumask_weight(cpu_online_mask);
 \ /
  Last update: 2020-09-23 20:19    [W:0.789 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site