All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sched: cleanup CONFIG_SCHED_MC & friends
@ 2021-10-08 11:53 ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Peter Zijlstra, aubrey.li, song.bao.hua, tim.c.chen,
	jonathan.cameron, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Yoshinori Sato, Rich Felker, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

Hi folks,

This stems from Barry introducing a new CONFIG_SCHED_CLUSTER which highlighted
the current state of similar Kconfigs isn't great:
  http://lore.kernel.org/r/CAGsJ_4xZD0sG0Df666f0bvHOzuPMjnw0dN_mArER5k1pJ6LPLw@mail.gmail.com

The changes happen all in one big patch; the alternative would be to have one
patch per arch that adds the ARCH_SUPPORTS_SCHED_* selection, then a final patch
that adds the generic definitions and removes the arch ones (which I can do if
that's a preferred approach).

Briefly tested by setting ARCH=foo and playing around with menuconfig.

Based on top of Peter's queue:
  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git -b sched/next

Patches are also available at:
  https://git.gitlab.arm.com/linux-arm/linux-vs.git -b mainline/sched/topo_kconfig_cleanup

Cheers,
Valentin

Valentin Schneider (2):
  sched: Move Kconfig.preempt to sched/Kconfig
  sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions

 arch/arm/Kconfig                          | 18 ++--------
 arch/arm64/Kconfig                        | 26 ++------------
 arch/ia64/Kconfig                         |  9 +----
 arch/mips/Kconfig                         | 10 +-----
 arch/parisc/Kconfig                       |  9 +----
 arch/powerpc/Kconfig                      |  9 +----
 arch/s390/Kconfig                         |  8 ++---
 arch/sh/Kconfig                           |  1 +
 arch/sh/mm/Kconfig                        |  9 -----
 arch/sparc/Kconfig                        | 20 ++---------
 arch/x86/Kconfig                          | 26 ++------------
 init/Kconfig                              |  2 +-
 kernel/{Kconfig.preempt => sched/Kconfig} | 41 +++++++++++++++++++++++
 13 files changed, 59 insertions(+), 129 deletions(-)
 rename kernel/{Kconfig.preempt => sched/Kconfig} (79%)

--
2.25.1


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

* [PATCH 0/2] sched: cleanup CONFIG_SCHED_MC & friends
@ 2021-10-08 11:53 ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker,
	Geert Uytterhoeven, David Hildenbrand, Peter Zijlstra,
	Linus Walleij, Rasmus Villemoes, x86, Michal Hocko,
	James E.J. Bottomley, Paul Mackerras, H. Peter Anvin,
	Will Deacon, Ard Biesheuvel, Vincent Guittot, Arnd Bergmann,
	Yoshinori Sato, YiFei Zhu, Helge Deller, aubrey.li, Hugh Dickins,
	Russell King, Christian Borntraeger, Ingo Molnar, Mel Gorman,
	Catalin Marinas, Masahiro Yamada, Frederic Weisbecker, Kees Cook,
	Vasily Gorbik, Anshuman Khandual, Vipin Sharma, Heiko Carstens,
	Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
	Borislav Petkov, Sergei Trofimovich, jonathan.cameron,
	Thomas Gleixner, Dietmar Eggemann, Vlastimil Babka, song.bao.hua,
	Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, Chris Down,
	Daniel Bristot de Oliveira, Randy Dunlap, Nick Desaulniers,
	Andrew Morton, tim.c.chen, David S. Miller, Mike Rapoport

Hi folks,

This stems from Barry introducing a new CONFIG_SCHED_CLUSTER which highlighted
the current state of similar Kconfigs isn't great:
  http://lore.kernel.org/r/CAGsJ_4xZD0sG0Df666f0bvHOzuPMjnw0dN_mArER5k1pJ6LPLw@mail.gmail.com

The changes happen all in one big patch; the alternative would be to have one
patch per arch that adds the ARCH_SUPPORTS_SCHED_* selection, then a final patch
that adds the generic definitions and removes the arch ones (which I can do if
that's a preferred approach).

Briefly tested by setting ARCH=foo and playing around with menuconfig.

Based on top of Peter's queue:
  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git -b sched/next

Patches are also available at:
  https://git.gitlab.arm.com/linux-arm/linux-vs.git -b mainline/sched/topo_kconfig_cleanup

Cheers,
Valentin

Valentin Schneider (2):
  sched: Move Kconfig.preempt to sched/Kconfig
  sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions

 arch/arm/Kconfig                          | 18 ++--------
 arch/arm64/Kconfig                        | 26 ++------------
 arch/ia64/Kconfig                         |  9 +----
 arch/mips/Kconfig                         | 10 +-----
 arch/parisc/Kconfig                       |  9 +----
 arch/powerpc/Kconfig                      |  9 +----
 arch/s390/Kconfig                         |  8 ++---
 arch/sh/Kconfig                           |  1 +
 arch/sh/mm/Kconfig                        |  9 -----
 arch/sparc/Kconfig                        | 20 ++---------
 arch/x86/Kconfig                          | 26 ++------------
 init/Kconfig                              |  2 +-
 kernel/{Kconfig.preempt => sched/Kconfig} | 41 +++++++++++++++++++++++
 13 files changed, 59 insertions(+), 129 deletions(-)
 rename kernel/{Kconfig.preempt => sched/Kconfig} (79%)

--
2.25.1


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

* [PATCH 0/2] sched: cleanup CONFIG_SCHED_MC & friends
@ 2021-10-08 11:53 ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Peter Zijlstra, aubrey.li, song.bao.hua, tim.c.chen,
	jonathan.cameron, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Yoshinori Sato, Rich Felker, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

Hi folks,

This stems from Barry introducing a new CONFIG_SCHED_CLUSTER which highlighted
the current state of similar Kconfigs isn't great:
  http://lore.kernel.org/r/CAGsJ_4xZD0sG0Df666f0bvHOzuPMjnw0dN_mArER5k1pJ6LPLw@mail.gmail.com

The changes happen all in one big patch; the alternative would be to have one
patch per arch that adds the ARCH_SUPPORTS_SCHED_* selection, then a final patch
that adds the generic definitions and removes the arch ones (which I can do if
that's a preferred approach).

Briefly tested by setting ARCH=foo and playing around with menuconfig.

Based on top of Peter's queue:
  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git -b sched/next

Patches are also available at:
  https://git.gitlab.arm.com/linux-arm/linux-vs.git -b mainline/sched/topo_kconfig_cleanup

Cheers,
Valentin

Valentin Schneider (2):
  sched: Move Kconfig.preempt to sched/Kconfig
  sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions

 arch/arm/Kconfig                          | 18 ++--------
 arch/arm64/Kconfig                        | 26 ++------------
 arch/ia64/Kconfig                         |  9 +----
 arch/mips/Kconfig                         | 10 +-----
 arch/parisc/Kconfig                       |  9 +----
 arch/powerpc/Kconfig                      |  9 +----
 arch/s390/Kconfig                         |  8 ++---
 arch/sh/Kconfig                           |  1 +
 arch/sh/mm/Kconfig                        |  9 -----
 arch/sparc/Kconfig                        | 20 ++---------
 arch/x86/Kconfig                          | 26 ++------------
 init/Kconfig                              |  2 +-
 kernel/{Kconfig.preempt => sched/Kconfig} | 41 +++++++++++++++++++++++
 13 files changed, 59 insertions(+), 129 deletions(-)
 rename kernel/{Kconfig.preempt => sched/Kconfig} (79%)

--
2.25.1

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

* [PATCH 1/2] sched: Move Kconfig.preempt to sched/Kconfig
  2021-10-08 11:53 ` Valentin Schneider
  (?)
@ 2021-10-08 11:53   ` Valentin Schneider
  -1 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Peter Zijlstra, aubrey.li, song.bao.hua, tim.c.chen,
	jonathan.cameron, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Yoshinori Sato, Rich Felker, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

Kconfig.preempt already contains more than just preemption configs (see
CONFIG_SCHED_CORE), and a subsequent patch will introduce more
scheduler-specific configs.

Move the file to the scheduler directory.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 init/Kconfig                              | 2 +-
 kernel/{Kconfig.preempt => sched/Kconfig} | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
 rename kernel/{Kconfig.preempt => sched/Kconfig} (99%)

diff --git a/init/Kconfig b/init/Kconfig
index 11f8a845f259..4caedc821b06 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -460,7 +460,7 @@ config AUDITSYSCALL
 source "kernel/irq/Kconfig"
 source "kernel/time/Kconfig"
 source "kernel/bpf/Kconfig"
-source "kernel/Kconfig.preempt"
+source "kernel/sched/Kconfig"
 
 menu "CPU/Task time and stats accounting"
 
diff --git a/kernel/Kconfig.preempt b/kernel/sched/Kconfig
similarity index 99%
rename from kernel/Kconfig.preempt
rename to kernel/sched/Kconfig
index 60f1bfc3c7b2..c8b8e12c9c9c 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/sched/Kconfig
@@ -131,5 +131,3 @@ config SCHED_CORE
 	  SCHED_CORE is default disabled. When it is enabled and unused,
 	  which is the likely usage by Linux distributions, there should
 	  be no measurable impact on performance.
-
-
-- 
2.25.1


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

* [PATCH 1/2] sched: Move Kconfig.preempt to sched/Kconfig
@ 2021-10-08 11:53   ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker,
	Geert Uytterhoeven, David Hildenbrand, Peter Zijlstra,
	Linus Walleij, Rasmus Villemoes, x86, Michal Hocko,
	James E.J. Bottomley, Paul Mackerras, H. Peter Anvin,
	Will Deacon, Ard Biesheuvel, Vincent Guittot, Arnd Bergmann,
	Yoshinori Sato, YiFei Zhu, Helge Deller, aubrey.li, Hugh Dickins,
	Russell King, Christian Borntraeger, Ingo Molnar, Mel Gorman,
	Catalin Marinas, Masahiro Yamada, Frederic Weisbecker, Kees Cook,
	Vasily Gorbik, Anshuman Khandual, Vipin Sharma, Heiko Carstens,
	Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
	Borislav Petkov, Sergei Trofimovich, jonathan.cameron,
	Thomas Gleixner, Dietmar Eggemann, Vlastimil Babka, song.bao.hua,
	Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, Chris Down,
	Daniel Bristot de Oliveira, Randy Dunlap, Nick Desaulniers,
	Andrew Morton, tim.c.chen, David S. Miller, Mike Rapoport

Kconfig.preempt already contains more than just preemption configs (see
CONFIG_SCHED_CORE), and a subsequent patch will introduce more
scheduler-specific configs.

Move the file to the scheduler directory.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 init/Kconfig                              | 2 +-
 kernel/{Kconfig.preempt => sched/Kconfig} | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
 rename kernel/{Kconfig.preempt => sched/Kconfig} (99%)

diff --git a/init/Kconfig b/init/Kconfig
index 11f8a845f259..4caedc821b06 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -460,7 +460,7 @@ config AUDITSYSCALL
 source "kernel/irq/Kconfig"
 source "kernel/time/Kconfig"
 source "kernel/bpf/Kconfig"
-source "kernel/Kconfig.preempt"
+source "kernel/sched/Kconfig"
 
 menu "CPU/Task time and stats accounting"
 
diff --git a/kernel/Kconfig.preempt b/kernel/sched/Kconfig
similarity index 99%
rename from kernel/Kconfig.preempt
rename to kernel/sched/Kconfig
index 60f1bfc3c7b2..c8b8e12c9c9c 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/sched/Kconfig
@@ -131,5 +131,3 @@ config SCHED_CORE
 	  SCHED_CORE is default disabled. When it is enabled and unused,
 	  which is the likely usage by Linux distributions, there should
 	  be no measurable impact on performance.
-
-
-- 
2.25.1


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

* [PATCH 1/2] sched: Move Kconfig.preempt to sched/Kconfig
@ 2021-10-08 11:53   ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Peter Zijlstra, aubrey.li, song.bao.hua, tim.c.chen,
	jonathan.cameron, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Yoshinori Sato, Rich Felker, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

Kconfig.preempt already contains more than just preemption configs (see
CONFIG_SCHED_CORE), and a subsequent patch will introduce more
scheduler-specific configs.

Move the file to the scheduler directory.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 init/Kconfig                              | 2 +-
 kernel/{Kconfig.preempt => sched/Kconfig} | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
 rename kernel/{Kconfig.preempt => sched/Kconfig} (99%)

diff --git a/init/Kconfig b/init/Kconfig
index 11f8a845f259..4caedc821b06 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -460,7 +460,7 @@ config AUDITSYSCALL
 source "kernel/irq/Kconfig"
 source "kernel/time/Kconfig"
 source "kernel/bpf/Kconfig"
-source "kernel/Kconfig.preempt"
+source "kernel/sched/Kconfig"
 
 menu "CPU/Task time and stats accounting"
 
diff --git a/kernel/Kconfig.preempt b/kernel/sched/Kconfig
similarity index 99%
rename from kernel/Kconfig.preempt
rename to kernel/sched/Kconfig
index 60f1bfc3c7b2..c8b8e12c9c9c 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/sched/Kconfig
@@ -131,5 +131,3 @@ config SCHED_CORE
 	  SCHED_CORE is default disabled. When it is enabled and unused,
 	  which is the likely usage by Linux distributions, there should
 	  be no measurable impact on performance.
-
-
-- 
2.25.1

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

* [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
  2021-10-08 11:53 ` Valentin Schneider
  (?)
@ 2021-10-08 11:53   ` Valentin Schneider
  -1 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Barry Song, Peter Zijlstra, aubrey.li, song.bao.hua, tim.c.chen,
	jonathan.cameron, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Yoshinori Sato, Rich Felker, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
around that highlighted that every architecture redefines its own help text
and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.

Move the definition of those to scheduler's Kconfig to centralize help text
and generic dependencies (i.e. SMP). Make them depend on a matching
ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
architecture-specific dependency.

s390 uses its own topology table (set_sched_topology()) and doesn't seem to
cope without SCHED_MC or SCHED_SMT, so those remain untogglable.

Suggested-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 arch/arm/Kconfig     | 18 ++----------------
 arch/arm64/Kconfig   | 26 +++-----------------------
 arch/ia64/Kconfig    |  9 +--------
 arch/mips/Kconfig    | 10 +---------
 arch/parisc/Kconfig  |  9 +--------
 arch/powerpc/Kconfig |  9 +--------
 arch/s390/Kconfig    |  8 ++------
 arch/sh/Kconfig      |  1 +
 arch/sh/mm/Kconfig   |  9 ---------
 arch/sparc/Kconfig   | 20 ++------------------
 arch/x86/Kconfig     | 26 +++-----------------------
 kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 60 insertions(+), 128 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..13aac98edf06 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -32,6 +32,8 @@ config ARM
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
+	select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
+	select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select ARCH_USE_MEMTEST
@@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
 	  affinity between processors which is then used to describe the cpu
 	  topology of an ARM System.
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on ARM_CPU_TOPOLOGY
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
-config SCHED_SMT
-	bool "SMT scheduler support"
-	depends on ARM_CPU_TOPOLOGY
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  MultiThreading at a cost of slightly increased overhead in some
-	  places. If unsure say N here.
-
 config HAVE_ARM_SCU
 	bool
 	help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d13677f4731d..8a49dd33f5e3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -88,6 +88,9 @@ config ARM64
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
 	select ARCH_SUPPORTS_NUMA_BALANCING
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
+	select ARCH_SUPPORTS_SCHED_CLUSTER
 	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
 	select ARCH_WANT_DEFAULT_BPF_JIT
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
@@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
 
 endchoice
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
-config SCHED_CLUSTER
-	bool "Cluster scheduler support"
-	help
-	  Cluster scheduler support improves the CPU scheduler's decision
-	  making when dealing with machines that have clusters of CPUs.
-	  Cluster usually means a couple of CPUs which are placed closely
-	  by sharing mid-level caches, last-level cache tags or internal
-	  busses.
-
-config SCHED_SMT
-	bool "SMT scheduler support"
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  MultiThreading at a cost of slightly increased overhead in some
-	  places. If unsure say N here.
-
 config NR_CPUS
 	int "Maximum number of CPUs (2-4096)"
 	range 2 4096
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 045792cde481..67f3d84242ae 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -18,6 +18,7 @@ config IA64
 	select ARCH_ENABLE_MEMORY_HOTPLUG
 	select ARCH_ENABLE_MEMORY_HOTREMOVE
 	select ARCH_SUPPORTS_ACPI
+	select ARCH_SUPPORTS_SCHED_SMT
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select FORCE_PCI
@@ -247,14 +248,6 @@ config HOTPLUG_CPU
 	  can be controlled through /sys/devices/system/cpu/cpu#.
 	  Say N if you want to disable CPU hotplug.
 
-config SCHED_SMT
-	bool "SMT scheduler support"
-	depends on SMP
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  Intel IA64 chips with MultiThreading at a cost of slightly increased
-	  overhead in some places. If unsure say N here.
-
 config PERMIT_BSP_REMOVE
 	bool "Support removal of Bootstrap Processor"
 	depends on HOTPLUG_CPU
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 771ca53af06d..cc60d440b097 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
 config MIPS_MT
 	bool
 
-config SCHED_SMT
-	bool "SMT (multithreading) scheduler support"
-	depends on SYS_SUPPORTS_SCHED_SMT
-	default n
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with MIPS MT enabled cores at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config SYS_SUPPORTS_SCHED_SMT
 	bool
+	select ARCH_SUPPORTS_SCHED_SMT
 
 config SYS_SUPPORTS_MULTITHREADING
 	bool
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4742b6f169b7..6aaa962ec2f4 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -13,6 +13,7 @@ config PARISC
 	select ARCH_NO_SG_CHAIN
 	select ARCH_SUPPORTS_HUGETLBFS if PA20
 	select ARCH_SUPPORTS_MEMORY_FAILURE
+	select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
 	select DMA_OPS
 	select RTC_CLASS
 	select RTC_DRV_GENERIC
@@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
 	help
 	  Support PARISC cpu topology definition.
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on PARISC_CPU_TOPOLOGY && PA8X00
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config IRQSTACKS
 	bool "Use separate kernel stacks when processing interrupts"
 	default y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ba5b66189358..9f45b92ccac1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -151,6 +151,7 @@ config PPC
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC	if PPC32 || PPC_BOOK3S_64
+	select ARCH_SUPPORTS_SCHED_SMT          if PPC64
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF		if PPC64
 	select ARCH_USE_MEMTEST
@@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
 config PPC_COPRO_BASE
 	bool
 
-config SCHED_SMT
-	bool "SMT (Hyperthreading) scheduler support"
-	depends on PPC64 && SMP
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with POWER5 cpus at a cost of slightly increased
-	  overhead in some places. If unsure say N here.
-
 config PPC_DENORMALISATION
 	bool "PowerPC denormalisation exception handling"
 	depends on PPC_BOOK3S_64
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b86de61b8caa..a0b4117cb1fa 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -483,12 +483,6 @@ config NODES_SHIFT
 	depends on NUMA
 	default "1"
 
-config SCHED_SMT
-	def_bool n
-
-config SCHED_MC
-	def_bool n
-
 config SCHED_BOOK
 	def_bool n
 
@@ -498,6 +492,8 @@ config SCHED_DRAWER
 config SCHED_TOPOLOGY
 	def_bool y
 	prompt "Topology scheduler support"
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
 	select SCHED_SMT
 	select SCHED_MC
 	select SCHED_BOOK
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 6904f4bdbf00..7380ee27d252 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -13,6 +13,7 @@ config SUPERH
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_SUPPORTS_SCHED_MC
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index ba569cfb4368..1d9f7006a72a 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
 
 endchoice
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on SMP
-	default y
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 endmenu
 
 menu "Cache configuration"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index b120ed947f50..a6cf30d37725 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -86,6 +86,8 @@ config SPARC64
 	select HAVE_ARCH_AUDITSYSCALL
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
 	select HAVE_NMI
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select ARCH_USE_QUEUED_RWLOCKS
@@ -290,24 +292,6 @@ if SPARC64
 source "kernel/power/Kconfig"
 endif
 
-config SCHED_SMT
-	bool "SMT (Hyperthreading) scheduler support"
-	depends on SPARC64 && SMP
-	default y
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with SPARC cpus at a cost of slightly increased overhead
-	  in some places. If unsure say N here.
-
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on SPARC64 && SMP
-	default y
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config CMDLINE_BOOL
 	bool "Default bootloader kernel arguments"
 	depends on SPARC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 349e59b2f0e3..87a91fd33d85 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -107,6 +107,9 @@ config X86
 	select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP	if NR_CPUS <= 4096
 	select ARCH_SUPPORTS_LTO_CLANG
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
+	select ARCH_SUPPORTS_SCHED_CLUSTER
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_MEMTEST
 	select ARCH_USE_QUEUED_RWLOCKS
@@ -1001,29 +1004,6 @@ config NR_CPUS
 	  This is purely to save memory: each supported CPU adds about 8KB
 	  to the kernel image.
 
-config SCHED_CLUSTER
-	bool "Cluster scheduler support"
-	depends on SMP
-	default y
-	help
-	  Cluster scheduler support improves the CPU scheduler's decision
-	  making when dealing with machines that have clusters of CPUs.
-	  Cluster usually means a couple of CPUs which are placed closely
-	  by sharing mid-level caches, last-level cache tags or internal
-	  busses.
-
-config SCHED_SMT
-	def_bool y if SMP
-
-config SCHED_MC
-	def_bool y
-	prompt "Multi-core scheduler support"
-	depends on SMP
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config SCHED_MC_PRIO
 	bool "CPU core priorities scheduler support"
 	depends on SCHED_MC && CPU_SUP_INTEL
diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
index c8b8e12c9c9c..9ceb08f42aeb 100644
--- a/kernel/sched/Kconfig
+++ b/kernel/sched/Kconfig
@@ -131,3 +131,46 @@ config SCHED_CORE
 	  SCHED_CORE is default disabled. When it is enabled and unused,
 	  which is the likely usage by Linux distributions, there should
 	  be no measurable impact on performance.
+
+
+#
+# For architectuers that want to enable generic scheduler handling of
+# different topology levels:
+#
+config ARCH_SUPPORTS_SCHED_SMT
+       bool
+
+config ARCH_SUPPORTS_SCHED_MC
+       bool
+
+config ARCH_SUPPORTS_SCHED_CLUSTER
+       bool
+
+config SCHED_SMT
+	bool "SMT scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_SMT && SMP
+	default y
+	help
+	  Improves the CPU scheduler's decision making when dealing with
+	  MultiThreading at a cost of slightly increased overhead in some
+	  places. If unsure say N here.
+
+config SCHED_MC
+	bool "Multi-core scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_MC && SMP
+	default y
+	help
+	  Multi-core scheduler support improves the CPU scheduler's decision
+	  making when dealing with multi-core CPU chips at a cost of slightly
+	  increased overhead in some places. If unsure say N here.
+
+config SCHED_CLUSTER
+	bool "Cluster scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
+	default y
+	help
+	  Cluster scheduler support improves the CPU scheduler's decision
+	  making when dealing with machines that have clusters of CPUs.
+	  Cluster usually means a couple of CPUs which are placed closely
+	  by sharing mid-level caches, last-level cache tags or internal
+	  busses.
-- 
2.25.1


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

* [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-08 11:53   ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker,
	Geert Uytterhoeven, David Hildenbrand, Peter Zijlstra,
	Linus Walleij, Rasmus Villemoes, x86, Michal Hocko,
	James E.J. Bottomley, Hugh Dickins, Paul Mackerras,
	H. Peter Anvin, Will Deacon, Ard Biesheuvel, Vincent Guittot,
	Arnd Bergmann, Yoshinori Sato, YiFei Zhu, Helge Deller,
	aubrey.li, Barry Song, Russell King, Christian Borntraeger,
	Ingo Molnar, Mel Gorman, Catalin Marinas, Masahiro Yamada,
	Frederic Weisbecker, Kees Cook, Vasily Gorbik, Anshuman Khandual,
	Vipin Sharma, Heiko Carstens, Uwe Kleine-König,
	Steven Rostedt, Nathan Chancellor, Borislav Petkov,
	Sergei Trofimovich, jonathan.cameron, Thomas Gleixner,
	Dietmar Eggemann, Vlastimil Babka, song.bao.hua, Ben Segall,
	Thomas Bogendoerfer, Daniel Borkmann, Chris Down,
	Daniel Bristot de Oliveira, Randy Dunlap, Nick Desaulniers,
	Andrew Morton, tim.c.chen, David S. Miller, Mike Rapoport

Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
around that highlighted that every architecture redefines its own help text
and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.

Move the definition of those to scheduler's Kconfig to centralize help text
and generic dependencies (i.e. SMP). Make them depend on a matching
ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
architecture-specific dependency.

s390 uses its own topology table (set_sched_topology()) and doesn't seem to
cope without SCHED_MC or SCHED_SMT, so those remain untogglable.

Suggested-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 arch/arm/Kconfig     | 18 ++----------------
 arch/arm64/Kconfig   | 26 +++-----------------------
 arch/ia64/Kconfig    |  9 +--------
 arch/mips/Kconfig    | 10 +---------
 arch/parisc/Kconfig  |  9 +--------
 arch/powerpc/Kconfig |  9 +--------
 arch/s390/Kconfig    |  8 ++------
 arch/sh/Kconfig      |  1 +
 arch/sh/mm/Kconfig   |  9 ---------
 arch/sparc/Kconfig   | 20 ++------------------
 arch/x86/Kconfig     | 26 +++-----------------------
 kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 60 insertions(+), 128 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..13aac98edf06 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -32,6 +32,8 @@ config ARM
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
+	select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
+	select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select ARCH_USE_MEMTEST
@@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
 	  affinity between processors which is then used to describe the cpu
 	  topology of an ARM System.
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on ARM_CPU_TOPOLOGY
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
-config SCHED_SMT
-	bool "SMT scheduler support"
-	depends on ARM_CPU_TOPOLOGY
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  MultiThreading at a cost of slightly increased overhead in some
-	  places. If unsure say N here.
-
 config HAVE_ARM_SCU
 	bool
 	help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d13677f4731d..8a49dd33f5e3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -88,6 +88,9 @@ config ARM64
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
 	select ARCH_SUPPORTS_NUMA_BALANCING
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
+	select ARCH_SUPPORTS_SCHED_CLUSTER
 	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
 	select ARCH_WANT_DEFAULT_BPF_JIT
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
@@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
 
 endchoice
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
-config SCHED_CLUSTER
-	bool "Cluster scheduler support"
-	help
-	  Cluster scheduler support improves the CPU scheduler's decision
-	  making when dealing with machines that have clusters of CPUs.
-	  Cluster usually means a couple of CPUs which are placed closely
-	  by sharing mid-level caches, last-level cache tags or internal
-	  busses.
-
-config SCHED_SMT
-	bool "SMT scheduler support"
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  MultiThreading at a cost of slightly increased overhead in some
-	  places. If unsure say N here.
-
 config NR_CPUS
 	int "Maximum number of CPUs (2-4096)"
 	range 2 4096
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 045792cde481..67f3d84242ae 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -18,6 +18,7 @@ config IA64
 	select ARCH_ENABLE_MEMORY_HOTPLUG
 	select ARCH_ENABLE_MEMORY_HOTREMOVE
 	select ARCH_SUPPORTS_ACPI
+	select ARCH_SUPPORTS_SCHED_SMT
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select FORCE_PCI
@@ -247,14 +248,6 @@ config HOTPLUG_CPU
 	  can be controlled through /sys/devices/system/cpu/cpu#.
 	  Say N if you want to disable CPU hotplug.
 
-config SCHED_SMT
-	bool "SMT scheduler support"
-	depends on SMP
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  Intel IA64 chips with MultiThreading at a cost of slightly increased
-	  overhead in some places. If unsure say N here.
-
 config PERMIT_BSP_REMOVE
 	bool "Support removal of Bootstrap Processor"
 	depends on HOTPLUG_CPU
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 771ca53af06d..cc60d440b097 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
 config MIPS_MT
 	bool
 
-config SCHED_SMT
-	bool "SMT (multithreading) scheduler support"
-	depends on SYS_SUPPORTS_SCHED_SMT
-	default n
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with MIPS MT enabled cores at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config SYS_SUPPORTS_SCHED_SMT
 	bool
+	select ARCH_SUPPORTS_SCHED_SMT
 
 config SYS_SUPPORTS_MULTITHREADING
 	bool
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4742b6f169b7..6aaa962ec2f4 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -13,6 +13,7 @@ config PARISC
 	select ARCH_NO_SG_CHAIN
 	select ARCH_SUPPORTS_HUGETLBFS if PA20
 	select ARCH_SUPPORTS_MEMORY_FAILURE
+	select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
 	select DMA_OPS
 	select RTC_CLASS
 	select RTC_DRV_GENERIC
@@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
 	help
 	  Support PARISC cpu topology definition.
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on PARISC_CPU_TOPOLOGY && PA8X00
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config IRQSTACKS
 	bool "Use separate kernel stacks when processing interrupts"
 	default y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ba5b66189358..9f45b92ccac1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -151,6 +151,7 @@ config PPC
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC	if PPC32 || PPC_BOOK3S_64
+	select ARCH_SUPPORTS_SCHED_SMT          if PPC64
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF		if PPC64
 	select ARCH_USE_MEMTEST
@@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
 config PPC_COPRO_BASE
 	bool
 
-config SCHED_SMT
-	bool "SMT (Hyperthreading) scheduler support"
-	depends on PPC64 && SMP
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with POWER5 cpus at a cost of slightly increased
-	  overhead in some places. If unsure say N here.
-
 config PPC_DENORMALISATION
 	bool "PowerPC denormalisation exception handling"
 	depends on PPC_BOOK3S_64
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b86de61b8caa..a0b4117cb1fa 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -483,12 +483,6 @@ config NODES_SHIFT
 	depends on NUMA
 	default "1"
 
-config SCHED_SMT
-	def_bool n
-
-config SCHED_MC
-	def_bool n
-
 config SCHED_BOOK
 	def_bool n
 
@@ -498,6 +492,8 @@ config SCHED_DRAWER
 config SCHED_TOPOLOGY
 	def_bool y
 	prompt "Topology scheduler support"
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
 	select SCHED_SMT
 	select SCHED_MC
 	select SCHED_BOOK
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 6904f4bdbf00..7380ee27d252 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -13,6 +13,7 @@ config SUPERH
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_SUPPORTS_SCHED_MC
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index ba569cfb4368..1d9f7006a72a 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
 
 endchoice
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on SMP
-	default y
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 endmenu
 
 menu "Cache configuration"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index b120ed947f50..a6cf30d37725 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -86,6 +86,8 @@ config SPARC64
 	select HAVE_ARCH_AUDITSYSCALL
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
 	select HAVE_NMI
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select ARCH_USE_QUEUED_RWLOCKS
@@ -290,24 +292,6 @@ if SPARC64
 source "kernel/power/Kconfig"
 endif
 
-config SCHED_SMT
-	bool "SMT (Hyperthreading) scheduler support"
-	depends on SPARC64 && SMP
-	default y
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with SPARC cpus at a cost of slightly increased overhead
-	  in some places. If unsure say N here.
-
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on SPARC64 && SMP
-	default y
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config CMDLINE_BOOL
 	bool "Default bootloader kernel arguments"
 	depends on SPARC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 349e59b2f0e3..87a91fd33d85 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -107,6 +107,9 @@ config X86
 	select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP	if NR_CPUS <= 4096
 	select ARCH_SUPPORTS_LTO_CLANG
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
+	select ARCH_SUPPORTS_SCHED_CLUSTER
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_MEMTEST
 	select ARCH_USE_QUEUED_RWLOCKS
@@ -1001,29 +1004,6 @@ config NR_CPUS
 	  This is purely to save memory: each supported CPU adds about 8KB
 	  to the kernel image.
 
-config SCHED_CLUSTER
-	bool "Cluster scheduler support"
-	depends on SMP
-	default y
-	help
-	  Cluster scheduler support improves the CPU scheduler's decision
-	  making when dealing with machines that have clusters of CPUs.
-	  Cluster usually means a couple of CPUs which are placed closely
-	  by sharing mid-level caches, last-level cache tags or internal
-	  busses.
-
-config SCHED_SMT
-	def_bool y if SMP
-
-config SCHED_MC
-	def_bool y
-	prompt "Multi-core scheduler support"
-	depends on SMP
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config SCHED_MC_PRIO
 	bool "CPU core priorities scheduler support"
 	depends on SCHED_MC && CPU_SUP_INTEL
diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
index c8b8e12c9c9c..9ceb08f42aeb 100644
--- a/kernel/sched/Kconfig
+++ b/kernel/sched/Kconfig
@@ -131,3 +131,46 @@ config SCHED_CORE
 	  SCHED_CORE is default disabled. When it is enabled and unused,
 	  which is the likely usage by Linux distributions, there should
 	  be no measurable impact on performance.
+
+
+#
+# For architectuers that want to enable generic scheduler handling of
+# different topology levels:
+#
+config ARCH_SUPPORTS_SCHED_SMT
+       bool
+
+config ARCH_SUPPORTS_SCHED_MC
+       bool
+
+config ARCH_SUPPORTS_SCHED_CLUSTER
+       bool
+
+config SCHED_SMT
+	bool "SMT scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_SMT && SMP
+	default y
+	help
+	  Improves the CPU scheduler's decision making when dealing with
+	  MultiThreading at a cost of slightly increased overhead in some
+	  places. If unsure say N here.
+
+config SCHED_MC
+	bool "Multi-core scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_MC && SMP
+	default y
+	help
+	  Multi-core scheduler support improves the CPU scheduler's decision
+	  making when dealing with multi-core CPU chips at a cost of slightly
+	  increased overhead in some places. If unsure say N here.
+
+config SCHED_CLUSTER
+	bool "Cluster scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
+	default y
+	help
+	  Cluster scheduler support improves the CPU scheduler's decision
+	  making when dealing with machines that have clusters of CPUs.
+	  Cluster usually means a couple of CPUs which are placed closely
+	  by sharing mid-level caches, last-level cache tags or internal
+	  busses.
-- 
2.25.1


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

* [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-08 11:53   ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
	linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
  Cc: Barry Song, Peter Zijlstra, aubrey.li, song.bao.hua, tim.c.chen,
	jonathan.cameron, Russell King, Catalin Marinas, Will Deacon,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Yoshinori Sato, Rich Felker, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
around that highlighted that every architecture redefines its own help text
and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.

Move the definition of those to scheduler's Kconfig to centralize help text
and generic dependencies (i.e. SMP). Make them depend on a matching
ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
architecture-specific dependency.

s390 uses its own topology table (set_sched_topology()) and doesn't seem to
cope without SCHED_MC or SCHED_SMT, so those remain untogglable.

Suggested-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 arch/arm/Kconfig     | 18 ++----------------
 arch/arm64/Kconfig   | 26 +++-----------------------
 arch/ia64/Kconfig    |  9 +--------
 arch/mips/Kconfig    | 10 +---------
 arch/parisc/Kconfig  |  9 +--------
 arch/powerpc/Kconfig |  9 +--------
 arch/s390/Kconfig    |  8 ++------
 arch/sh/Kconfig      |  1 +
 arch/sh/mm/Kconfig   |  9 ---------
 arch/sparc/Kconfig   | 20 ++------------------
 arch/x86/Kconfig     | 26 +++-----------------------
 kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 60 insertions(+), 128 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..13aac98edf06 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -32,6 +32,8 @@ config ARM
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
+	select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
+	select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select ARCH_USE_MEMTEST
@@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
 	  affinity between processors which is then used to describe the cpu
 	  topology of an ARM System.
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on ARM_CPU_TOPOLOGY
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
-config SCHED_SMT
-	bool "SMT scheduler support"
-	depends on ARM_CPU_TOPOLOGY
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  MultiThreading at a cost of slightly increased overhead in some
-	  places. If unsure say N here.
-
 config HAVE_ARM_SCU
 	bool
 	help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d13677f4731d..8a49dd33f5e3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -88,6 +88,9 @@ config ARM64
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
 	select ARCH_SUPPORTS_NUMA_BALANCING
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
+	select ARCH_SUPPORTS_SCHED_CLUSTER
 	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
 	select ARCH_WANT_DEFAULT_BPF_JIT
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
@@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
 
 endchoice
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
-config SCHED_CLUSTER
-	bool "Cluster scheduler support"
-	help
-	  Cluster scheduler support improves the CPU scheduler's decision
-	  making when dealing with machines that have clusters of CPUs.
-	  Cluster usually means a couple of CPUs which are placed closely
-	  by sharing mid-level caches, last-level cache tags or internal
-	  busses.
-
-config SCHED_SMT
-	bool "SMT scheduler support"
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  MultiThreading at a cost of slightly increased overhead in some
-	  places. If unsure say N here.
-
 config NR_CPUS
 	int "Maximum number of CPUs (2-4096)"
 	range 2 4096
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 045792cde481..67f3d84242ae 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -18,6 +18,7 @@ config IA64
 	select ARCH_ENABLE_MEMORY_HOTPLUG
 	select ARCH_ENABLE_MEMORY_HOTREMOVE
 	select ARCH_SUPPORTS_ACPI
+	select ARCH_SUPPORTS_SCHED_SMT
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
 	select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
 	select FORCE_PCI
@@ -247,14 +248,6 @@ config HOTPLUG_CPU
 	  can be controlled through /sys/devices/system/cpu/cpu#.
 	  Say N if you want to disable CPU hotplug.
 
-config SCHED_SMT
-	bool "SMT scheduler support"
-	depends on SMP
-	help
-	  Improves the CPU scheduler's decision making when dealing with
-	  Intel IA64 chips with MultiThreading at a cost of slightly increased
-	  overhead in some places. If unsure say N here.
-
 config PERMIT_BSP_REMOVE
 	bool "Support removal of Bootstrap Processor"
 	depends on HOTPLUG_CPU
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 771ca53af06d..cc60d440b097 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
 config MIPS_MT
 	bool
 
-config SCHED_SMT
-	bool "SMT (multithreading) scheduler support"
-	depends on SYS_SUPPORTS_SCHED_SMT
-	default n
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with MIPS MT enabled cores at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config SYS_SUPPORTS_SCHED_SMT
 	bool
+	select ARCH_SUPPORTS_SCHED_SMT
 
 config SYS_SUPPORTS_MULTITHREADING
 	bool
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4742b6f169b7..6aaa962ec2f4 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -13,6 +13,7 @@ config PARISC
 	select ARCH_NO_SG_CHAIN
 	select ARCH_SUPPORTS_HUGETLBFS if PA20
 	select ARCH_SUPPORTS_MEMORY_FAILURE
+	select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
 	select DMA_OPS
 	select RTC_CLASS
 	select RTC_DRV_GENERIC
@@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
 	help
 	  Support PARISC cpu topology definition.
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on PARISC_CPU_TOPOLOGY && PA8X00
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config IRQSTACKS
 	bool "Use separate kernel stacks when processing interrupts"
 	default y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ba5b66189358..9f45b92ccac1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -151,6 +151,7 @@ config PPC
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC	if PPC32 || PPC_BOOK3S_64
+	select ARCH_SUPPORTS_SCHED_SMT          if PPC64
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF		if PPC64
 	select ARCH_USE_MEMTEST
@@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
 config PPC_COPRO_BASE
 	bool
 
-config SCHED_SMT
-	bool "SMT (Hyperthreading) scheduler support"
-	depends on PPC64 && SMP
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with POWER5 cpus at a cost of slightly increased
-	  overhead in some places. If unsure say N here.
-
 config PPC_DENORMALISATION
 	bool "PowerPC denormalisation exception handling"
 	depends on PPC_BOOK3S_64
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b86de61b8caa..a0b4117cb1fa 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -483,12 +483,6 @@ config NODES_SHIFT
 	depends on NUMA
 	default "1"
 
-config SCHED_SMT
-	def_bool n
-
-config SCHED_MC
-	def_bool n
-
 config SCHED_BOOK
 	def_bool n
 
@@ -498,6 +492,8 @@ config SCHED_DRAWER
 config SCHED_TOPOLOGY
 	def_bool y
 	prompt "Topology scheduler support"
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
 	select SCHED_SMT
 	select SCHED_MC
 	select SCHED_BOOK
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 6904f4bdbf00..7380ee27d252 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -13,6 +13,7 @@ config SUPERH
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_SUPPORTS_SCHED_MC
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index ba569cfb4368..1d9f7006a72a 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
 
 endchoice
 
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on SMP
-	default y
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 endmenu
 
 menu "Cache configuration"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index b120ed947f50..a6cf30d37725 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -86,6 +86,8 @@ config SPARC64
 	select HAVE_ARCH_AUDITSYSCALL
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
 	select HAVE_NMI
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select ARCH_USE_QUEUED_RWLOCKS
@@ -290,24 +292,6 @@ if SPARC64
 source "kernel/power/Kconfig"
 endif
 
-config SCHED_SMT
-	bool "SMT (Hyperthreading) scheduler support"
-	depends on SPARC64 && SMP
-	default y
-	help
-	  SMT scheduler support improves the CPU scheduler's decision making
-	  when dealing with SPARC cpus at a cost of slightly increased overhead
-	  in some places. If unsure say N here.
-
-config SCHED_MC
-	bool "Multi-core scheduler support"
-	depends on SPARC64 && SMP
-	default y
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config CMDLINE_BOOL
 	bool "Default bootloader kernel arguments"
 	depends on SPARC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 349e59b2f0e3..87a91fd33d85 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -107,6 +107,9 @@ config X86
 	select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP	if NR_CPUS <= 4096
 	select ARCH_SUPPORTS_LTO_CLANG
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
+	select ARCH_SUPPORTS_SCHED_SMT
+	select ARCH_SUPPORTS_SCHED_MC
+	select ARCH_SUPPORTS_SCHED_CLUSTER
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_MEMTEST
 	select ARCH_USE_QUEUED_RWLOCKS
@@ -1001,29 +1004,6 @@ config NR_CPUS
 	  This is purely to save memory: each supported CPU adds about 8KB
 	  to the kernel image.
 
-config SCHED_CLUSTER
-	bool "Cluster scheduler support"
-	depends on SMP
-	default y
-	help
-	  Cluster scheduler support improves the CPU scheduler's decision
-	  making when dealing with machines that have clusters of CPUs.
-	  Cluster usually means a couple of CPUs which are placed closely
-	  by sharing mid-level caches, last-level cache tags or internal
-	  busses.
-
-config SCHED_SMT
-	def_bool y if SMP
-
-config SCHED_MC
-	def_bool y
-	prompt "Multi-core scheduler support"
-	depends on SMP
-	help
-	  Multi-core scheduler support improves the CPU scheduler's decision
-	  making when dealing with multi-core CPU chips at a cost of slightly
-	  increased overhead in some places. If unsure say N here.
-
 config SCHED_MC_PRIO
 	bool "CPU core priorities scheduler support"
 	depends on SCHED_MC && CPU_SUP_INTEL
diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
index c8b8e12c9c9c..9ceb08f42aeb 100644
--- a/kernel/sched/Kconfig
+++ b/kernel/sched/Kconfig
@@ -131,3 +131,46 @@ config SCHED_CORE
 	  SCHED_CORE is default disabled. When it is enabled and unused,
 	  which is the likely usage by Linux distributions, there should
 	  be no measurable impact on performance.
+
+
+#
+# For architectuers that want to enable generic scheduler handling of
+# different topology levels:
+#
+config ARCH_SUPPORTS_SCHED_SMT
+       bool
+
+config ARCH_SUPPORTS_SCHED_MC
+       bool
+
+config ARCH_SUPPORTS_SCHED_CLUSTER
+       bool
+
+config SCHED_SMT
+	bool "SMT scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_SMT && SMP
+	default y
+	help
+	  Improves the CPU scheduler's decision making when dealing with
+	  MultiThreading at a cost of slightly increased overhead in some
+	  places. If unsure say N here.
+
+config SCHED_MC
+	bool "Multi-core scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_MC && SMP
+	default y
+	help
+	  Multi-core scheduler support improves the CPU scheduler's decision
+	  making when dealing with multi-core CPU chips at a cost of slightly
+	  increased overhead in some places. If unsure say N here.
+
+config SCHED_CLUSTER
+	bool "Cluster scheduler support"
+	depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
+	default y
+	help
+	  Cluster scheduler support improves the CPU scheduler's decision
+	  making when dealing with machines that have clusters of CPUs.
+	  Cluster usually means a couple of CPUs which are placed closely
+	  by sharing mid-level caches, last-level cache tags or internal
+	  busses.
-- 
2.25.1

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
  2021-10-08 11:53   ` Valentin Schneider
  (?)
@ 2021-10-08 12:37     ` Barry Song
  -1 siblings, 0 replies; 18+ messages in thread
From: Barry Song @ 2021-10-08 12:37 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: LKML, LAK, linux-ia64, linux-mips, linux-parisc, linuxppc-dev,
	linux-s390, linux-sh, sparclinux, Peter Zijlstra, Aubrey Li,
	Barry Song, Tim Chen, Jonathan Cameron, Russell King,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
<valentin.schneider@arm.com> wrote:
>
> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
> around that highlighted that every architecture redefines its own help text
> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>
> Move the definition of those to scheduler's Kconfig to centralize help text
> and generic dependencies (i.e. SMP). Make them depend on a matching
> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
> architecture-specific dependency.
>
> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>

Hi Valentin,
Thanks!
I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
is always beneficial of all platforms. It would be perfect if the patch has no
side effects and doesn't change the existing behaviour. But it has side effects
by changing the default N to Y on a couple of platforms.


> Suggested-by: Barry Song <21cnbao@gmail.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
>  arch/arm/Kconfig     | 18 ++----------------
>  arch/arm64/Kconfig   | 26 +++-----------------------
>  arch/ia64/Kconfig    |  9 +--------
>  arch/mips/Kconfig    | 10 +---------
>  arch/parisc/Kconfig  |  9 +--------
>  arch/powerpc/Kconfig |  9 +--------
>  arch/s390/Kconfig    |  8 ++------
>  arch/sh/Kconfig      |  1 +
>  arch/sh/mm/Kconfig   |  9 ---------
>  arch/sparc/Kconfig   | 20 ++------------------
>  arch/x86/Kconfig     | 26 +++-----------------------
>  kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
>  12 files changed, 60 insertions(+), 128 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..13aac98edf06 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -32,6 +32,8 @@ config ARM
>         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
> +       select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
> +       select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_CMPXCHG_LOCKREF
>         select ARCH_USE_MEMTEST
> @@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
>           affinity between processors which is then used to describe the cpu
>           topology of an ARM System.
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on ARM_CPU_TOPOLOGY
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       depends on ARM_CPU_TOPOLOGY
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         MultiThreading at a cost of slightly increased overhead in some
> -         places. If unsure say N here.
> -
>  config HAVE_ARM_SCU
>         bool
>         help
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d13677f4731d..8a49dd33f5e3 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -88,6 +88,9 @@ config ARM64
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
>         select ARCH_SUPPORTS_NUMA_BALANCING
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
> +       select ARCH_SUPPORTS_SCHED_CLUSTER
>         select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
>         select ARCH_WANT_DEFAULT_BPF_JIT
>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> @@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
>
>  endchoice
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
> -config SCHED_CLUSTER
> -       bool "Cluster scheduler support"
> -       help
> -         Cluster scheduler support improves the CPU scheduler's decision
> -         making when dealing with machines that have clusters of CPUs.
> -         Cluster usually means a couple of CPUs which are placed closely
> -         by sharing mid-level caches, last-level cache tags or internal
> -         busses.
> -
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         MultiThreading at a cost of slightly increased overhead in some
> -         places. If unsure say N here.
> -
>  config NR_CPUS
>         int "Maximum number of CPUs (2-4096)"
>         range 2 4096
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index 045792cde481..67f3d84242ae 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -18,6 +18,7 @@ config IA64
>         select ARCH_ENABLE_MEMORY_HOTPLUG
>         select ARCH_ENABLE_MEMORY_HOTREMOVE
>         select ARCH_SUPPORTS_ACPI
> +       select ARCH_SUPPORTS_SCHED_SMT
>         select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
>         select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
>         select FORCE_PCI
> @@ -247,14 +248,6 @@ config HOTPLUG_CPU
>           can be controlled through /sys/devices/system/cpu/cpu#.
>           Say N if you want to disable CPU hotplug.
>
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       depends on SMP
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         Intel IA64 chips with MultiThreading at a cost of slightly increased
> -         overhead in some places. If unsure say N here.
> -
>  config PERMIT_BSP_REMOVE
>         bool "Support removal of Bootstrap Processor"
>         depends on HOTPLUG_CPU
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 771ca53af06d..cc60d440b097 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
>  config MIPS_MT
>         bool
>
> -config SCHED_SMT
> -       bool "SMT (multithreading) scheduler support"
> -       depends on SYS_SUPPORTS_SCHED_SMT
> -       default n
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with MIPS MT enabled cores at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config SYS_SUPPORTS_SCHED_SMT
>         bool
> +       select ARCH_SUPPORTS_SCHED_SMT
>
>  config SYS_SUPPORTS_MULTITHREADING
>         bool
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 4742b6f169b7..6aaa962ec2f4 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -13,6 +13,7 @@ config PARISC
>         select ARCH_NO_SG_CHAIN
>         select ARCH_SUPPORTS_HUGETLBFS if PA20
>         select ARCH_SUPPORTS_MEMORY_FAILURE
> +       select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
>         select DMA_OPS
>         select RTC_CLASS
>         select RTC_DRV_GENERIC
> @@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
>         help
>           Support PARISC cpu topology definition.
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on PARISC_CPU_TOPOLOGY && PA8X00
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config IRQSTACKS
>         bool "Use separate kernel stacks when processing interrupts"
>         default y
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index ba5b66189358..9f45b92ccac1 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -151,6 +151,7 @@ config PPC
>         select ARCH_STACKWALK
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC    if PPC32 || PPC_BOOK3S_64
> +       select ARCH_SUPPORTS_SCHED_SMT          if PPC64
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_CMPXCHG_LOCKREF         if PPC64
>         select ARCH_USE_MEMTEST
> @@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
>  config PPC_COPRO_BASE
>         bool
>
> -config SCHED_SMT
> -       bool "SMT (Hyperthreading) scheduler support"
> -       depends on PPC64 && SMP
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with POWER5 cpus at a cost of slightly increased
> -         overhead in some places. If unsure say N here.
> -
>  config PPC_DENORMALISATION
>         bool "PowerPC denormalisation exception handling"
>         depends on PPC_BOOK3S_64
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index b86de61b8caa..a0b4117cb1fa 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -483,12 +483,6 @@ config NODES_SHIFT
>         depends on NUMA
>         default "1"
>
> -config SCHED_SMT
> -       def_bool n
> -
> -config SCHED_MC
> -       def_bool n
> -
>  config SCHED_BOOK
>         def_bool n
>
> @@ -498,6 +492,8 @@ config SCHED_DRAWER
>  config SCHED_TOPOLOGY
>         def_bool y
>         prompt "Topology scheduler support"
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select SCHED_SMT
>         select SCHED_MC
>         select SCHED_BOOK
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 6904f4bdbf00..7380ee27d252 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -13,6 +13,7 @@ config SUPERH
>         select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>         select ARCH_HIBERNATION_POSSIBLE if MMU
>         select ARCH_MIGHT_HAVE_PC_PARPORT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select ARCH_WANT_IPC_PARSE_VERSION
>         select CPU_NO_EFFICIENT_FFS
>         select DMA_DECLARE_COHERENT
> diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
> index ba569cfb4368..1d9f7006a72a 100644
> --- a/arch/sh/mm/Kconfig
> +++ b/arch/sh/mm/Kconfig
> @@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
>
>  endchoice
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on SMP
> -       default y
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  endmenu
>
>  menu "Cache configuration"
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index b120ed947f50..a6cf30d37725 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -86,6 +86,8 @@ config SPARC64
>         select HAVE_ARCH_AUDITSYSCALL
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select HAVE_NMI
>         select HAVE_REGS_AND_STACK_ACCESS_API
>         select ARCH_USE_QUEUED_RWLOCKS
> @@ -290,24 +292,6 @@ if SPARC64
>  source "kernel/power/Kconfig"
>  endif
>
> -config SCHED_SMT
> -       bool "SMT (Hyperthreading) scheduler support"
> -       depends on SPARC64 && SMP
> -       default y
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with SPARC cpus at a cost of slightly increased overhead
> -         in some places. If unsure say N here.
> -
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on SPARC64 && SMP
> -       default y
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config CMDLINE_BOOL
>         bool "Default bootloader kernel arguments"
>         depends on SPARC64
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 349e59b2f0e3..87a91fd33d85 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -107,6 +107,9 @@ config X86
>         select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP       if NR_CPUS <= 4096
>         select ARCH_SUPPORTS_LTO_CLANG
>         select ARCH_SUPPORTS_LTO_CLANG_THIN
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
> +       select ARCH_SUPPORTS_SCHED_CLUSTER
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_MEMTEST
>         select ARCH_USE_QUEUED_RWLOCKS
> @@ -1001,29 +1004,6 @@ config NR_CPUS
>           This is purely to save memory: each supported CPU adds about 8KB
>           to the kernel image.
>
> -config SCHED_CLUSTER
> -       bool "Cluster scheduler support"
> -       depends on SMP
> -       default y
> -       help
> -         Cluster scheduler support improves the CPU scheduler's decision
> -         making when dealing with machines that have clusters of CPUs.
> -         Cluster usually means a couple of CPUs which are placed closely
> -         by sharing mid-level caches, last-level cache tags or internal
> -         busses.
> -
> -config SCHED_SMT
> -       def_bool y if SMP
> -
> -config SCHED_MC
> -       def_bool y
> -       prompt "Multi-core scheduler support"
> -       depends on SMP
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config SCHED_MC_PRIO
>         bool "CPU core priorities scheduler support"
>         depends on SCHED_MC && CPU_SUP_INTEL
> diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
> index c8b8e12c9c9c..9ceb08f42aeb 100644
> --- a/kernel/sched/Kconfig
> +++ b/kernel/sched/Kconfig
> @@ -131,3 +131,46 @@ config SCHED_CORE
>           SCHED_CORE is default disabled. When it is enabled and unused,
>           which is the likely usage by Linux distributions, there should
>           be no measurable impact on performance.
> +
> +
> +#
> +# For architectuers that want to enable generic scheduler handling of
> +# different topology levels:
> +#
> +config ARCH_SUPPORTS_SCHED_SMT
> +       bool
> +
> +config ARCH_SUPPORTS_SCHED_MC
> +       bool
> +
> +config ARCH_SUPPORTS_SCHED_CLUSTER
> +       bool
> +
> +config SCHED_SMT
> +       bool "SMT scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_SMT && SMP
> +       default y
> +       help
> +         Improves the CPU scheduler's decision making when dealing with
> +         MultiThreading at a cost of slightly increased overhead in some
> +         places. If unsure say N here.
> +
> +config SCHED_MC
> +       bool "Multi-core scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_MC && SMP
> +       default y
> +       help
> +         Multi-core scheduler support improves the CPU scheduler's decision
> +         making when dealing with multi-core CPU chips at a cost of slightly
> +         increased overhead in some places. If unsure say N here.
> +
> +config SCHED_CLUSTER
> +       bool "Cluster scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
> +       default y
> +       help
> +         Cluster scheduler support improves the CPU scheduler's decision
> +         making when dealing with machines that have clusters of CPUs.
> +         Cluster usually means a couple of CPUs which are placed closely
> +         by sharing mid-level caches, last-level cache tags or internal
> +         busses.
> --
> 2.25.1
>

Thanks
barry

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-08 12:37     ` Barry Song
  0 siblings, 0 replies; 18+ messages in thread
From: Barry Song @ 2021-10-08 12:37 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker, linux-ia64,
	Geert Uytterhoeven, linux-sh, Peter Zijlstra, Catalin Marinas,
	Linus Walleij, David Hildenbrand, x86, linux-mips,
	James E.J. Bottomley, Hugh Dickins, Paul Mackerras,
	H. Peter Anvin, sparclinux, Will Deacon, Ard Biesheuvel,
	linux-s390, Vincent Guittot, Arnd Bergmann, Yoshinori Sato,
	YiFei Zhu, Helge Deller, Aubrey Li, Daniel Bristot de Oliveira,
	Russell King, Christian Borntraeger, Ingo Molnar, Mel Gorman,
	Masahiro Yamada, Frederic Weisbecker, Kees Cook, Vasily Gorbik,
	Anshuman Khandual, Vlastimil Babka, Vipin Sharma, Heiko Carstens,
	Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
	Borislav Petkov, Sergei Trofimovich, Jonathan Cameron,
	Thomas Gleixner, Michal Hocko, Dietmar Eggemann, LAK, Barry Song,
	Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, linux-parisc,
	Chris Down, linuxppc-dev, Randy Dunlap, Nick Desaulniers, LKML,
	Rasmus Villemoes, Andrew Morton, Tim Chen, David S. Miller,
	Mike Rapoport

On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
<valentin.schneider@arm.com> wrote:
>
> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
> around that highlighted that every architecture redefines its own help text
> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>
> Move the definition of those to scheduler's Kconfig to centralize help text
> and generic dependencies (i.e. SMP). Make them depend on a matching
> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
> architecture-specific dependency.
>
> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>

Hi Valentin,
Thanks!
I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
is always beneficial of all platforms. It would be perfect if the patch has no
side effects and doesn't change the existing behaviour. But it has side effects
by changing the default N to Y on a couple of platforms.


> Suggested-by: Barry Song <21cnbao@gmail.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
>  arch/arm/Kconfig     | 18 ++----------------
>  arch/arm64/Kconfig   | 26 +++-----------------------
>  arch/ia64/Kconfig    |  9 +--------
>  arch/mips/Kconfig    | 10 +---------
>  arch/parisc/Kconfig  |  9 +--------
>  arch/powerpc/Kconfig |  9 +--------
>  arch/s390/Kconfig    |  8 ++------
>  arch/sh/Kconfig      |  1 +
>  arch/sh/mm/Kconfig   |  9 ---------
>  arch/sparc/Kconfig   | 20 ++------------------
>  arch/x86/Kconfig     | 26 +++-----------------------
>  kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
>  12 files changed, 60 insertions(+), 128 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..13aac98edf06 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -32,6 +32,8 @@ config ARM
>         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
> +       select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
> +       select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_CMPXCHG_LOCKREF
>         select ARCH_USE_MEMTEST
> @@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
>           affinity between processors which is then used to describe the cpu
>           topology of an ARM System.
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on ARM_CPU_TOPOLOGY
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       depends on ARM_CPU_TOPOLOGY
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         MultiThreading at a cost of slightly increased overhead in some
> -         places. If unsure say N here.
> -
>  config HAVE_ARM_SCU
>         bool
>         help
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d13677f4731d..8a49dd33f5e3 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -88,6 +88,9 @@ config ARM64
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
>         select ARCH_SUPPORTS_NUMA_BALANCING
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
> +       select ARCH_SUPPORTS_SCHED_CLUSTER
>         select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
>         select ARCH_WANT_DEFAULT_BPF_JIT
>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> @@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
>
>  endchoice
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
> -config SCHED_CLUSTER
> -       bool "Cluster scheduler support"
> -       help
> -         Cluster scheduler support improves the CPU scheduler's decision
> -         making when dealing with machines that have clusters of CPUs.
> -         Cluster usually means a couple of CPUs which are placed closely
> -         by sharing mid-level caches, last-level cache tags or internal
> -         busses.
> -
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         MultiThreading at a cost of slightly increased overhead in some
> -         places. If unsure say N here.
> -
>  config NR_CPUS
>         int "Maximum number of CPUs (2-4096)"
>         range 2 4096
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index 045792cde481..67f3d84242ae 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -18,6 +18,7 @@ config IA64
>         select ARCH_ENABLE_MEMORY_HOTPLUG
>         select ARCH_ENABLE_MEMORY_HOTREMOVE
>         select ARCH_SUPPORTS_ACPI
> +       select ARCH_SUPPORTS_SCHED_SMT
>         select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
>         select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
>         select FORCE_PCI
> @@ -247,14 +248,6 @@ config HOTPLUG_CPU
>           can be controlled through /sys/devices/system/cpu/cpu#.
>           Say N if you want to disable CPU hotplug.
>
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       depends on SMP
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         Intel IA64 chips with MultiThreading at a cost of slightly increased
> -         overhead in some places. If unsure say N here.
> -
>  config PERMIT_BSP_REMOVE
>         bool "Support removal of Bootstrap Processor"
>         depends on HOTPLUG_CPU
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 771ca53af06d..cc60d440b097 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
>  config MIPS_MT
>         bool
>
> -config SCHED_SMT
> -       bool "SMT (multithreading) scheduler support"
> -       depends on SYS_SUPPORTS_SCHED_SMT
> -       default n
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with MIPS MT enabled cores at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config SYS_SUPPORTS_SCHED_SMT
>         bool
> +       select ARCH_SUPPORTS_SCHED_SMT
>
>  config SYS_SUPPORTS_MULTITHREADING
>         bool
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 4742b6f169b7..6aaa962ec2f4 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -13,6 +13,7 @@ config PARISC
>         select ARCH_NO_SG_CHAIN
>         select ARCH_SUPPORTS_HUGETLBFS if PA20
>         select ARCH_SUPPORTS_MEMORY_FAILURE
> +       select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
>         select DMA_OPS
>         select RTC_CLASS
>         select RTC_DRV_GENERIC
> @@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
>         help
>           Support PARISC cpu topology definition.
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on PARISC_CPU_TOPOLOGY && PA8X00
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config IRQSTACKS
>         bool "Use separate kernel stacks when processing interrupts"
>         default y
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index ba5b66189358..9f45b92ccac1 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -151,6 +151,7 @@ config PPC
>         select ARCH_STACKWALK
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC    if PPC32 || PPC_BOOK3S_64
> +       select ARCH_SUPPORTS_SCHED_SMT          if PPC64
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_CMPXCHG_LOCKREF         if PPC64
>         select ARCH_USE_MEMTEST
> @@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
>  config PPC_COPRO_BASE
>         bool
>
> -config SCHED_SMT
> -       bool "SMT (Hyperthreading) scheduler support"
> -       depends on PPC64 && SMP
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with POWER5 cpus at a cost of slightly increased
> -         overhead in some places. If unsure say N here.
> -
>  config PPC_DENORMALISATION
>         bool "PowerPC denormalisation exception handling"
>         depends on PPC_BOOK3S_64
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index b86de61b8caa..a0b4117cb1fa 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -483,12 +483,6 @@ config NODES_SHIFT
>         depends on NUMA
>         default "1"
>
> -config SCHED_SMT
> -       def_bool n
> -
> -config SCHED_MC
> -       def_bool n
> -
>  config SCHED_BOOK
>         def_bool n
>
> @@ -498,6 +492,8 @@ config SCHED_DRAWER
>  config SCHED_TOPOLOGY
>         def_bool y
>         prompt "Topology scheduler support"
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select SCHED_SMT
>         select SCHED_MC
>         select SCHED_BOOK
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 6904f4bdbf00..7380ee27d252 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -13,6 +13,7 @@ config SUPERH
>         select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>         select ARCH_HIBERNATION_POSSIBLE if MMU
>         select ARCH_MIGHT_HAVE_PC_PARPORT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select ARCH_WANT_IPC_PARSE_VERSION
>         select CPU_NO_EFFICIENT_FFS
>         select DMA_DECLARE_COHERENT
> diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
> index ba569cfb4368..1d9f7006a72a 100644
> --- a/arch/sh/mm/Kconfig
> +++ b/arch/sh/mm/Kconfig
> @@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
>
>  endchoice
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on SMP
> -       default y
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  endmenu
>
>  menu "Cache configuration"
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index b120ed947f50..a6cf30d37725 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -86,6 +86,8 @@ config SPARC64
>         select HAVE_ARCH_AUDITSYSCALL
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select HAVE_NMI
>         select HAVE_REGS_AND_STACK_ACCESS_API
>         select ARCH_USE_QUEUED_RWLOCKS
> @@ -290,24 +292,6 @@ if SPARC64
>  source "kernel/power/Kconfig"
>  endif
>
> -config SCHED_SMT
> -       bool "SMT (Hyperthreading) scheduler support"
> -       depends on SPARC64 && SMP
> -       default y
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with SPARC cpus at a cost of slightly increased overhead
> -         in some places. If unsure say N here.
> -
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on SPARC64 && SMP
> -       default y
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config CMDLINE_BOOL
>         bool "Default bootloader kernel arguments"
>         depends on SPARC64
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 349e59b2f0e3..87a91fd33d85 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -107,6 +107,9 @@ config X86
>         select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP       if NR_CPUS <= 4096
>         select ARCH_SUPPORTS_LTO_CLANG
>         select ARCH_SUPPORTS_LTO_CLANG_THIN
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
> +       select ARCH_SUPPORTS_SCHED_CLUSTER
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_MEMTEST
>         select ARCH_USE_QUEUED_RWLOCKS
> @@ -1001,29 +1004,6 @@ config NR_CPUS
>           This is purely to save memory: each supported CPU adds about 8KB
>           to the kernel image.
>
> -config SCHED_CLUSTER
> -       bool "Cluster scheduler support"
> -       depends on SMP
> -       default y
> -       help
> -         Cluster scheduler support improves the CPU scheduler's decision
> -         making when dealing with machines that have clusters of CPUs.
> -         Cluster usually means a couple of CPUs which are placed closely
> -         by sharing mid-level caches, last-level cache tags or internal
> -         busses.
> -
> -config SCHED_SMT
> -       def_bool y if SMP
> -
> -config SCHED_MC
> -       def_bool y
> -       prompt "Multi-core scheduler support"
> -       depends on SMP
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config SCHED_MC_PRIO
>         bool "CPU core priorities scheduler support"
>         depends on SCHED_MC && CPU_SUP_INTEL
> diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
> index c8b8e12c9c9c..9ceb08f42aeb 100644
> --- a/kernel/sched/Kconfig
> +++ b/kernel/sched/Kconfig
> @@ -131,3 +131,46 @@ config SCHED_CORE
>           SCHED_CORE is default disabled. When it is enabled and unused,
>           which is the likely usage by Linux distributions, there should
>           be no measurable impact on performance.
> +
> +
> +#
> +# For architectuers that want to enable generic scheduler handling of
> +# different topology levels:
> +#
> +config ARCH_SUPPORTS_SCHED_SMT
> +       bool
> +
> +config ARCH_SUPPORTS_SCHED_MC
> +       bool
> +
> +config ARCH_SUPPORTS_SCHED_CLUSTER
> +       bool
> +
> +config SCHED_SMT
> +       bool "SMT scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_SMT && SMP
> +       default y
> +       help
> +         Improves the CPU scheduler's decision making when dealing with
> +         MultiThreading at a cost of slightly increased overhead in some
> +         places. If unsure say N here.
> +
> +config SCHED_MC
> +       bool "Multi-core scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_MC && SMP
> +       default y
> +       help
> +         Multi-core scheduler support improves the CPU scheduler's decision
> +         making when dealing with multi-core CPU chips at a cost of slightly
> +         increased overhead in some places. If unsure say N here.
> +
> +config SCHED_CLUSTER
> +       bool "Cluster scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
> +       default y
> +       help
> +         Cluster scheduler support improves the CPU scheduler's decision
> +         making when dealing with machines that have clusters of CPUs.
> +         Cluster usually means a couple of CPUs which are placed closely
> +         by sharing mid-level caches, last-level cache tags or internal
> +         busses.
> --
> 2.25.1
>

Thanks
barry

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-08 12:37     ` Barry Song
  0 siblings, 0 replies; 18+ messages in thread
From: Barry Song @ 2021-10-08 12:37 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: LKML, LAK, linux-ia64, linux-mips, linux-parisc, linuxppc-dev,
	linux-s390, linux-sh, sparclinux, Peter Zijlstra, Aubrey Li,
	Barry Song, Tim Chen, Jonathan Cameron, Russell King,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
<valentin.schneider@arm.com> wrote:
>
> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
> around that highlighted that every architecture redefines its own help text
> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>
> Move the definition of those to scheduler's Kconfig to centralize help text
> and generic dependencies (i.e. SMP). Make them depend on a matching
> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
> architecture-specific dependency.
>
> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>

Hi Valentin,
Thanks!
I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
is always beneficial of all platforms. It would be perfect if the patch has no
side effects and doesn't change the existing behaviour. But it has side effects
by changing the default N to Y on a couple of platforms.


> Suggested-by: Barry Song <21cnbao@gmail.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
>  arch/arm/Kconfig     | 18 ++----------------
>  arch/arm64/Kconfig   | 26 +++-----------------------
>  arch/ia64/Kconfig    |  9 +--------
>  arch/mips/Kconfig    | 10 +---------
>  arch/parisc/Kconfig  |  9 +--------
>  arch/powerpc/Kconfig |  9 +--------
>  arch/s390/Kconfig    |  8 ++------
>  arch/sh/Kconfig      |  1 +
>  arch/sh/mm/Kconfig   |  9 ---------
>  arch/sparc/Kconfig   | 20 ++------------------
>  arch/x86/Kconfig     | 26 +++-----------------------
>  kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
>  12 files changed, 60 insertions(+), 128 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..13aac98edf06 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -32,6 +32,8 @@ config ARM
>         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
> +       select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
> +       select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_CMPXCHG_LOCKREF
>         select ARCH_USE_MEMTEST
> @@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
>           affinity between processors which is then used to describe the cpu
>           topology of an ARM System.
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on ARM_CPU_TOPOLOGY
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       depends on ARM_CPU_TOPOLOGY
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         MultiThreading at a cost of slightly increased overhead in some
> -         places. If unsure say N here.
> -
>  config HAVE_ARM_SCU
>         bool
>         help
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d13677f4731d..8a49dd33f5e3 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -88,6 +88,9 @@ config ARM64
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
>         select ARCH_SUPPORTS_NUMA_BALANCING
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
> +       select ARCH_SUPPORTS_SCHED_CLUSTER
>         select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
>         select ARCH_WANT_DEFAULT_BPF_JIT
>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> @@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
>
>  endchoice
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
> -config SCHED_CLUSTER
> -       bool "Cluster scheduler support"
> -       help
> -         Cluster scheduler support improves the CPU scheduler's decision
> -         making when dealing with machines that have clusters of CPUs.
> -         Cluster usually means a couple of CPUs which are placed closely
> -         by sharing mid-level caches, last-level cache tags or internal
> -         busses.
> -
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         MultiThreading at a cost of slightly increased overhead in some
> -         places. If unsure say N here.
> -
>  config NR_CPUS
>         int "Maximum number of CPUs (2-4096)"
>         range 2 4096
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index 045792cde481..67f3d84242ae 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -18,6 +18,7 @@ config IA64
>         select ARCH_ENABLE_MEMORY_HOTPLUG
>         select ARCH_ENABLE_MEMORY_HOTREMOVE
>         select ARCH_SUPPORTS_ACPI
> +       select ARCH_SUPPORTS_SCHED_SMT
>         select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
>         select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
>         select FORCE_PCI
> @@ -247,14 +248,6 @@ config HOTPLUG_CPU
>           can be controlled through /sys/devices/system/cpu/cpu#.
>           Say N if you want to disable CPU hotplug.
>
> -config SCHED_SMT
> -       bool "SMT scheduler support"
> -       depends on SMP
> -       help
> -         Improves the CPU scheduler's decision making when dealing with
> -         Intel IA64 chips with MultiThreading at a cost of slightly increased
> -         overhead in some places. If unsure say N here.
> -
>  config PERMIT_BSP_REMOVE
>         bool "Support removal of Bootstrap Processor"
>         depends on HOTPLUG_CPU
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 771ca53af06d..cc60d440b097 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
>  config MIPS_MT
>         bool
>
> -config SCHED_SMT
> -       bool "SMT (multithreading) scheduler support"
> -       depends on SYS_SUPPORTS_SCHED_SMT
> -       default n
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with MIPS MT enabled cores at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config SYS_SUPPORTS_SCHED_SMT
>         bool
> +       select ARCH_SUPPORTS_SCHED_SMT
>
>  config SYS_SUPPORTS_MULTITHREADING
>         bool
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 4742b6f169b7..6aaa962ec2f4 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -13,6 +13,7 @@ config PARISC
>         select ARCH_NO_SG_CHAIN
>         select ARCH_SUPPORTS_HUGETLBFS if PA20
>         select ARCH_SUPPORTS_MEMORY_FAILURE
> +       select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
>         select DMA_OPS
>         select RTC_CLASS
>         select RTC_DRV_GENERIC
> @@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
>         help
>           Support PARISC cpu topology definition.
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on PARISC_CPU_TOPOLOGY && PA8X00
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config IRQSTACKS
>         bool "Use separate kernel stacks when processing interrupts"
>         default y
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index ba5b66189358..9f45b92ccac1 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -151,6 +151,7 @@ config PPC
>         select ARCH_STACKWALK
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC    if PPC32 || PPC_BOOK3S_64
> +       select ARCH_SUPPORTS_SCHED_SMT          if PPC64
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_CMPXCHG_LOCKREF         if PPC64
>         select ARCH_USE_MEMTEST
> @@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
>  config PPC_COPRO_BASE
>         bool
>
> -config SCHED_SMT
> -       bool "SMT (Hyperthreading) scheduler support"
> -       depends on PPC64 && SMP
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with POWER5 cpus at a cost of slightly increased
> -         overhead in some places. If unsure say N here.
> -
>  config PPC_DENORMALISATION
>         bool "PowerPC denormalisation exception handling"
>         depends on PPC_BOOK3S_64
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index b86de61b8caa..a0b4117cb1fa 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -483,12 +483,6 @@ config NODES_SHIFT
>         depends on NUMA
>         default "1"
>
> -config SCHED_SMT
> -       def_bool n
> -
> -config SCHED_MC
> -       def_bool n
> -
>  config SCHED_BOOK
>         def_bool n
>
> @@ -498,6 +492,8 @@ config SCHED_DRAWER
>  config SCHED_TOPOLOGY
>         def_bool y
>         prompt "Topology scheduler support"
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select SCHED_SMT
>         select SCHED_MC
>         select SCHED_BOOK
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 6904f4bdbf00..7380ee27d252 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -13,6 +13,7 @@ config SUPERH
>         select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>         select ARCH_HIBERNATION_POSSIBLE if MMU
>         select ARCH_MIGHT_HAVE_PC_PARPORT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select ARCH_WANT_IPC_PARSE_VERSION
>         select CPU_NO_EFFICIENT_FFS
>         select DMA_DECLARE_COHERENT
> diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
> index ba569cfb4368..1d9f7006a72a 100644
> --- a/arch/sh/mm/Kconfig
> +++ b/arch/sh/mm/Kconfig
> @@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
>
>  endchoice
>
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on SMP
> -       default y
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  endmenu
>
>  menu "Cache configuration"
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index b120ed947f50..a6cf30d37725 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -86,6 +86,8 @@ config SPARC64
>         select HAVE_ARCH_AUDITSYSCALL
>         select ARCH_SUPPORTS_ATOMIC_RMW
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
>         select HAVE_NMI
>         select HAVE_REGS_AND_STACK_ACCESS_API
>         select ARCH_USE_QUEUED_RWLOCKS
> @@ -290,24 +292,6 @@ if SPARC64
>  source "kernel/power/Kconfig"
>  endif
>
> -config SCHED_SMT
> -       bool "SMT (Hyperthreading) scheduler support"
> -       depends on SPARC64 && SMP
> -       default y
> -       help
> -         SMT scheduler support improves the CPU scheduler's decision making
> -         when dealing with SPARC cpus at a cost of slightly increased overhead
> -         in some places. If unsure say N here.
> -
> -config SCHED_MC
> -       bool "Multi-core scheduler support"
> -       depends on SPARC64 && SMP
> -       default y
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config CMDLINE_BOOL
>         bool "Default bootloader kernel arguments"
>         depends on SPARC64
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 349e59b2f0e3..87a91fd33d85 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -107,6 +107,9 @@ config X86
>         select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP       if NR_CPUS <= 4096
>         select ARCH_SUPPORTS_LTO_CLANG
>         select ARCH_SUPPORTS_LTO_CLANG_THIN
> +       select ARCH_SUPPORTS_SCHED_SMT
> +       select ARCH_SUPPORTS_SCHED_MC
> +       select ARCH_SUPPORTS_SCHED_CLUSTER
>         select ARCH_USE_BUILTIN_BSWAP
>         select ARCH_USE_MEMTEST
>         select ARCH_USE_QUEUED_RWLOCKS
> @@ -1001,29 +1004,6 @@ config NR_CPUS
>           This is purely to save memory: each supported CPU adds about 8KB
>           to the kernel image.
>
> -config SCHED_CLUSTER
> -       bool "Cluster scheduler support"
> -       depends on SMP
> -       default y
> -       help
> -         Cluster scheduler support improves the CPU scheduler's decision
> -         making when dealing with machines that have clusters of CPUs.
> -         Cluster usually means a couple of CPUs which are placed closely
> -         by sharing mid-level caches, last-level cache tags or internal
> -         busses.
> -
> -config SCHED_SMT
> -       def_bool y if SMP
> -
> -config SCHED_MC
> -       def_bool y
> -       prompt "Multi-core scheduler support"
> -       depends on SMP
> -       help
> -         Multi-core scheduler support improves the CPU scheduler's decision
> -         making when dealing with multi-core CPU chips at a cost of slightly
> -         increased overhead in some places. If unsure say N here.
> -
>  config SCHED_MC_PRIO
>         bool "CPU core priorities scheduler support"
>         depends on SCHED_MC && CPU_SUP_INTEL
> diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
> index c8b8e12c9c9c..9ceb08f42aeb 100644
> --- a/kernel/sched/Kconfig
> +++ b/kernel/sched/Kconfig
> @@ -131,3 +131,46 @@ config SCHED_CORE
>           SCHED_CORE is default disabled. When it is enabled and unused,
>           which is the likely usage by Linux distributions, there should
>           be no measurable impact on performance.
> +
> +
> +#
> +# For architectuers that want to enable generic scheduler handling of
> +# different topology levels:
> +#
> +config ARCH_SUPPORTS_SCHED_SMT
> +       bool
> +
> +config ARCH_SUPPORTS_SCHED_MC
> +       bool
> +
> +config ARCH_SUPPORTS_SCHED_CLUSTER
> +       bool
> +
> +config SCHED_SMT
> +       bool "SMT scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_SMT && SMP
> +       default y
> +       help
> +         Improves the CPU scheduler's decision making when dealing with
> +         MultiThreading at a cost of slightly increased overhead in some
> +         places. If unsure say N here.
> +
> +config SCHED_MC
> +       bool "Multi-core scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_MC && SMP
> +       default y
> +       help
> +         Multi-core scheduler support improves the CPU scheduler's decision
> +         making when dealing with multi-core CPU chips at a cost of slightly
> +         increased overhead in some places. If unsure say N here.
> +
> +config SCHED_CLUSTER
> +       bool "Cluster scheduler support"
> +       depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
> +       default y
> +       help
> +         Cluster scheduler support improves the CPU scheduler's decision
> +         making when dealing with machines that have clusters of CPUs.
> +         Cluster usually means a couple of CPUs which are placed closely
> +         by sharing mid-level caches, last-level cache tags or internal
> +         busses.
> --
> 2.25.1
>

Thanks
barry

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
  2021-10-08 12:37     ` Barry Song
  (?)
@ 2021-10-08 15:22       ` Valentin Schneider
  -1 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 15:22 UTC (permalink / raw)
  To: Barry Song
  Cc: LKML, LAK, linux-ia64, linux-mips, linux-parisc, linuxppc-dev,
	linux-s390, linux-sh, sparclinux, Peter Zijlstra, Aubrey Li,
	Barry Song, Tim Chen, Jonathan Cameron, Russell King,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

On 09/10/21 01:37, Barry Song wrote:
> On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
> <valentin.schneider@arm.com> wrote:
>>
>> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
>> around that highlighted that every architecture redefines its own help text
>> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>>
>> Move the definition of those to scheduler's Kconfig to centralize help text
>> and generic dependencies (i.e. SMP). Make them depend on a matching
>> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
>> architecture-specific dependency.
>>
>> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
>> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>>
>
> Hi Valentin,
> Thanks!
> I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
> is always beneficial of all platforms. It would be perfect if the patch has no
> side effects and doesn't change the existing behaviour. But it has side effects
> by changing the default N to Y on a couple of platforms.
>

So x86 has it default yes, and a lot of others (e.g. arm64) have it default
no.

IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
control the presence of a sched_domain_topology_level - if it's useless it
gets degenerated at domain build time. Some valid reasons for not using
them is if the architecture defines its own topology table (e.g. powerpc
has CACHE and MC levels which are not gated behind any CONFIG).

SCHED_SMT has an impact on code generated in sched/core.c, but that is also
gated by a static key.

So I'd say having them default yes is sensible. I'd even say we should
change the "If unsure say N here." to "Y".

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-08 15:22       ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 15:22 UTC (permalink / raw)
  To: Barry Song
  Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker, linux-ia64,
	Geert Uytterhoeven, linux-sh, Peter Zijlstra, Catalin Marinas,
	Linus Walleij, David Hildenbrand, x86, linux-mips,
	James E.J. Bottomley, Hugh Dickins, Paul Mackerras,
	H. Peter Anvin, sparclinux, Will Deacon, Ard Biesheuvel,
	linux-s390, Vincent Guittot, Arnd Bergmann, Yoshinori Sato,
	YiFei Zhu, Helge Deller, Aubrey Li, Daniel Bristot de Oliveira,
	Russell King, Christian Borntraeger, Ingo Molnar, Mel Gorman,
	Masahiro Yamada, Frederic Weisbecker, Kees Cook, Vasily Gorbik,
	Anshuman Khandual, Vlastimil Babka, Vipin Sharma, Heiko Carstens,
	Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
	Borislav Petkov, Sergei Trofimovich, Jonathan Cameron,
	Thomas Gleixner, Michal Hocko, Dietmar Eggemann, LAK, Barry Song,
	Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, linux-parisc,
	Chris Down, linuxppc-dev, Randy Dunlap, Nick Desaulniers, LKML,
	Rasmus Villemoes, Andrew Morton, Tim Chen, David S. Miller,
	Mike Rapoport

On 09/10/21 01:37, Barry Song wrote:
> On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
> <valentin.schneider@arm.com> wrote:
>>
>> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
>> around that highlighted that every architecture redefines its own help text
>> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>>
>> Move the definition of those to scheduler's Kconfig to centralize help text
>> and generic dependencies (i.e. SMP). Make them depend on a matching
>> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
>> architecture-specific dependency.
>>
>> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
>> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>>
>
> Hi Valentin,
> Thanks!
> I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
> is always beneficial of all platforms. It would be perfect if the patch has no
> side effects and doesn't change the existing behaviour. But it has side effects
> by changing the default N to Y on a couple of platforms.
>

So x86 has it default yes, and a lot of others (e.g. arm64) have it default
no.

IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
control the presence of a sched_domain_topology_level - if it's useless it
gets degenerated at domain build time. Some valid reasons for not using
them is if the architecture defines its own topology table (e.g. powerpc
has CACHE and MC levels which are not gated behind any CONFIG).

SCHED_SMT has an impact on code generated in sched/core.c, but that is also
gated by a static key.

So I'd say having them default yes is sensible. I'd even say we should
change the "If unsure say N here." to "Y".

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-08 15:22       ` Valentin Schneider
  0 siblings, 0 replies; 18+ messages in thread
From: Valentin Schneider @ 2021-10-08 15:22 UTC (permalink / raw)
  To: Barry Song
  Cc: LKML, LAK, linux-ia64, linux-mips, linux-parisc, linuxppc-dev,
	linux-s390, linux-sh, sparclinux, Peter Zijlstra, Aubrey Li,
	Barry Song, Tim Chen, Jonathan Cameron, Russell King,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

On 09/10/21 01:37, Barry Song wrote:
> On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
> <valentin.schneider@arm.com> wrote:
>>
>> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
>> around that highlighted that every architecture redefines its own help text
>> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>>
>> Move the definition of those to scheduler's Kconfig to centralize help text
>> and generic dependencies (i.e. SMP). Make them depend on a matching
>> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
>> architecture-specific dependency.
>>
>> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
>> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>>
>
> Hi Valentin,
> Thanks!
> I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
> is always beneficial of all platforms. It would be perfect if the patch has no
> side effects and doesn't change the existing behaviour. But it has side effects
> by changing the default N to Y on a couple of platforms.
>

So x86 has it default yes, and a lot of others (e.g. arm64) have it default
no.

IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
control the presence of a sched_domain_topology_level - if it's useless it
gets degenerated at domain build time. Some valid reasons for not using
them is if the architecture defines its own topology table (e.g. powerpc
has CACHE and MC levels which are not gated behind any CONFIG).

SCHED_SMT has an impact on code generated in sched/core.c, but that is also
gated by a static key.

So I'd say having them default yes is sensible. I'd even say we should
change the "If unsure say N here." to "Y".

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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
  2021-10-08 15:22       ` Valentin Schneider
  (?)
@ 2021-10-15 13:04         ` Peter Zijlstra
  -1 siblings, 0 replies; 18+ messages in thread
From: Peter Zijlstra @ 2021-10-15 13:04 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: Barry Song, LKML, LAK, linux-ia64, linux-mips, linux-parisc,
	linuxppc-dev, linux-s390, linux-sh, sparclinux, Aubrey Li,
	Barry Song, Tim Chen, Jonathan Cameron, Russell King,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

On Fri, Oct 08, 2021 at 04:22:27PM +0100, Valentin Schneider wrote:

> So x86 has it default yes, and a lot of others (e.g. arm64) have it default
> no.
> 
> IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
> control the presence of a sched_domain_topology_level - if it's useless it
> gets degenerated at domain build time. Some valid reasons for not using
> them is if the architecture defines its own topology table (e.g. powerpc
> has CACHE and MC levels which are not gated behind any CONFIG).
> 
> SCHED_SMT has an impact on code generated in sched/core.c, but that is also
> gated by a static key.
> 
> So I'd say having them default yes is sensible. I'd even say we should
> change the "If unsure say N here." to "Y".

Right, so I tend to agree (and also that we should fix that Kconfig help
text). But it would be very nice to have feedback from the affected arch
maintainers.


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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-15 13:04         ` Peter Zijlstra
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Zijlstra @ 2021-10-15 13:04 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker, linux-ia64,
	Geert Uytterhoeven, linux-sh, Catalin Marinas, Linus Walleij,
	David Hildenbrand, x86, linux-mips, James E.J. Bottomley,
	Hugh Dickins, Paul Mackerras, H. Peter Anvin, sparclinux,
	Will Deacon, Ard Biesheuvel, linux-s390, Vincent Guittot,
	Arnd Bergmann, Yoshinori Sato, YiFei Zhu, Helge Deller,
	Aubrey Li, Barry Song, Russell King, Christian Borntraeger,
	Ingo Molnar, Mel Gorman, Masahiro Yamada, Frederic Weisbecker,
	Kees Cook, Vasily Gorbik, Anshuman Khandual, Vlastimil Babka,
	Vipin Sharma, Heiko Carstens, Uwe Kleine-König,
	Steven Rostedt, Nathan Chancellor, Borislav Petkov,
	Sergei Trofimovich, Jonathan Cameron, Thomas Gleixner,
	Michal Hocko, Dietmar Eggemann, LAK, Barry Song, Ben Segall,
	Thomas Bogendoerfer, Daniel Borkmann, linux-parisc, Chris Down,
	linuxppc-dev, Randy Dunlap, Nick Desaulniers, LKML,
	Rasmus Villemoes, Daniel Bristot de Oliveira, Andrew Morton,
	Tim Chen, David S. Miller, Mike Rapoport

On Fri, Oct 08, 2021 at 04:22:27PM +0100, Valentin Schneider wrote:

> So x86 has it default yes, and a lot of others (e.g. arm64) have it default
> no.
> 
> IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
> control the presence of a sched_domain_topology_level - if it's useless it
> gets degenerated at domain build time. Some valid reasons for not using
> them is if the architecture defines its own topology table (e.g. powerpc
> has CACHE and MC levels which are not gated behind any CONFIG).
> 
> SCHED_SMT has an impact on code generated in sched/core.c, but that is also
> gated by a static key.
> 
> So I'd say having them default yes is sensible. I'd even say we should
> change the "If unsure say N here." to "Y".

Right, so I tend to agree (and also that we should fix that Kconfig help
text). But it would be very nice to have feedback from the affected arch
maintainers.


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

* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
@ 2021-10-15 13:04         ` Peter Zijlstra
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Zijlstra @ 2021-10-15 13:04 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: Barry Song, LKML, LAK, linux-ia64, linux-mips, linux-parisc,
	linuxppc-dev, linux-s390, linux-sh, sparclinux, Aubrey Li,
	Barry Song, Tim Chen, Jonathan Cameron, Russell King,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Arnd Bergmann,
	Linus Walleij, Geert Uytterhoeven, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, Mark Rutland, Ard Biesheuvel,
	YiFei Zhu, Uwe Kleine-König, Kefeng Wang,
	Sergei Trofimovich, David Hildenbrand, Randy Dunlap,
	Masahiro Yamada, Kees Cook, Nathan Chancellor, Nick Desaulniers,
	Chris Down, Vipin Sharma, Rasmus Villemoes, Daniel Borkmann,
	Vlastimil Babka, Frederic Weisbecker, Hugh Dickins, Michal Hocko

On Fri, Oct 08, 2021 at 04:22:27PM +0100, Valentin Schneider wrote:

> So x86 has it default yes, and a lot of others (e.g. arm64) have it default
> no.
> 
> IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
> control the presence of a sched_domain_topology_level - if it's useless it
> gets degenerated at domain build time. Some valid reasons for not using
> them is if the architecture defines its own topology table (e.g. powerpc
> has CACHE and MC levels which are not gated behind any CONFIG).
> 
> SCHED_SMT has an impact on code generated in sched/core.c, but that is also
> gated by a static key.
> 
> So I'd say having them default yes is sensible. I'd even say we should
> change the "If unsure say N here." to "Y".

Right, so I tend to agree (and also that we should fix that Kconfig help
text). But it would be very nice to have feedback from the affected arch
maintainers.

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

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

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 11:53 [PATCH 0/2] sched: cleanup CONFIG_SCHED_MC & friends Valentin Schneider
2021-10-08 11:53 ` Valentin Schneider
2021-10-08 11:53 ` Valentin Schneider
2021-10-08 11:53 ` [PATCH 1/2] sched: Move Kconfig.preempt to sched/Kconfig Valentin Schneider
2021-10-08 11:53   ` Valentin Schneider
2021-10-08 11:53   ` Valentin Schneider
2021-10-08 11:53 ` [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions Valentin Schneider
2021-10-08 11:53   ` Valentin Schneider
2021-10-08 11:53   ` Valentin Schneider
2021-10-08 12:37   ` Barry Song
2021-10-08 12:37     ` Barry Song
2021-10-08 12:37     ` Barry Song
2021-10-08 15:22     ` Valentin Schneider
2021-10-08 15:22       ` Valentin Schneider
2021-10-08 15:22       ` Valentin Schneider
2021-10-15 13:04       ` Peter Zijlstra
2021-10-15 13:04         ` Peter Zijlstra
2021-10-15 13:04         ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.