From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frederic Weisbecker Subject: [PATCH 2/2] sched/isolation: Add cpu_is_isolated() API Date: Sat, 4 Feb 2023 00:24:09 +0100 Message-ID: <20230203232409.163847-3-frederic@kernel.org> References: <20230203232409.163847-1-frederic@kernel.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675466663; bh=p1w/s0O5n3VSeOMpM1vDKAz+K6RPGrIp6QpaiUCAbUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuCrVsu7EsqwcuHwg7AUSbKZd6w6kULIQHrvnJZdUFECtU5/XPaHlkkcxjMPEhLga KVzT7ESVrOE/BZJQFfSitLQe2lUzquK9cVIp2Iw3xIk+Iozoq0lPn/0/CP26maBNXy kJnaR8PUUKkTPEFx3+exk8co1JIx29PdVQ8zDWpvfr1ct+VQB2f3sNJJSC6tHoXyz7 8u1AQd75R/OsWTxVL8XsPr0NtOj6elD8dcH+8S2k8+fk6jFIliCOej9sZNkuh0C6sE ds9hl+PCcLXgThtlugAUMHXnxGzGqkv4iUizOyXVr0YqhP3pgTHk/zCI9g5lYKWSRU iewsp3xAyNdkA== In-Reply-To: <20230203232409.163847-1-frederic-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" To: LKML Cc: Frederic Weisbecker , Roman Gushchin , Michal Hocko , Marcelo Tosatti , Leonardo , Johannes Weiner , Shakeel Butt , Muchun Song , Andrew Morton , Peter Zijlstra , Thomas Gleixner , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org Provide this new API to check if a CPU has been isolated either through isolcpus= or nohz_full= kernel parameter. It aims at avoiding kernel load deemed to be safely spared on CPUs running sensitive workload that can't bear any disturbance, such as pcp cache draining. Suggested-by: Michal Hocko Signed-off-by: Frederic Weisbecker --- include/linux/sched/isolation.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h index b645cc81fe01..088672f08469 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -53,4 +53,10 @@ static inline bool housekeeping_cpu(int cpu, enum hk_type type) return true; } +static inline bool cpu_is_isolated(int cpu) +{ + return !housekeeping_test_cpu(cpu, HK_TYPE_DOMAIN) || + !housekeeping_test_cpu(cpu, HK_TYPE_KERNEL_NOISE); +} + #endif /* _LINUX_SCHED_ISOLATION_H */ -- 2.34.1