diff mbox series

[1/9] xen/sched: move schedulers and cpupool coding to dedicated directory

Message ID 20191218074859.21665-2-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: scheduler cleanups | expand

Commit Message

Jürgen Groß Dec. 18, 2019, 7:48 a.m. UTC
Move sched*c and cpupool.c to a new directory common/sched.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 MAINTAINERS                                        |  8 +--
 xen/common/Kconfig                                 | 66 +---------------------
 xen/common/Makefile                                |  8 +--
 xen/common/sched/Kconfig                           | 65 +++++++++++++++++++++
 xen/common/sched/Makefile                          |  7 +++
 .../{compat/schedule.c => sched/compat_schedule.c} |  2 +-
 xen/common/{ => sched}/cpupool.c                   |  0
 xen/common/{ => sched}/sched_arinc653.c            |  0
 xen/common/{ => sched}/sched_credit.c              |  0
 xen/common/{ => sched}/sched_credit2.c             |  0
 xen/common/{ => sched}/sched_null.c                |  0
 xen/common/{ => sched}/sched_rt.c                  |  0
 xen/common/{ => sched}/schedule.c                  |  2 +-
 13 files changed, 80 insertions(+), 78 deletions(-)
 create mode 100644 xen/common/sched/Kconfig
 create mode 100644 xen/common/sched/Makefile
 rename xen/common/{compat/schedule.c => sched/compat_schedule.c} (97%)
 rename xen/common/{ => sched}/cpupool.c (100%)
 rename xen/common/{ => sched}/sched_arinc653.c (100%)
 rename xen/common/{ => sched}/sched_credit.c (100%)
 rename xen/common/{ => sched}/sched_credit2.c (100%)
 rename xen/common/{ => sched}/sched_null.c (100%)
 rename xen/common/{ => sched}/sched_rt.c (100%)
 rename xen/common/{ => sched}/schedule.c (99%)

Comments

Dario Faggioli Dec. 18, 2019, 8:58 a.m. UTC | #1
On Wed, 2019-12-18 at 08:48 +0100, Juergen Gross wrote:
> Move sched*c and cpupool.c to a new directory common/sched.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  MAINTAINERS                                        |  8 +--
>  xen/common/Kconfig                                 | 66 +-----------
> ----------
>  xen/common/Makefile                                |  8 +--
>  xen/common/sched/Kconfig                           | 65
> +++++++++++++++++++++
>  xen/common/sched/Makefile                          |  7 +++
>  .../{compat/schedule.c => sched/compat_schedule.c} |  2 +-
>  xen/common/{ => sched}/cpupool.c                   |  0
>  xen/common/{ => sched}/sched_arinc653.c            |  0
>  xen/common/{ => sched}/sched_credit.c              |  0
>  xen/common/{ => sched}/sched_credit2.c             |  0
>  xen/common/{ => sched}/sched_null.c                |  0
>  xen/common/{ => sched}/sched_rt.c                  |  0
>  xen/common/{ => sched}/schedule.c                  |  2 +-
>  13 files changed, 80 insertions(+), 78 deletions(-)
>  create mode 100644 xen/common/sched/Kconfig
>  create mode 100644 xen/common/sched/Makefile
>  rename xen/common/{compat/schedule.c => sched/compat_schedule.c}
> (97%)
>  rename xen/common/{ => sched}/cpupool.c (100%)
>  rename xen/common/{ => sched}/sched_arinc653.c (100%)
>  rename xen/common/{ => sched}/sched_credit.c (100%)
>  rename xen/common/{ => sched}/sched_credit2.c (100%)
>  rename xen/common/{ => sched}/sched_null.c (100%)
>  rename xen/common/{ => sched}/sched_rt.c (100%)
>  rename xen/common/{ => sched}/schedule.c (99%)
> 
Matter of taste, I guess, but what about not repeating 'sched', i.e.:

xen/common/sched_credit.c  --> xen/common/sched/credit.c
xen/common/sched_credit2.c --> xen/common/sched/credit2.c
xen/common/sched_null.c    --> xen/common/sched/null.c
...

schedule.c can be called something like 'core.c', or 'common.c' or just
'sched.c' (the repetition being, in this case, intentional)

?

Thanks and Regards
Andrew Cooper Dec. 18, 2019, 9:08 a.m. UTC | #2
On 18/12/2019 08:58, Dario Faggioli wrote:
> On Wed, 2019-12-18 at 08:48 +0100, Juergen Gross wrote:
>> Move sched*c and cpupool.c to a new directory common/sched.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>  MAINTAINERS                                        |  8 +--
>>  xen/common/Kconfig                                 | 66 +-----------
>> ----------
>>  xen/common/Makefile                                |  8 +--
>>  xen/common/sched/Kconfig                           | 65
>> +++++++++++++++++++++
>>  xen/common/sched/Makefile                          |  7 +++
>>  .../{compat/schedule.c => sched/compat_schedule.c} |  2 +-
>>  xen/common/{ => sched}/cpupool.c                   |  0
>>  xen/common/{ => sched}/sched_arinc653.c            |  0
>>  xen/common/{ => sched}/sched_credit.c              |  0
>>  xen/common/{ => sched}/sched_credit2.c             |  0
>>  xen/common/{ => sched}/sched_null.c                |  0
>>  xen/common/{ => sched}/sched_rt.c                  |  0
>>  xen/common/{ => sched}/schedule.c                  |  2 +-
>>  13 files changed, 80 insertions(+), 78 deletions(-)
>>  create mode 100644 xen/common/sched/Kconfig
>>  create mode 100644 xen/common/sched/Makefile
>>  rename xen/common/{compat/schedule.c => sched/compat_schedule.c}
>> (97%)
>>  rename xen/common/{ => sched}/cpupool.c (100%)
>>  rename xen/common/{ => sched}/sched_arinc653.c (100%)
>>  rename xen/common/{ => sched}/sched_credit.c (100%)
>>  rename xen/common/{ => sched}/sched_credit2.c (100%)
>>  rename xen/common/{ => sched}/sched_null.c (100%)
>>  rename xen/common/{ => sched}/sched_rt.c (100%)
>>  rename xen/common/{ => sched}/schedule.c (99%)
>>
> Matter of taste, I guess, but what about not repeating 'sched', i.e.:
>
> xen/common/sched_credit.c  --> xen/common/sched/credit.c
> xen/common/sched_credit2.c --> xen/common/sched/credit2.c
> xen/common/sched_null.c    --> xen/common/sched/null.c
> ...
>
> schedule.c can be called something like 'core.c',

+1 FWIW, and compat_schedule.c can just become compat.c

~Andrew
Jürgen Groß Dec. 18, 2019, 9:14 a.m. UTC | #3
On 18.12.19 09:58, Dario Faggioli wrote:
> On Wed, 2019-12-18 at 08:48 +0100, Juergen Gross wrote:
>> Move sched*c and cpupool.c to a new directory common/sched.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>   MAINTAINERS                                        |  8 +--
>>   xen/common/Kconfig                                 | 66 +-----------
>> ----------
>>   xen/common/Makefile                                |  8 +--
>>   xen/common/sched/Kconfig                           | 65
>> +++++++++++++++++++++
>>   xen/common/sched/Makefile                          |  7 +++
>>   .../{compat/schedule.c => sched/compat_schedule.c} |  2 +-
>>   xen/common/{ => sched}/cpupool.c                   |  0
>>   xen/common/{ => sched}/sched_arinc653.c            |  0
>>   xen/common/{ => sched}/sched_credit.c              |  0
>>   xen/common/{ => sched}/sched_credit2.c             |  0
>>   xen/common/{ => sched}/sched_null.c                |  0
>>   xen/common/{ => sched}/sched_rt.c                  |  0
>>   xen/common/{ => sched}/schedule.c                  |  2 +-
>>   13 files changed, 80 insertions(+), 78 deletions(-)
>>   create mode 100644 xen/common/sched/Kconfig
>>   create mode 100644 xen/common/sched/Makefile
>>   rename xen/common/{compat/schedule.c => sched/compat_schedule.c}
>> (97%)
>>   rename xen/common/{ => sched}/cpupool.c (100%)
>>   rename xen/common/{ => sched}/sched_arinc653.c (100%)
>>   rename xen/common/{ => sched}/sched_credit.c (100%)
>>   rename xen/common/{ => sched}/sched_credit2.c (100%)
>>   rename xen/common/{ => sched}/sched_null.c (100%)
>>   rename xen/common/{ => sched}/sched_rt.c (100%)
>>   rename xen/common/{ => sched}/schedule.c (99%)
>>
> Matter of taste, I guess, but what about not repeating 'sched', i.e.:
> 
> xen/common/sched_credit.c  --> xen/common/sched/credit.c
> xen/common/sched_credit2.c --> xen/common/sched/credit2.c
> xen/common/sched_null.c    --> xen/common/sched/null.c
> ...
> 
> schedule.c can be called something like 'core.c', or 'common.c' or just
> 'sched.c' (the repetition being, in this case, intentional)

Sure, I'll go with core.c


Juergen
Jürgen Groß Dec. 18, 2019, 9:16 a.m. UTC | #4
On 18.12.19 10:08, Andrew Cooper wrote:
> On 18/12/2019 08:58, Dario Faggioli wrote:
>> On Wed, 2019-12-18 at 08:48 +0100, Juergen Gross wrote:
>>> Move sched*c and cpupool.c to a new directory common/sched.
>>>
>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>> ---
>>>   MAINTAINERS                                        |  8 +--
>>>   xen/common/Kconfig                                 | 66 +-----------
>>> ----------
>>>   xen/common/Makefile                                |  8 +--
>>>   xen/common/sched/Kconfig                           | 65
>>> +++++++++++++++++++++
>>>   xen/common/sched/Makefile                          |  7 +++
>>>   .../{compat/schedule.c => sched/compat_schedule.c} |  2 +-
>>>   xen/common/{ => sched}/cpupool.c                   |  0
>>>   xen/common/{ => sched}/sched_arinc653.c            |  0
>>>   xen/common/{ => sched}/sched_credit.c              |  0
>>>   xen/common/{ => sched}/sched_credit2.c             |  0
>>>   xen/common/{ => sched}/sched_null.c                |  0
>>>   xen/common/{ => sched}/sched_rt.c                  |  0
>>>   xen/common/{ => sched}/schedule.c                  |  2 +-
>>>   13 files changed, 80 insertions(+), 78 deletions(-)
>>>   create mode 100644 xen/common/sched/Kconfig
>>>   create mode 100644 xen/common/sched/Makefile
>>>   rename xen/common/{compat/schedule.c => sched/compat_schedule.c}
>>> (97%)
>>>   rename xen/common/{ => sched}/cpupool.c (100%)
>>>   rename xen/common/{ => sched}/sched_arinc653.c (100%)
>>>   rename xen/common/{ => sched}/sched_credit.c (100%)
>>>   rename xen/common/{ => sched}/sched_credit2.c (100%)
>>>   rename xen/common/{ => sched}/sched_null.c (100%)
>>>   rename xen/common/{ => sched}/sched_rt.c (100%)
>>>   rename xen/common/{ => sched}/schedule.c (99%)
>>>
>> Matter of taste, I guess, but what about not repeating 'sched', i.e.:
>>
>> xen/common/sched_credit.c  --> xen/common/sched/credit.c
>> xen/common/sched_credit2.c --> xen/common/sched/credit2.c
>> xen/common/sched_null.c    --> xen/common/sched/null.c
>> ...
>>
>> schedule.c can be called something like 'core.c',
> 
> +1 FWIW, and compat_schedule.c can just become compat.c

Yes, indeed.


Juergen
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 012c847ebd..37d4da2bc2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -174,7 +174,7 @@  M:	Josh Whitehead <josh.whitehead@dornerworks.com>
 M:	Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
 S:	Supported
 L:	DornerWorks Xen-Devel <xen-devel@dornerworks.com>
-F:	xen/common/sched_arinc653.c
+F:	xen/common/sched/sched_arinc653.c
 F:	tools/libxc/xc_arinc653.c
 
 ARM (W/ VIRTUALISATION EXTENSIONS) ARCHITECTURE
@@ -212,7 +212,7 @@  CPU POOLS
 M:	Juergen Gross <jgross@suse.com>
 M:	Dario Faggioli <dfaggioli@suse.com>
 S:	Supported
-F:	xen/common/cpupool.c
+F:	xen/common/sched/cpupool.c
 
 DEVICE TREE
 M:	Stefano Stabellini <sstabellini@kernel.org>
@@ -378,13 +378,13 @@  RTDS SCHEDULER
 M:	Dario Faggioli <dfaggioli@suse.com>
 M:	Meng Xu <mengxu@cis.upenn.edu>
 S:	Supported
-F:	xen/common/sched_rt.c
+F:	xen/common/sched/sched_rt.c
 
 SCHEDULING
 M:	George Dunlap <george.dunlap@eu.citrix.com>
 M:	Dario Faggioli <dfaggioli@suse.com>
 S:	Supported
-F:	xen/common/sched*
+F:	xen/common/sched/
 
 SEABIOS UPSTREAM
 M:	Wei Liu <wl@xen.org>
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 2f516da101..79465fc1f9 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -278,71 +278,7 @@  config ARGO
 
 	  If unsure, say N.
 
-menu "Schedulers"
-	visible if EXPERT = "y"
-
-config SCHED_CREDIT
-	bool "Credit scheduler support"
-	default y
-	---help---
-	  The traditional credit scheduler is a general purpose scheduler.
-
-config SCHED_CREDIT2
-	bool "Credit2 scheduler support"
-	default y
-	---help---
-	  The credit2 scheduler is a general purpose scheduler that is
-	  optimized for lower latency and higher VM density.
-
-config SCHED_RTDS
-	bool "RTDS scheduler support (EXPERIMENTAL)"
-	default y
-	---help---
-	  The RTDS scheduler is a soft and firm real-time scheduler for
-	  multicore, targeted for embedded, automotive, graphics and gaming
-	  in the cloud, and general low-latency workloads.
-
-config SCHED_ARINC653
-	bool "ARINC653 scheduler support (EXPERIMENTAL)"
-	default DEBUG
-	---help---
-	  The ARINC653 scheduler is a hard real-time scheduler for single
-	  cores, targeted for avionics, drones, and medical devices.
-
-config SCHED_NULL
-	bool "Null scheduler support (EXPERIMENTAL)"
-	default y
-	---help---
-	  The null scheduler is a static, zero overhead scheduler,
-	  for when there always are less vCPUs than pCPUs, typically
-	  in embedded or HPC scenarios.
-
-choice
-	prompt "Default Scheduler?"
-	default SCHED_CREDIT2_DEFAULT
-
-	config SCHED_CREDIT_DEFAULT
-		bool "Credit Scheduler" if SCHED_CREDIT
-	config SCHED_CREDIT2_DEFAULT
-		bool "Credit2 Scheduler" if SCHED_CREDIT2
-	config SCHED_RTDS_DEFAULT
-		bool "RT Scheduler" if SCHED_RTDS
-	config SCHED_ARINC653_DEFAULT
-		bool "ARINC653 Scheduler" if SCHED_ARINC653
-	config SCHED_NULL_DEFAULT
-		bool "Null Scheduler" if SCHED_NULL
-endchoice
-
-config SCHED_DEFAULT
-	string
-	default "credit" if SCHED_CREDIT_DEFAULT
-	default "credit2" if SCHED_CREDIT2_DEFAULT
-	default "rtds" if SCHED_RTDS_DEFAULT
-	default "arinc653" if SCHED_ARINC653_DEFAULT
-	default "null" if SCHED_NULL_DEFAULT
-	default "credit2"
-
-endmenu
+source "common/sched/Kconfig"
 
 config CRYPTO
 	bool
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 62b34e69e9..2abb8250b0 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -3,7 +3,6 @@  obj-y += bitmap.o
 obj-y += bsearch.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
-obj-y += cpupool.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
 obj-y += domctl.o
@@ -38,12 +37,6 @@  obj-y += radix-tree.o
 obj-y += rbtree.o
 obj-y += rcupdate.o
 obj-y += rwlock.o
-obj-$(CONFIG_SCHED_ARINC653) += sched_arinc653.o
-obj-$(CONFIG_SCHED_CREDIT) += sched_credit.o
-obj-$(CONFIG_SCHED_CREDIT2) += sched_credit2.o
-obj-$(CONFIG_SCHED_RTDS) += sched_rt.o
-obj-$(CONFIG_SCHED_NULL) += sched_null.o
-obj-y += schedule.o
 obj-y += shutdown.o
 obj-y += softirq.o
 obj-y += sort.o
@@ -74,6 +67,7 @@  obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall
 extra-y := symbols-dummy.o
 
 subdir-$(CONFIG_COVERAGE) += coverage
+subdir-y += sched
 subdir-$(CONFIG_UBSAN) += ubsan
 
 subdir-$(CONFIG_NEEDS_LIBELF) += libelf
diff --git a/xen/common/sched/Kconfig b/xen/common/sched/Kconfig
new file mode 100644
index 0000000000..883ac87cab
--- /dev/null
+++ b/xen/common/sched/Kconfig
@@ -0,0 +1,65 @@ 
+menu "Schedulers"
+	visible if EXPERT = "y"
+
+config SCHED_CREDIT
+	bool "Credit scheduler support"
+	default y
+	---help---
+	  The traditional credit scheduler is a general purpose scheduler.
+
+config SCHED_CREDIT2
+	bool "Credit2 scheduler support"
+	default y
+	---help---
+	  The credit2 scheduler is a general purpose scheduler that is
+	  optimized for lower latency and higher VM density.
+
+config SCHED_RTDS
+	bool "RTDS scheduler support (EXPERIMENTAL)"
+	default y
+	---help---
+	  The RTDS scheduler is a soft and firm real-time scheduler for
+	  multicore, targeted for embedded, automotive, graphics and gaming
+	  in the cloud, and general low-latency workloads.
+
+config SCHED_ARINC653
+	bool "ARINC653 scheduler support (EXPERIMENTAL)"
+	default DEBUG
+	---help---
+	  The ARINC653 scheduler is a hard real-time scheduler for single
+	  cores, targeted for avionics, drones, and medical devices.
+
+config SCHED_NULL
+	bool "Null scheduler support (EXPERIMENTAL)"
+	default y
+	---help---
+	  The null scheduler is a static, zero overhead scheduler,
+	  for when there always are less vCPUs than pCPUs, typically
+	  in embedded or HPC scenarios.
+
+choice
+	prompt "Default Scheduler?"
+	default SCHED_CREDIT2_DEFAULT
+
+	config SCHED_CREDIT_DEFAULT
+		bool "Credit Scheduler" if SCHED_CREDIT
+	config SCHED_CREDIT2_DEFAULT
+		bool "Credit2 Scheduler" if SCHED_CREDIT2
+	config SCHED_RTDS_DEFAULT
+		bool "RT Scheduler" if SCHED_RTDS
+	config SCHED_ARINC653_DEFAULT
+		bool "ARINC653 Scheduler" if SCHED_ARINC653
+	config SCHED_NULL_DEFAULT
+		bool "Null Scheduler" if SCHED_NULL
+endchoice
+
+config SCHED_DEFAULT
+	string
+	default "credit" if SCHED_CREDIT_DEFAULT
+	default "credit2" if SCHED_CREDIT2_DEFAULT
+	default "rtds" if SCHED_RTDS_DEFAULT
+	default "arinc653" if SCHED_ARINC653_DEFAULT
+	default "null" if SCHED_NULL_DEFAULT
+	default "credit2"
+
+endmenu
diff --git a/xen/common/sched/Makefile b/xen/common/sched/Makefile
new file mode 100644
index 0000000000..359af4f8bb
--- /dev/null
+++ b/xen/common/sched/Makefile
@@ -0,0 +1,7 @@ 
+obj-y += cpupool.o
+obj-$(CONFIG_SCHED_ARINC653) += sched_arinc653.o
+obj-$(CONFIG_SCHED_CREDIT) += sched_credit.o
+obj-$(CONFIG_SCHED_CREDIT2) += sched_credit2.o
+obj-$(CONFIG_SCHED_RTDS) += sched_rt.o
+obj-$(CONFIG_SCHED_NULL) += sched_null.o
+obj-y += schedule.o
diff --git a/xen/common/compat/schedule.c b/xen/common/sched/compat_schedule.c
similarity index 97%
rename from xen/common/compat/schedule.c
rename to xen/common/sched/compat_schedule.c
index 8b6e6f107d..2e450685d6 100644
--- a/xen/common/compat/schedule.c
+++ b/xen/common/sched/compat_schedule.c
@@ -37,7 +37,7 @@  static int compat_poll(struct compat_sched_poll *compat)
 #define do_poll compat_poll
 #define sched_poll compat_sched_poll
 
-#include "../schedule.c"
+#include "schedule.c"
 
 int compat_set_timer_op(u32 lo, s32 hi)
 {
diff --git a/xen/common/cpupool.c b/xen/common/sched/cpupool.c
similarity index 100%
rename from xen/common/cpupool.c
rename to xen/common/sched/cpupool.c
diff --git a/xen/common/sched_arinc653.c b/xen/common/sched/sched_arinc653.c
similarity index 100%
rename from xen/common/sched_arinc653.c
rename to xen/common/sched/sched_arinc653.c
diff --git a/xen/common/sched_credit.c b/xen/common/sched/sched_credit.c
similarity index 100%
rename from xen/common/sched_credit.c
rename to xen/common/sched/sched_credit.c
diff --git a/xen/common/sched_credit2.c b/xen/common/sched/sched_credit2.c
similarity index 100%
rename from xen/common/sched_credit2.c
rename to xen/common/sched/sched_credit2.c
diff --git a/xen/common/sched_null.c b/xen/common/sched/sched_null.c
similarity index 100%
rename from xen/common/sched_null.c
rename to xen/common/sched/sched_null.c
diff --git a/xen/common/sched_rt.c b/xen/common/sched/sched_rt.c
similarity index 100%
rename from xen/common/sched_rt.c
rename to xen/common/sched/sched_rt.c
diff --git a/xen/common/schedule.c b/xen/common/sched/schedule.c
similarity index 99%
rename from xen/common/schedule.c
rename to xen/common/sched/schedule.c
index e70cc70a65..a550dd8f93 100644
--- a/xen/common/schedule.c
+++ b/xen/common/sched/schedule.c
@@ -3125,7 +3125,7 @@  void __init sched_setup_dom0_vcpus(struct domain *d)
 #endif
 
 #ifdef CONFIG_COMPAT
-#include "compat/schedule.c"
+#include "compat_schedule.c"
 #endif
 
 #endif /* !COMPAT */