public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Borislav Petkov <bp@alien8.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 00/15] sched/headers: Optimize scheduler build time
Date: Tue, 15 Mar 2022 09:42:32 +0100	[thread overview]
Message-ID: <20220315084247.40783-1-mingo@kernel.org> (raw)

Optimize the kernel scheduler build time by organizing the code into
larger build units. This cuts CPU usage by 60%.

These patches originate from the fast-headers tree.

The numbers:

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.

Ingo Molnar (15):
  sched/headers: Fix header to build standalone: <linux/sched_clock.h>
  sched/headers: Add header guard to kernel/sched/sched.h
  sched/headers: Add header guard to kernel/sched/stats.h and kernel/sched/autogroup.h
  sched/headers: sched/clock: Mark all functions 'notrace', remove CC_FLAGS_FTRACE build asymmetry
  sched/headers: Add initial new headers as identity mappings
  sched/headers: Fix comment typo in kernel/sched/cpudeadline.c
  sched/headers: Make the <linux/sched/deadline.h> header build standalone
  sched/headers: Introduce kernel/sched/build_utility.c and build multiple .c files there
  sched/headers: Introduce kernel/sched/build_policy.c and build multiple .c files there
  sched/headers: Standardize kernel/sched/sched.h header dependencies
  sched/headers: Reorganize, clean up and optimize kernel/sched/core.c dependencies
  sched/headers: Reorganize, clean up and optimize kernel/sched/fair.c dependencies
  sched/headers: Reorganize, clean up and optimize kernel/sched/build_policy.c dependencies
  sched/headers: Reorganize, clean up and optimize kernel/sched/build_utility.c dependencies
  sched/headers: Reorganize, clean up and optimize kernel/sched/sched.h dependencies

 arch/arm64/include/asm/paravirt_api_clock.h |   1 +
 arch/x86/include/asm/paravirt_api_clock.h   |   1 +
 include/linux/cgroup_api.h                  |   1 +
 include/linux/cpumask_api.h                 |   1 +
 include/linux/fs_api.h                      |   1 +
 include/linux/gfp_api.h                     |   1 +
 include/linux/hashtable_api.h               |   1 +
 include/linux/hrtimer_api.h                 |   1 +
 include/linux/kobject_api.h                 |   1 +
 include/linux/kref_api.h                    |   1 +
 include/linux/ktime_api.h                   |   1 +
 include/linux/llist_api.h                   |   1 +
 include/linux/lockdep_api.h                 |   1 +
 include/linux/mm_api.h                      |   1 +
 include/linux/mutex_api.h                   |   1 +
 include/linux/perf_event_api.h              |   1 +
 include/linux/pgtable_api.h                 |   1 +
 include/linux/ptrace_api.h                  |   1 +
 include/linux/rcuwait_api.h                 |   1 +
 include/linux/refcount_api.h                |   1 +
 include/linux/sched/affinity.h              |   1 +
 include/linux/sched/cond_resched.h          |   1 +
 include/linux/sched/deadline.h              |   2 +
 include/linux/sched/posix-timers.h          |   1 +
 include/linux/sched/rseq_api.h              |   1 +
 include/linux/sched/task_flags.h            |   1 +
 include/linux/sched/thread_info_api.h       |   1 +
 include/linux/sched_clock.h                 |   2 +
 include/linux/seqlock_api.h                 |   1 +
 include/linux/softirq.h                     |   1 +
 include/linux/spinlock_api.h                |   1 +
 include/linux/swait_api.h                   |   1 +
 include/linux/syscalls_api.h                |   1 +
 include/linux/u64_stats_sync_api.h          |   1 +
 include/linux/wait_api.h                    |   1 +
 include/linux/workqueue_api.h               |   1 +
 kernel/sched/Makefile                       |  28 +++++-------
 kernel/sched/autogroup.c                    |   3 +-
 kernel/sched/autogroup.h                    |   5 +++
 kernel/sched/build_policy.c                 |  52 ++++++++++++++++++++++
 kernel/sched/build_utility.c                | 109 +++++++++++++++++++++++++++++++++++++++++++++
 kernel/sched/clock.c                        |  44 +++++++++----------
 kernel/sched/completion.c                   |   2 +-
 kernel/sched/core.c                         |  81 +++++++++++++++++++++++++++++-----
 kernel/sched/core_sched.c                   |   3 --
 kernel/sched/cpuacct.c                      |   3 +-
 kernel/sched/cpudeadline.c                  |   3 +-
 kernel/sched/cpufreq.c                      |   3 --
 kernel/sched/cpufreq_schedutil.c            |   7 ---
 kernel/sched/cpupri.c                       |   1 -
 kernel/sched/cputime.c                      |   1 -
 kernel/sched/deadline.c                     |   2 -
 kernel/sched/debug.c                        |   1 -
 kernel/sched/fair.c                         |  31 +++++++++++++
 kernel/sched/idle.c                         |   3 --
 kernel/sched/isolation.c                    |   1 -
 kernel/sched/loadavg.c                      |   1 -
 kernel/sched/membarrier.c                   |   1 -
 kernel/sched/pelt.c                         |   4 --
 kernel/sched/psi.c                          |  15 -------
 kernel/sched/rt.c                           |   3 --
 kernel/sched/sched.h                        | 114 ++++++++++++++++++++++++++----------------------
 kernel/sched/stats.c                        |   1 -
 kernel/sched/stats.h                        |   4 ++
 kernel/sched/stop_task.c                    |   1 -
 kernel/sched/swait.c                        |   1 -
 kernel/sched/topology.c                     |   1 -
 kernel/sched/wait.c                         |   1 -
 kernel/sched/wait_bit.c                     |   2 +-
 69 files changed, 407 insertions(+), 163 deletions(-)
 create mode 100644 arch/arm64/include/asm/paravirt_api_clock.h
 create mode 100644 arch/x86/include/asm/paravirt_api_clock.h
 create mode 100644 include/linux/cgroup_api.h
 create mode 100644 include/linux/cpumask_api.h
 create mode 100644 include/linux/fs_api.h
 create mode 100644 include/linux/gfp_api.h
 create mode 100644 include/linux/hashtable_api.h
 create mode 100644 include/linux/hrtimer_api.h
 create mode 100644 include/linux/kobject_api.h
 create mode 100644 include/linux/kref_api.h
 create mode 100644 include/linux/ktime_api.h
 create mode 100644 include/linux/llist_api.h
 create mode 100644 include/linux/lockdep_api.h
 create mode 100644 include/linux/mm_api.h
 create mode 100644 include/linux/mutex_api.h
 create mode 100644 include/linux/perf_event_api.h
 create mode 100644 include/linux/pgtable_api.h
 create mode 100644 include/linux/ptrace_api.h
 create mode 100644 include/linux/rcuwait_api.h
 create mode 100644 include/linux/refcount_api.h
 create mode 100644 include/linux/sched/affinity.h
 create mode 100644 include/linux/sched/cond_resched.h
 create mode 100644 include/linux/sched/posix-timers.h
 create mode 100644 include/linux/sched/rseq_api.h
 create mode 100644 include/linux/sched/task_flags.h
 create mode 100644 include/linux/sched/thread_info_api.h
 create mode 100644 include/linux/seqlock_api.h
 create mode 100644 include/linux/softirq.h
 create mode 100644 include/linux/spinlock_api.h
 create mode 100644 include/linux/swait_api.h
 create mode 100644 include/linux/syscalls_api.h
 create mode 100644 include/linux/u64_stats_sync_api.h
 create mode 100644 include/linux/wait_api.h
 create mode 100644 include/linux/workqueue_api.h
 create mode 100644 kernel/sched/build_policy.c
 create mode 100644 kernel/sched/build_utility.c

-- 
2.32.0


             reply	other threads:[~2022-03-15  8:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  8:42 Ingo Molnar [this message]
2022-03-15  8:42 ` [PATCH 01/15] sched/headers: Fix header to build standalone: <linux/sched_clock.h> Ingo Molnar
2022-03-15  8:42 ` [PATCH 02/15] sched/headers: Add header guard to kernel/sched/sched.h Ingo Molnar
2022-03-15  8:42 ` [PATCH 03/15] sched/headers: Add header guard to kernel/sched/stats.h and kernel/sched/autogroup.h Ingo Molnar
2022-03-15  8:42 ` [PATCH 04/15] sched/headers: sched/clock: Mark all functions 'notrace', remove CC_FLAGS_FTRACE build asymmetry Ingo Molnar
2022-03-15  8:42 ` [PATCH 05/15] sched/headers: Add initial new headers as identity mappings Ingo Molnar
2022-03-15  8:42 ` [PATCH 06/15] sched/headers: Fix comment typo in kernel/sched/cpudeadline.c Ingo Molnar
2022-03-15  8:42 ` [PATCH 07/15] sched/headers: Make the <linux/sched/deadline.h> header build standalone Ingo Molnar
2022-03-15  8:42 ` [PATCH 08/15] sched/headers: Introduce kernel/sched/build_utility.c and build multiple .c files there Ingo Molnar
2022-03-15  8:42 ` [PATCH 09/15] sched/headers: Introduce kernel/sched/build_policy.c " Ingo Molnar
2022-08-23  7:47   ` suhui_kernel
2022-08-24 15:50     ` Thomas Gleixner
2022-03-15  8:42 ` [PATCH 10/15] sched/headers: Standardize kernel/sched/sched.h header dependencies Ingo Molnar
2022-03-15  8:42 ` [PATCH 11/15] sched/headers: Reorganize, clean up and optimize kernel/sched/core.c dependencies Ingo Molnar
2022-03-15  8:42 ` [PATCH 12/15] sched/headers: Reorganize, clean up and optimize kernel/sched/fair.c dependencies Ingo Molnar
2022-03-15  8:42 ` [PATCH 13/15] sched/headers: Reorganize, clean up and optimize kernel/sched/build_policy.c dependencies Ingo Molnar
2022-03-15  8:42 ` [PATCH 14/15] sched/headers: Reorganize, clean up and optimize kernel/sched/build_utility.c dependencies Ingo Molnar
2022-03-15  8:42 ` [PATCH 15/15] sched/headers: Reorganize, clean up and optimize kernel/sched/sched.h dependencies Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220315084247.40783-1-mingo@kernel.org \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mgorman@suse.de \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox