From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFB95CA9EAE for ; Tue, 29 Oct 2019 09:53:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EF8A208E3 for ; Tue, 29 Oct 2019 09:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732976AbfJ2Jwz (ORCPT ); Tue, 29 Oct 2019 05:52:55 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:47815 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733014AbfJ2Jwt (ORCPT ); Tue, 29 Oct 2019 05:52:49 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iPOAm-0004Nb-Lk; Tue, 29 Oct 2019 10:52:20 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 4D48D1C0073; Tue, 29 Oct 2019 10:52:20 +0100 (CET) Date: Tue, 29 Oct 2019 09:52:20 -0000 From: "tip-bot2 for Frederic Weisbecker" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/vtime: Introduce vtime_accounting_enabled_cpu() Cc: Frederic Weisbecker , "Peter Zijlstra (Intel)" , Jacek Anaszewski , Linus Torvalds , Pavel Machek , "Rafael J . Wysocki" , Rik van Riel , Thomas Gleixner , Viresh Kumar , Wanpeng Li , Yauheni Kaliuta , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <20191016025700.31277-10-frederic@kernel.org> References: <20191016025700.31277-10-frederic@kernel.org> MIME-Version: 1.0 Message-ID: <157234274004.29376.3323221394697861825.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 9adbb9dd4c4eb45e1129fc73d8de69ca72350f81 Gitweb: https://git.kernel.org/tip/9adbb9dd4c4eb45e1129fc73d8de69ca72350f81 Author: Frederic Weisbecker AuthorDate: Wed, 16 Oct 2019 04:56:55 +02:00 Committer: Ingo Molnar CommitterDate: Tue, 29 Oct 2019 10:01:15 +01:00 sched/vtime: Introduce vtime_accounting_enabled_cpu() This allows us to check if a remote CPU runs vtime accounting (ie: is nohz_full). We'll need that to reliably support reading kcpustat on nohz_full CPUs. Also simplify a bit the condition in the local flavoured function while at it. Signed-off-by: Frederic Weisbecker Signed-off-by: Peter Zijlstra (Intel) Cc: Jacek Anaszewski Cc: Linus Torvalds Cc: Pavel Machek Cc: Peter Zijlstra Cc: Rafael J . Wysocki Cc: Rik van Riel Cc: Thomas Gleixner Cc: Viresh Kumar Cc: Wanpeng Li Cc: Yauheni Kaliuta Link: https://lkml.kernel.org/r/20191016025700.31277-10-frederic@kernel.org Signed-off-by: Ingo Molnar --- include/linux/vtime.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/vtime.h b/include/linux/vtime.h index eb2e7a1..e2733bf 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h @@ -31,14 +31,14 @@ static inline bool vtime_accounting_enabled(void) return context_tracking_enabled(); } -static inline bool vtime_accounting_enabled_this_cpu(void) +static inline bool vtime_accounting_enabled_cpu(int cpu) { - if (vtime_accounting_enabled()) { - if (context_tracking_enabled_this_cpu()) - return true; - } + return (vtime_accounting_enabled() && context_tracking_enabled_cpu(cpu)); +} - return false; +static inline bool vtime_accounting_enabled_this_cpu(void) +{ + return (vtime_accounting_enabled() && context_tracking_enabled_this_cpu()); } extern void vtime_task_switch_generic(struct task_struct *prev); @@ -51,6 +51,7 @@ static inline void vtime_task_switch(struct task_struct *prev) #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ +static inline bool vtime_accounting_enabled_cpu(int cpu) {return false; } static inline bool vtime_accounting_enabled_this_cpu(void) { return false; } static inline void vtime_task_switch(struct task_struct *prev) { }