linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] kernel.h further split
@ 2021-10-07 15:03 Andy Shevchenko
  2021-10-07 15:03 ` [PATCH v3 1/7] kernel.h: Drop unneeded <linux/kernel.h> inclusion from other headers Andy Shevchenko
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Andy Shevchenko @ 2021-10-07 15:03 UTC (permalink / raw)
  To: Brendan Higgins, Andy Shevchenko, Peter Zijlstra,
	Thomas Gleixner, linux-kernel, linux-kselftest, kunit-dev,
	linux-media
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Ingo Molnar, Will Deacon,
	Waiman Long, Boqun Feng, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Andrew Morton, Miguel Ojeda,
	Thorsten Leemhuis

v2: https://lore.kernel.org/linux-media/20211007095129.22037-1-andriy.shevchenko@linux.intel.com/T/#u

The kernel.h is a set of something which is not related to each other
and often used in non-crossed compilation units, especially when drivers
need only one or two macro definitions from it.

Here is the split of container_of(). The goals are the following:
- untwist the dependency hell a bit
- drop kernel.h inclusion where it's only used for container_of()
- speed up C preprocessing.

In v3:
- split patch 2 to more patches (Greg)
- exclude C changes (Herbert, Greg)
- measure with kcbench, see below (Greg)

Cc: Thorsten Leemhuis <regressions@leemhuis.info>

People, like Greg KH and Miguel Ojeda, were asking about the latter.
My methodology an testing has been provided in cover letter for v2
(see above) and here is what Greg KH insisted to have which is speedup
of the kernel build.

$ kcbench -i 3 -j 64 -o $O -s $PWD --no-download -m
Processor:           Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz [88 CPUs]
Cpufreq; Memory:     powersave [intel_pstate]; 128823 MiB
Linux running:       5.6.0-2-amd64 [x86_64]
Compiler:            gcc (Debian 10.3.0-11) 10.3.0
Linux compiled:      5.15.0-rc4
Config; Environment: allmodconfig; CCACHE_DISABLE="1"
Build command:       make vmlinux modules
Filling caches:      This might take a while... Done
Run 1 (-j 64):       464.07 seconds / 7.76 kernels/hour [P:6001%]
Run 2 (-j 64):       464.64 seconds / 7.75 kernels/hour [P:6000%]
Run 3 (-j 64):       486.41 seconds / 7.40 kernels/hour [P:5727%]

$ kcbench -i 3 -j 64 -o $O -s $PWD --no-download -m
Processor:           Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz [88 CPUs]
Cpufreq; Memory:     powersave [intel_pstate]; 128823 MiB
Linux running:       5.6.0-2-amd64 [x86_64]
Compiler:            gcc (Debian 10.3.0-11) 10.3.0
Linux compiled:      5.15.0-rc4
Config; Environment: allmodconfig; CCACHE_DISABLE="1"
Build command:       make vmlinux modules
Filling caches:      This might take a while... Done
Run 1 (-j 64):       462.32 seconds / 7.79 kernels/hour [P:6009%]
Run 2 (-j 64):       462.33 seconds / 7.79 kernels/hour [P:6006%]
Run 3 (-j 64):       465.45 seconds / 7.73 kernels/hour [P:5999%]

Median values
	464.64	before
	462.33	after

Speedup: +0.5%

This supports and in align with my own approach, but shows lower numbers
due to additional big take in the measurements (compilation without ccache).

Andy Shevchenko (7):
  kernel.h: Drop unneeded <linux/kernel.h> inclusion from other headers
  kernel.h: Split out container_of() and typeof_member() macros
  kunit: Replace kernel.h with the necessary inclusions
  list.h: Replace kernel.h with the necessary inclusions
  llist: Replace kernel.h with the necessary inclusions
  plist: Replace kernel.h with the necessary inclusions
  media: entity: Replace kernel.h with the necessary inclusions

 include/kunit/test.h         | 14 ++++++++++++--
 include/linux/container_of.h | 37 ++++++++++++++++++++++++++++++++++++
 include/linux/kernel.h       | 31 +-----------------------------
 include/linux/kobject.h      |  1 +
 include/linux/list.h         |  6 ++++--
 include/linux/llist.h        |  4 +++-
 include/linux/plist.h        |  5 ++++-
 include/linux/rwsem.h        |  1 -
 include/linux/spinlock.h     |  1 -
 include/media/media-entity.h |  3 ++-
 10 files changed, 64 insertions(+), 39 deletions(-)
 create mode 100644 include/linux/container_of.h

-- 
2.33.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-07 15:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 15:03 [PATCH v3 0/7] kernel.h further split Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 1/7] kernel.h: Drop unneeded <linux/kernel.h> inclusion from other headers Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 2/7] kernel.h: Split out container_of() and typeof_member() macros Andy Shevchenko
2021-10-07 15:09   ` Greg Kroah-Hartman
2021-10-07 15:28     ` Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 3/7] kunit: Replace kernel.h with the necessary inclusions Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 4/7] list.h: " Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 5/7] llist: " Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 6/7] plist: " Andy Shevchenko
2021-10-07 15:03 ` [PATCH v3 7/7] media: entity: " Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).