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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EE98C433EF for ; Tue, 15 Mar 2022 08:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346168AbiCOIqV (ORCPT ); Tue, 15 Mar 2022 04:46:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346184AbiCOIpn (ORCPT ); Tue, 15 Mar 2022 04:45:43 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0674D625 for ; Tue, 15 Mar 2022 01:44:06 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 7-20020a05600c228700b00385fd860f49so1047779wmf.0 for ; Tue, 15 Mar 2022 01:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HtIgN6AdT+17GwfQORoopmuViWKlchoqVYSRUx3tKDQ=; b=WWTl831h1hLrRHyCXf3DytETojLSGftQmq77K3b9N6eMDev4tsL2JkFygqgLTWg0T8 SSYTmW86s5aeqymS+/bdzXS5jBTr9c9k+xMjvYog9Ta3A7u8knfZufuQYCLqCV2J+MDj /y94pG/ew0r8fACxrEUa/6vOd/l7uofCIGpV9cDAMTvSfFTVaPRVdHLLIBMCdU7ABEfR DyuMGuIAMT+warBnYOcVmWtWqLYWeD6Fk60xMim05nVz/9FuXSsXWgSofWlP9/nWIUM6 y5JDj9wiBzcupoK1ANdeEWi+dPnkj7ntUdEwaJhrq0Rptt661684HD8VSF2U+YbLYdCC bd4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HtIgN6AdT+17GwfQORoopmuViWKlchoqVYSRUx3tKDQ=; b=h/Qf47MAfuHAqvjvhPBv333VChmFSHOGKm0VfhuXv4AbDSFKiwhq2AIfF0xbHQUyeT cQQho0gBhElaZMP21SAhREdwsYhZnBe9Re2AptL+MNiQaaGAJD1s9c3z0LBLvvK0T+2n 5xgC2AExvB1m3X0/tPZ9vMjdgP4Ib7Pnm4y/UHoN0mM3uhqPmYakVH4HowkR9dMejYz9 nfYdi8FJxkRC09dJanugTlTeoBj50CipF1pMmVBifqc+F1H0zJo33qJM9pwYUWpcknYX ogeCEgBdUV8+fuqqQ5oblg7dCspgXW16agIZ7yHwpkBvtTILrE+qQ0wtoUypZNFpC3Z8 wkGg== X-Gm-Message-State: AOAM53374RhRap1Obc288uUydnsxOhfcdcC5PldXlbSXrnEmdGe3ieJO uGYZUZKHMdyduTB5F+Dc1kEXMBWw18U= X-Google-Smtp-Source: ABdhPJzI+uQwQtzHEiBagL8inR3+Kp0cko+5UjrbOcyh997XWjdXRe67i8cO6jBrnWrzU4G7Ulz26g== X-Received: by 2002:a05:600c:3203:b0:381:b544:7970 with SMTP id r3-20020a05600c320300b00381b5447970mr2354447wmp.144.1647333845370; Tue, 15 Mar 2022 01:44:05 -0700 (PDT) Received: from kepler.. (0526F1FC.dsl.pool.telekom.hu. [5.38.241.252]) by smtp.gmail.com with ESMTPSA id e6-20020a5d5006000000b0020374784350sm15078503wrt.64.2022.03.15.01.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 01:44:04 -0700 (PDT) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Juri Lelli , Andy Lutomirski , Mel Gorman , Andrew Morton , Borislav Petkov , Linus Torvalds , Thomas Gleixner Subject: [PATCH 15/15] sched/headers: Reorganize, clean up and optimize kernel/sched/sched.h dependencies Date: Tue, 15 Mar 2022 09:42:47 +0100 Message-Id: <20220315084247.40783-16-mingo@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220315084247.40783-1-mingo@kernel.org> References: <20220315084247.40783-1-mingo@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove all headers, except the ones required to make this header build standalone. Also include stats.h in sched.h explicitly - dependencies already require this. Summary of the build speedup gained through the last ~15 scheduler build & header dependency patches: Cumulative scheduler (kernel/sched/) build time speedup on a Linux distribution's config, which enables all scheduler features, compared to the vanilla kernel: _____________________________________________________________________________ | | Vanilla kernel (v5.13-rc7): |_____________________________________________________________________________ | | Performance counter stats for 'make -j96 kernel/sched/' (3 runs): | | 126,975,564,374 instructions # 1.45 insn per cycle ( +- 0.00% ) | 87,637,847,671 cycles # 3.959 GHz ( +- 0.30% ) | 22,136.96 msec cpu-clock # 7.499 CPUs utilized ( +- 0.29% ) | | 2.9520 +- 0.0169 seconds time elapsed ( +- 0.57% ) |_____________________________________________________________________________ | | Patched kernel: |_____________________________________________________________________________ | | Performance counter stats for 'make -j96 kernel/sched/' (3 runs): | | 50,420,496,914 instructions # 1.47 insn per cycle ( +- 0.00% ) | 34,234,322,038 cycles # 3.946 GHz ( +- 0.31% ) | 8,675.81 msec cpu-clock # 3.053 CPUs utilized ( +- 0.45% ) | | 2.8420 +- 0.0181 seconds time elapsed ( +- 0.64% ) |_____________________________________________________________________________ Summary: - CPU time used to build the scheduler dropped by -60.9%, a reduction from 22.1 clock-seconds to 8.7 clock-seconds. - Wall-clock time to build the scheduler dropped by -3.9%, a reduction from 2.95 seconds to 2.84 seconds. Signed-off-by: Ingo Molnar Reviewed-by: Peter Zijlstra --- kernel/sched/build_policy.c | 4 -- kernel/sched/build_utility.c | 6 +-- kernel/sched/sched.h | 147 +++++++++++++++++++-------------------------------------------- kernel/sched/stats.h | 2 - 4 files changed, 46 insertions(+), 113 deletions(-) diff --git a/kernel/sched/build_policy.c b/kernel/sched/build_policy.c index a2e4023771a0..e0104b45029a 100644 --- a/kernel/sched/build_policy.c +++ b/kernel/sched/build_policy.c @@ -28,10 +28,6 @@ #include #include -#ifdef CONFIG_PARAVIRT -# include -#endif - #include #include "sched.h" diff --git a/kernel/sched/build_utility.c b/kernel/sched/build_utility.c index bc2f4d648209..eec0849b2aae 100644 --- a/kernel/sched/build_utility.c +++ b/kernel/sched/build_utility.c @@ -44,13 +44,11 @@ #include #include -#ifdef CONFIG_PARAVIRT -# include -#endif - #include #include +#include + #include "sched.h" #include "sched-pelt.h" #include "stats.h" diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index f255ec2afeca..0d4217965561 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -5,158 +5,97 @@ #ifndef _KERNEL_SCHED_SCHED_H #define _KERNEL_SCHED_SCHED_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - #include #include -#include -#include #include -#include #include -#include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include #include -#include #include #include #include #include +#include #include -#include -#include #include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_PARAVIRT -# include -#endif - -#include - -#ifdef CONFIG_CGROUP_SCHED -#include -#include -#endif - -#ifdef CONFIG_SCHED_DEBUG -# include -#endif - -#include "cpupri.h" -#include "cpudeadline.h" - -#ifdef CONFIG_SCHED_DEBUG -# define SCHED_WARN_ON(x) WARN_ONCE(x, #x) -#else -# define SCHED_WARN_ON(x) ({ (void)(x), 0; }) -#endif +#include #include +#include #include +#include #include #include #include #include #include +#include #include #include +#include #include #include +#include #include #include +#include +#include +#include #include #include +#include #include #include +#include #include -#include -#include -#include -#include -#include -#include +#include #include #include #include #include +#include +#include #include #include +#include #include #include #include #include #include +#include #include #include +#include #include "../workqueue_internal.h" +#ifdef CONFIG_CGROUP_SCHED +#include +#include +#endif + +#ifdef CONFIG_SCHED_DEBUG +# include +#endif + +#ifdef CONFIG_PARAVIRT +# include +# include +#endif + +#include "cpupri.h" +#include "cpudeadline.h" + +#ifdef CONFIG_SCHED_DEBUG +# define SCHED_WARN_ON(x) WARN_ONCE(x, #x) +#else +# define SCHED_WARN_ON(x) ({ (void)(x), 0; }) +#endif + struct rq; struct cpuidle_state; @@ -1925,6 +1864,8 @@ extern void flush_smp_call_function_from_idle(void); static inline void flush_smp_call_function_from_idle(void) { } #endif +#include "stats.h" + #if defined(CONFIG_SCHED_CORE) && defined(CONFIG_SCHEDSTATS) extern void __sched_core_account_forceidle(struct rq *rq); diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h index a0df79e6038c..baa839c1ba96 100644 --- a/kernel/sched/stats.h +++ b/kernel/sched/stats.h @@ -2,8 +2,6 @@ #ifndef _KERNEL_STATS_H #define _KERNEL_STATS_H -#include "sched.h" - #ifdef CONFIG_SCHEDSTATS extern struct static_key_false sched_schedstats; -- 2.32.0