Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp18645pxy; Tue, 4 May 2021 17:29:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlyvQOo6TOD//3EQxjLBxVFF/Inr66qf8pRjQ/cL2lqf8iNafs0XNc3yrj7ZYWrqpAjBGd X-Received: by 2002:a17:906:3ec9:: with SMTP id d9mr24374265ejj.479.1620174564048; Tue, 04 May 2021 17:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620174564; cv=none; d=google.com; s=arc-20160816; b=MsdDRm5M9fZryb+ciYydaFYvf4+N+1wVs+aNUaEWvraxGw8xpPDVhX8AbmAtaDhwFA ZPMtQY2nguu7cZ+GjpX7cv2ujID1U9s776t0zjMEbh+o8ftYrJCQyb109He79n5oQRx4 l5LFIfadZyt9pUVgy4QdMqQbKiFjePhHBZPbqS2B87b7enG62QxWMSvhnWzXXeivLfId SRH+PlRNUFebW0zFFiwUj9+5/m1byfPG0SRd6IJlzthfwvVwHczH70YBDPoL1pKK/dsS Lc/OiC9aMTeE/uccRmjXAWoQIgVVh5TihxkaomScz1FI+aDKuFyb90KI3+l+VJ0oN48H vB8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=SfWc48+ZNOApnJRY/spQcgTuKI/wNOhy/7yw1UF2NV8=; b=h891UMZ2LgCeq9aPMssRglo6Cn0QKJgrAbd0aS0cn3CNi/QjA0KzFeweGHlO25l1B4 RPlWZMXqTPei9eaYnUToPfuA0JC0rvIADewBlbR/RZ4IZ1ImgA+rLJPbkiJfL6d26AEe kYitKxdOkYY/YJjMJFGrYGY+zLV9Z+Zgn5WyUmM/rtMO3QPiQQsaLTqlHbjIo9I1d08l HNrezPxdNiOQlJgaAvHPbDEj6NEGCB4EI7i0NbWwSlopxoxifZVJMcOwbG23eFh5Z83+ t2LKvIoOXMgsDPv2+GGKP9O60SOathM2v0S68uPdwyGCDTaeGFotdE+OkP/Rjgn7tmoW 5jPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="BO/aiJAc"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 12si3490948ejj.165.2021.05.04.17.29.00; Tue, 04 May 2021 17:29:24 -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=@google.com header.s=20161025 header.b="BO/aiJAc"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbhEEA24 (ORCPT + 99 others); Tue, 4 May 2021 20:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbhEEA2v (ORCPT ); Tue, 4 May 2021 20:28:51 -0400 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B7E6C06138A for ; Tue, 4 May 2021 17:27:54 -0700 (PDT) Received: by mail-qt1-x84a.google.com with SMTP id z5-20020a05622a0285b02901b943be06b5so4708155qtw.17 for ; Tue, 04 May 2021 17:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=SfWc48+ZNOApnJRY/spQcgTuKI/wNOhy/7yw1UF2NV8=; b=BO/aiJAc6tdUvLuW9QftVeltD62ugVH9EmGKi3YkWDdYHrrK7ZnpORhGAdrIB09iP6 NbtxXECjPN8wePDHkQ2LAQIlWCUpaQRGJ1o68PMkD1X/gd9p1dp+Ti7pnVwU2DWBqoKo PWID2FF/hQcrUfSffEuKAZ+x60keZ98KDODLwGn1M8JVBq8Oy3rVyxCSbpx1Ock1MQ/n WC0qtRA83Mn6EM/57AAvYP1mGvqnYCGMDsXbAIfFr3pDCsylzpFHIRRvqXac73XlJoJB +cxFkn6RYMYVfq28JPyriZvvSrS4IgXUT4RcEpwJK7N2ppC1dvtHiu9l90TMtzCTE3aN lGHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=SfWc48+ZNOApnJRY/spQcgTuKI/wNOhy/7yw1UF2NV8=; b=ungGY2b0jBefTf9VFLFq+jYbK+m5xHXpXsYnl6rbJtMD/7wNW2y1bA/Rlg2s4o/q+C URaoc2uzn+WVKV7QF+WoQLcTzCFzaZptVb6cLbg3pY5mRvJ23CR2TwUBuaKyZw7qvccV 7Utf9TZVMz8XhP6cIDABTN5LDEdgncZN/hJZk5qu+Ggx4Aqbf8AFFESf8zIip7hIlYUV DO7pEcAofr1GA14evcZYQMRnWxPBnLb1sx11xPLbDieXJulQ3vYWG+HLtcYSAiB8e7HK LSSBGO+vY3hdjUT+0kturmfSuAMAWrOrKzwqMs3EnCyui5czoCLYec/hn0y13EKWzVjB lmBw== X-Gm-Message-State: AOAM532aW/yXKvGlOEFprzeNfz7jcOsQkNzXLYwRyQ5MF/7fRNGRXcu+ lQXNgs9LwmocHYwT1OI2un6mEgCwZpc= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:df57:48cb:ea33:a156]) (user=seanjc job=sendgmr) by 2002:a0c:fec8:: with SMTP id z8mr28951786qvs.58.1620174473799; Tue, 04 May 2021 17:27:53 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 4 May 2021 17:27:31 -0700 In-Reply-To: <20210505002735.1684165-1-seanjc@google.com> Message-Id: <20210505002735.1684165-5-seanjc@google.com> Mime-Version: 1.0 References: <20210505002735.1684165-1-seanjc@google.com> X-Mailer: git-send-email 2.31.1.527.g47e6f16901-goog Subject: [PATCH v4 4/8] sched/vtime: Move vtime accounting external declarations above inlines From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Michael Tokarev , Christian Borntraeger , Frederic Weisbecker Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the blob of external declarations (and their stubs) above the set of inline definitions (and their stubs) for vtime accounting. This will allow a future patch to bring in more inline definitions without also having to shuffle large chunks of code. No functional change intended. Reviewed-by: Christian Borntraeger Signed-off-by: Sean Christopherson --- include/linux/vtime.h | 94 +++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/include/linux/vtime.h b/include/linux/vtime.h index 041d6524d144..6a4317560539 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h @@ -10,53 +10,6 @@ struct task_struct; -/* - * vtime_accounting_enabled_this_cpu() definitions/declarations - */ -#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) - -static inline bool vtime_accounting_enabled_this_cpu(void) { return true; } -extern void vtime_task_switch(struct task_struct *prev); - -#elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) - -/* - * Checks if vtime is enabled on some CPU. Cputime readers want to be careful - * in that case and compute the tickless cputime. - * For now vtime state is tied to context tracking. We might want to decouple - * those later if necessary. - */ -static inline bool vtime_accounting_enabled(void) -{ - return context_tracking_enabled(); -} - -static inline bool vtime_accounting_enabled_cpu(int cpu) -{ - return context_tracking_enabled_cpu(cpu); -} - -static inline bool vtime_accounting_enabled_this_cpu(void) -{ - return context_tracking_enabled_this_cpu(); -} - -extern void vtime_task_switch_generic(struct task_struct *prev); - -static inline void vtime_task_switch(struct task_struct *prev) -{ - if (vtime_accounting_enabled_this_cpu()) - vtime_task_switch_generic(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) { } - -#endif - /* * Common vtime APIs */ @@ -94,6 +47,53 @@ static inline void vtime_account_hardirq(struct task_struct *tsk) { } static inline void vtime_flush(struct task_struct *tsk) { } #endif +/* + * vtime_accounting_enabled_this_cpu() definitions/declarations + */ +#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) + +static inline bool vtime_accounting_enabled_this_cpu(void) { return true; } +extern void vtime_task_switch(struct task_struct *prev); + +#elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) + +/* + * Checks if vtime is enabled on some CPU. Cputime readers want to be careful + * in that case and compute the tickless cputime. + * For now vtime state is tied to context tracking. We might want to decouple + * those later if necessary. + */ +static inline bool vtime_accounting_enabled(void) +{ + return context_tracking_enabled(); +} + +static inline bool vtime_accounting_enabled_cpu(int cpu) +{ + return context_tracking_enabled_cpu(cpu); +} + +static inline bool vtime_accounting_enabled_this_cpu(void) +{ + return context_tracking_enabled_this_cpu(); +} + +extern void vtime_task_switch_generic(struct task_struct *prev); + +static inline void vtime_task_switch(struct task_struct *prev) +{ + if (vtime_accounting_enabled_this_cpu()) + vtime_task_switch_generic(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) { } + +#endif + #ifdef CONFIG_IRQ_TIME_ACCOUNTING extern void irqtime_account_irq(struct task_struct *tsk, unsigned int offset); -- 2.31.1.527.g47e6f16901-goog