Skip to content

Commit 6b778f3

Browse files
nashifkrish2718
authored andcommitted
[nrf fromtree] kernel: rename 'dumb' scheduler and simply call it 'simple'
Improve naming of the scheduler and call it what it is: simple. Using 'dumb' for the default scheduler algorithm in Zephyr is a bad idea. Signed-off-by: Anas Nashif <[email protected]> (cherry picked from commit f29ae72)
1 parent d55201d commit 6b778f3

File tree

21 files changed

+75
-57
lines changed

21 files changed

+75
-57
lines changed

boards/qemu/x86/qemu_x86_atom_nommu_defconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=25000000
1010
CONFIG_TEST_RANDOM_GENERATOR=y
1111
CONFIG_X86_MMU=n
1212
CONFIG_DEBUG_INFO=y
13-
CONFIG_SCHED_DUMB=y
14-
CONFIG_WAITQ_DUMB=y
13+
CONFIG_SCHED_SIMPLE=y
14+
CONFIG_WAITQ_SIMPLE=y
1515
CONFIG_X86_VERY_EARLY_CONSOLE=n

doc/kernel/services/scheduling/index.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The kernel can be built with one of several choices for the ready queue
5959
implementation, offering different choices between code size, constant factor
6060
runtime overhead and performance scaling when many threads are added.
6161

62-
* Simple linked-list ready queue (:kconfig:option:`CONFIG_SCHED_DUMB`)
62+
* Simple linked-list ready queue (:kconfig:option:`CONFIG_SCHED_SIMPLE`)
6363

6464
The scheduler ready queue will be implemented as a simple unordered list, with
6565
very fast constant time performance for single threads and very low code size.
@@ -95,7 +95,7 @@ runtime overhead and performance scaling when many threads are added.
9595
list of threads.
9696

9797
Typical applications with small numbers of runnable threads probably want the
98-
DUMB scheduler.
98+
simple scheduler.
9999

100100

101101
The wait_q abstraction used in IPC primitives to pend threads for later wakeup
@@ -106,13 +106,13 @@ the same options.
106106

107107
When selected, the wait_q will be implemented with a balanced tree. Choose
108108
this if you expect to have many threads waiting on individual primitives.
109-
There is a ~2kb code size increase over :kconfig:option:`CONFIG_WAITQ_DUMB` (which may
109+
There is a ~2kb code size increase over :kconfig:option:`CONFIG_WAITQ_SIMPLE` (which may
110110
be shared with :kconfig:option:`CONFIG_SCHED_SCALABLE`) if the red/black tree is not
111111
used elsewhere in the application, and pend/unpend operations on "small"
112112
queues will be somewhat slower (though this is not generally a performance
113113
path).
114114

115-
* Simple linked-list wait_q (:kconfig:option:`CONFIG_WAITQ_DUMB`)
115+
* Simple linked-list wait_q (:kconfig:option:`CONFIG_WAITQ_SIMPLE`)
116116

117117
When selected, the wait_q will be implemented with a doubly-linked list.
118118
Choose this if you expect to have only a few threads blocked on any single

doc/kernel/services/smp/smp.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ traversed in full. The kernel does not keep a per-CPU run queue.
118118
That means that the performance benefits from the
119119
:kconfig:option:`CONFIG_SCHED_SCALABLE` and :kconfig:option:`CONFIG_SCHED_MULTIQ`
120120
scheduler backends cannot be realized. CPU mask processing is
121-
available only when :kconfig:option:`CONFIG_SCHED_DUMB` is the selected
121+
available only when :kconfig:option:`CONFIG_SCHED_SIMPLE` is the selected
122122
backend. This requirement is enforced in the configuration layer.
123123

124124
SMP Boot Process

doc/releases/release-notes-4.2.rst

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ Removed APIs and options
5252
========================
5353

5454
Deprecated APIs and options
55+
56+
* The scheduler Kconfig options CONFIG_SCHED_DUMB and CONFIG_WAITQ_DUMB were
57+
renamed and deprecated. Use :kconfig:option:`CONFIG_SCHED_SIMPLE` and
58+
:kconfig:option:`CONFIG_WAITQ_SIMPLE` instead.
59+
5560
===========================
5661

5762
New APIs and options

include/zephyr/kernel_structs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ struct _ready_q {
133133
struct k_thread *cache;
134134
#endif
135135

136-
#if defined(CONFIG_SCHED_DUMB)
136+
#if defined(CONFIG_SCHED_SIMPLE)
137137
sys_dlist_t runq;
138138
#elif defined(CONFIG_SCHED_SCALABLE)
139139
struct _priq_rb runq;

kernel/Kconfig

+23-9
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ config SCHED_DEADLINE
120120

121121
config SCHED_CPU_MASK
122122
bool "CPU mask affinity/pinning API"
123-
depends on SCHED_DUMB
123+
depends on SCHED_SIMPLE
124124
help
125125
When true, the application will have access to the
126126
k_thread_cpu_mask_*() APIs which control per-CPU affinity masks in
127127
SMP mode, allowing applications to pin threads to specific CPUs or
128128
disallow threads from running on given CPUs. Note that as currently
129129
implemented, this involves an inherent O(N) scaling in the number of
130-
idle-but-runnable threads, and thus works only with the DUMB
130+
idle-but-runnable threads, and thus works only with the simple
131131
scheduler (as SCALABLE and MULTIQ would see no benefit).
132132

133133
Note that this setting does not technically depend on SMP and is
@@ -296,16 +296,23 @@ endchoice # DYNAMIC_THREAD_PREFER
296296

297297
endif # DYNAMIC_THREADS
298298

299+
config SCHED_DUMB
300+
bool "Simple linked-list ready queue"
301+
select DEPRECATED
302+
help
303+
Deprecated in favour of SCHED_SIMPLE.
304+
299305
choice SCHED_ALGORITHM
300306
prompt "Scheduler priority queue algorithm"
301-
default SCHED_DUMB
307+
default SCHED_SIMPLE if SCHED_DUMB
308+
default SCHED_SIMPLE
302309
help
303310
The kernel can be built with several choices for the
304311
ready queue implementation, offering different choices between
305312
code size, constant factor runtime overhead and performance
306313
scaling when many threads are added.
307314

308-
config SCHED_DUMB
315+
config SCHED_SIMPLE
309316
bool "Simple linked-list ready queue"
310317
help
311318
When selected, the scheduler ready queue will be implemented
@@ -338,20 +345,27 @@ config SCHED_MULTIQ
338345
as the classic/textbook array of lists, one per priority.
339346
This corresponds to the scheduler algorithm used in Zephyr
340347
versions prior to 1.12. It incurs only a tiny code size
341-
overhead vs. the "dumb" scheduler and runs in O(1) time
348+
overhead vs. the "simple" scheduler and runs in O(1) time
342349
in almost all circumstances with very low constant factor.
343350
But it requires a fairly large RAM budget to store those list
344351
heads, and the limited features make it incompatible with
345352
features like deadline scheduling that need to sort threads
346353
more finely, and SMP affinity which need to traverse the list
347354
of threads. Typical applications with small numbers of runnable
348-
threads probably want the DUMB scheduler.
355+
threads probably want the simple scheduler.
349356

350357
endchoice # SCHED_ALGORITHM
351358

359+
config WAITQ_DUMB
360+
bool "Simple linked-list wait_q"
361+
select DEPRECATED
362+
help
363+
Deprecated in favour of WAITQ_SIMPLE.
364+
352365
choice WAITQ_ALGORITHM
353366
prompt "Wait queue priority algorithm"
354-
default WAITQ_DUMB
367+
default WAITQ_SIMPLE if WAITQ_DUMB
368+
default WAITQ_SIMPLE
355369
help
356370
The wait_q abstraction used in IPC primitives to pend
357371
threads for later wakeup shares the same backend data
@@ -364,13 +378,13 @@ config WAITQ_SCALABLE
364378
When selected, the wait_q will be implemented with a
365379
balanced tree. Choose this if you expect to have many
366380
threads waiting on individual primitives. There is a ~2kb
367-
code size increase over WAITQ_DUMB (which may be shared with
381+
code size increase over WAITQ_SIMPLE (which may be shared with
368382
SCHED_SCALABLE) if the rbtree is not used elsewhere in the
369383
application, and pend/unpend operations on "small" queues
370384
will be somewhat slower (though this is not generally a
371385
performance path).
372386

373-
config WAITQ_DUMB
387+
config WAITQ_SIMPLE
374388
bool "Simple linked-list wait_q"
375389
help
376390
When selected, the wait_q will be implemented with a

kernel/include/priority_q.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b);
1414

1515
/* Dumb Scheduling */
16-
#if defined(CONFIG_SCHED_DUMB)
17-
#define _priq_run_init z_priq_dumb_init
18-
#define _priq_run_add z_priq_dumb_add
19-
#define _priq_run_remove z_priq_dumb_remove
20-
#define _priq_run_yield z_priq_dumb_yield
16+
#if defined(CONFIG_SCHED_SIMPLE)
17+
#define _priq_run_init z_priq_simple_init
18+
#define _priq_run_add z_priq_simple_add
19+
#define _priq_run_remove z_priq_simple_remove
20+
#define _priq_run_yield z_priq_simple_yield
2121
# if defined(CONFIG_SCHED_CPU_MASK)
22-
# define _priq_run_best z_priq_dumb_mask_best
22+
# define _priq_run_best z_priq_simple_mask_best
2323
# else
24-
# define _priq_run_best z_priq_dumb_best
24+
# define _priq_run_best z_priq_simple_best
2525
# endif /* CONFIG_SCHED_CPU_MASK */
2626
/* Scalable Scheduling */
2727
#elif defined(CONFIG_SCHED_SCALABLE)
@@ -45,10 +45,10 @@ bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b);
4545
#define _priq_wait_remove z_priq_rb_remove
4646
#define _priq_wait_best z_priq_rb_best
4747
/* Dumb Wait Queue */
48-
#elif defined(CONFIG_WAITQ_DUMB)
49-
#define _priq_wait_add z_priq_dumb_add
50-
#define _priq_wait_remove z_priq_dumb_remove
51-
#define _priq_wait_best z_priq_dumb_best
48+
#elif defined(CONFIG_WAITQ_SIMPLE)
49+
#define _priq_wait_add z_priq_simple_add
50+
#define _priq_wait_remove z_priq_simple_remove
51+
#define _priq_wait_best z_priq_simple_best
5252
#endif
5353

5454
#if defined(CONFIG_64BIT)
@@ -59,7 +59,7 @@ bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b);
5959
#define TRAILING_ZEROS u32_count_trailing_zeros
6060
#endif /* CONFIG_64BIT */
6161

62-
static ALWAYS_INLINE void z_priq_dumb_init(sys_dlist_t *pq)
62+
static ALWAYS_INLINE void z_priq_simple_init(sys_dlist_t *pq)
6363
{
6464
sys_dlist_init(pq);
6565
}
@@ -105,7 +105,7 @@ static ALWAYS_INLINE int32_t z_sched_prio_cmp(struct k_thread *thread_1, struct
105105
return 0;
106106
}
107107

108-
static ALWAYS_INLINE void z_priq_dumb_add(sys_dlist_t *pq, struct k_thread *thread)
108+
static ALWAYS_INLINE void z_priq_simple_add(sys_dlist_t *pq, struct k_thread *thread)
109109
{
110110
struct k_thread *t;
111111

@@ -119,14 +119,14 @@ static ALWAYS_INLINE void z_priq_dumb_add(sys_dlist_t *pq, struct k_thread *thre
119119
sys_dlist_append(pq, &thread->base.qnode_dlist);
120120
}
121121

122-
static ALWAYS_INLINE void z_priq_dumb_remove(sys_dlist_t *pq, struct k_thread *thread)
122+
static ALWAYS_INLINE void z_priq_simple_remove(sys_dlist_t *pq, struct k_thread *thread)
123123
{
124124
ARG_UNUSED(pq);
125125

126126
sys_dlist_remove(&thread->base.qnode_dlist);
127127
}
128128

129-
static ALWAYS_INLINE void z_priq_dumb_yield(sys_dlist_t *pq)
129+
static ALWAYS_INLINE void z_priq_simple_yield(sys_dlist_t *pq)
130130
{
131131
#ifndef CONFIG_SMP
132132
sys_dnode_t *n;
@@ -157,7 +157,7 @@ static ALWAYS_INLINE void z_priq_dumb_yield(sys_dlist_t *pq)
157157
#endif
158158
}
159159

160-
static ALWAYS_INLINE struct k_thread *z_priq_dumb_best(sys_dlist_t *pq)
160+
static ALWAYS_INLINE struct k_thread *z_priq_simple_best(sys_dlist_t *pq)
161161
{
162162
struct k_thread *thread = NULL;
163163
sys_dnode_t *n = sys_dlist_peek_head(pq);
@@ -169,7 +169,7 @@ static ALWAYS_INLINE struct k_thread *z_priq_dumb_best(sys_dlist_t *pq)
169169
}
170170

171171
#ifdef CONFIG_SCHED_CPU_MASK
172-
static ALWAYS_INLINE struct k_thread *z_priq_dumb_mask_best(sys_dlist_t *pq)
172+
static ALWAYS_INLINE struct k_thread *z_priq_simple_mask_best(sys_dlist_t *pq)
173173
{
174174
/* With masks enabled we need to be prepared to walk the list
175175
* looking for one we can run

samples/basic/minimal/mt.conf

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ CONFIG_NUM_COOP_PRIORITIES=16
33
CONFIG_NUM_METAIRQ_PRIORITIES=0
44

55
CONFIG_ERRNO=n
6-
CONFIG_SCHED_DUMB=y
7-
CONFIG_WAITQ_DUMB=y
8-
6+
CONFIG_SCHED_SIMPLE=y
7+
CONFIG_WAITQ_SIMPLE=y

soc/espressif/esp32/Kconfig.defconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ config SCHED_IPI_SUPPORTED
1818
default y
1919

2020
config SCHED_CPU_MASK
21-
default y if SCHED_DUMB
21+
default y if SCHED_SIMPLE
2222

2323
config MP_MAX_NUM_CPUS
2424
default 2

tests/benchmarks/sched/prj.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CONFIG_TEST=y
22
CONFIG_NUM_PREEMPT_PRIORITIES=8
33
CONFIG_NUM_COOP_PRIORITIES=8
44

5-
# Switch these between DUMB/SCALABLE (and SCHED_MULTIQ) to measure
5+
# Switch these between SIMPLE/SCALABLE (and SCHED_MULTIQ) to measure
66
# different backends
7-
CONFIG_SCHED_DUMB=y
8-
CONFIG_WAITQ_DUMB=y
7+
CONFIG_SCHED_SIMPLE=y
8+
CONFIG_WAITQ_SIMPLE=y

tests/benchmarks/sched/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int main(void)
169169
}
170170

171171
/* For reference, an unmodified HEAD on qemu_x86 with
172-
* !USERSPACE and SCHED_DUMB and using -icount
172+
* !USERSPACE and SCHED_SIMPLE and using -icount
173173
* shift=0,sleep=off,align=off, I get results of:
174174
*
175175
* unpend 132 ready 257 switch 278 pend 321 tot 988 (avg 900)

tests/benchmarks/sched_queues/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Scheduling Queue Measurements
22
#############################
33

44
A Zephyr application developer may choose between three different scheduling
5-
algorithms: dumb, scalable and multiq. These different algorithms have
5+
algorithms: simple, scalable and multiq. These different algorithms have
66
different performance characteristics that vary as the
77
number of ready threads increases. This benchmark can be used to help
88
determine which scheduling algorithm may best suit the developer's application.

tests/benchmarks/sched_queues/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ int main(void)
239239
freq = timing_freq_get_mhz();
240240

241241
printk("Time Measurements for %s sched queues\n",
242-
IS_ENABLED(CONFIG_SCHED_DUMB) ? "dumb" :
242+
IS_ENABLED(CONFIG_SCHED_SIMPLE) ? "simple" :
243243
IS_ENABLED(CONFIG_SCHED_SCALABLE) ? "scalable" : "multiq");
244244
printk("Timing results: Clock frequency: %u MHz\n", freq);
245245

tests/benchmarks/sched_queues/testcase.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ common:
2121
- CONFIG_BENCHMARK_RECORDING=y
2222

2323
tests:
24-
benchmark.sched_queues.dumb:
24+
benchmark.sched_queues.simple:
2525
extra_configs:
26-
- CONFIG_SCHED_DUMB=y
26+
- CONFIG_SCHED_SIMPLE=y
2727

2828
benchmark.sched_queues.scalable:
2929
extra_configs:

tests/benchmarks/wait_queues/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Wait Queue Measurements
22
#######################
33

44
A Zehpyr application developer may choose between two different wait queue
5-
implementations: dumb and scalable. These two queue implementations perform
5+
implementations: simple and scalable. These two queue implementations perform
66
differently under different loads. This benchmark can be used to showcase how
77
the performance of these two implementations vary under varying conditions.
88

tests/benchmarks/wait_queues/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ int main(void)
228228
freq = timing_freq_get_mhz();
229229

230230
printk("Time Measurements for %s wait queues\n",
231-
IS_ENABLED(CONFIG_WAITQ_DUMB) ? "dumb" : "scalable");
231+
IS_ENABLED(CONFIG_WAITQ_SIMPLE) ? "simple" : "scalable");
232232
printk("Timing results: Clock frequency: %u MHz\n", freq);
233233

234234
z_waitq_init(&wait_q);

tests/benchmarks/wait_queues/testcase.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ common:
2020
- CONFIG_BENCHMARK_RECORDING=y
2121

2222
tests:
23-
benchmark.wait_queues.dumb:
23+
benchmark.wait_queues.simple:
2424
extra_configs:
25-
- CONFIG_WAITQ_DUMB=y
25+
- CONFIG_WAITQ_SIMPLE=y
2626

2727
benchmark.wait_queues.scalable:
2828
extra_configs:

tests/kernel/sched/deadline/prj.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CONFIG_BT=n
66

77
# Deadline is not compatible with MULTIQ, so we have to pick something
88
# specific instead of using the board-level default.
9-
CONFIG_SCHED_DUMB=y
9+
CONFIG_SCHED_SIMPLE=y
1010

1111
CONFIG_IRQ_OFFLOAD=y
1212
CONFIG_IRQ_OFFLOAD_NESTED=n

tests/kernel/sched/schedule_api/prj_dumb.conf renamed to tests/kernel/sched/schedule_api/prj_simple.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CONFIG_ZTEST=y
22
CONFIG_IRQ_OFFLOAD=y
33
CONFIG_TEST_USERSPACE=y
4-
CONFIG_SCHED_DUMB=y
4+
CONFIG_SCHED_SIMPLE=y
55
CONFIG_MAX_THREAD_BYTES=6
66
CONFIG_MP_MAX_NUM_CPUS=1
77
CONFIG_ZTEST_FATAL_HOOK=y

tests/kernel/sched/schedule_api/testcase.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ tests:
2929
extra_args: CONF_FILE=prj_multiq.conf
3030
extra_configs:
3131
- CONFIG_TIMESLICING=n
32-
kernel.scheduler.dumb_timeslicing:
33-
extra_args: CONF_FILE=prj_dumb.conf
32+
kernel.scheduler.simple_timeslicing:
33+
extra_args: CONF_FILE=prj_simple.conf
3434
extra_configs:
3535
- CONFIG_TIMESLICING=y
36-
kernel.scheduler.dumb_no_timeslicing:
37-
extra_args: CONF_FILE=prj_dumb.conf
36+
kernel.scheduler.simple_no_timeslicing:
37+
extra_args: CONF_FILE=prj_simple.conf
3838
extra_configs:
3939
- CONFIG_TIMESLICING=n

tests/lib/p4workq/prj.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ CONFIG_SCHED_DEADLINE=y
44
CONFIG_LOG_DEFAULT_LEVEL=1
55
# Test whiteboxes the wait_q and expects it to be a dlist
66
CONFIG_WAITQ_SCALABLE=n
7-
CONFIG_WAITQ_DUMB=y
7+
CONFIG_WAITQ_SIMPLE=y

0 commit comments

Comments
 (0)