Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlightOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Luntzer
FlightOS
Commits
06c8b14a
Commit
06c8b14a
authored
5 years ago
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
ordering in EDF still required some fixups
parent
d30f551f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernel/sched/edf.c
+20
-24
20 additions, 24 deletions
kernel/sched/edf.c
tools/testing/unittest/edf/edf_test.c
+8
-8
8 additions, 8 deletions
tools/testing/unittest/edf/edf_test.c
with
28 additions
and
32 deletions
kernel/sched/edf.c
+
20
−
24
View file @
06c8b14a
...
@@ -930,18 +930,11 @@ static struct task_struct *edf_pick_next(struct task_queue *tq)
...
@@ -930,18 +930,11 @@ static struct task_struct *edf_pick_next(struct task_queue *tq)
/* nope, just update minimum runtime for this slot */
/* nope, just update minimum runtime for this slot */
if
(
delta
<
slot
)
{
if
(
delta
<
slot
)
slot
=
delta
;
slot
=
delta
;
// printk("d %lld now: %lld \n", ktime_to_us(delta), now);
}
// printk("delta %llu %llu\n", delta, tsk->wakeup);
continue
;
}
if
(
delta
<
0
)
{
// printk("\n%lld %d\n", ktime_to_us(delta), tsk->state);
continue
;
// printk("%s: %lld (%lld) deadline: %lld now: %lld state %d\n", tsk->name, ktime_to_ms(delta), tsk->wakeup, tsk->deadline, now, tsk->state);
}
}
/* if it's already running, see if there is time remaining */
/* if it's already running, see if there is time remaining */
...
@@ -949,20 +942,16 @@ static struct task_struct *edf_pick_next(struct task_queue *tq)
...
@@ -949,20 +942,16 @@ static struct task_struct *edf_pick_next(struct task_queue *tq)
if
(
!
schedule_edf_can_execute
(
tsk
,
now
))
{
if
(
!
schedule_edf_can_execute
(
tsk
,
now
))
{
schedule_edf_reinit_task
(
tsk
,
now
);
schedule_edf_reinit_task
(
tsk
,
now
);
// printk("reinit %s\n", tsk->name);
/* nope, update minimum runtime for this slot */
/* nope, update minimum runtime for this slot */
delta
=
ktime_delta
(
tsk
->
wakeup
,
now
);
delta
=
ktime_delta
(
tsk
->
wakeup
,
now
);
/* if wakeup must happen earlier than the next
/* if wakeup must happen earlier than the next
* scheduling event, adjust the slot timeout
* scheduling event, adjust the slot timeout
*/
*/
if
(
delta
<
slot
)
{
if
(
delta
<
slot
)
slot
=
delta
;
slot
=
delta
;
// printk("slot %lld\n", ktime_to_us(delta));
}
if
(
delta
<
0
)
printk
(
"delta %lld %lld
\n
"
,
ktime_to_us
(
delta
),
ktime_to_us
(
tick_get_period_min_ns
()));
BUG_ON
(
delta
<
0
);
BUG_ON
(
delta
<
0
);
list_move_tail
(
&
tsk
->
node
,
&
tq
->
run
);
list_move_tail
(
&
tsk
->
node
,
&
tq
->
run
);
...
@@ -1024,14 +1013,20 @@ static struct task_struct *edf_pick_next(struct task_queue *tq)
...
@@ -1024,14 +1013,20 @@ static struct task_struct *edf_pick_next(struct task_queue *tq)
slot
=
first
->
runtime
;
slot
=
first
->
runtime
;
}
}
#if 0
#if 1
if
(
!
go
)
{
list_for_each_entry_safe
(
tsk
,
tmp
,
&
tq
->
run
,
node
)
{
list_for_each_entry_safe
(
tsk
,
tmp
,
&
tq
->
run
,
node
)
{
printk("%c %s %lld %lld\n",
(tsk->state == TASK_RUN) ? 'R' : 'I',
if
(
tsk
->
state
!=
TASK_RUN
)
tsk->name,
continue
;
ktime_to_ms(ktime_delta(tsk->wakeup, now)),
ktime_to_ms(ktime_delta(tsk->deadline, now))
if
(
ktime_before
(
tsk
->
wakeup
,
now
))
{
);
go
=
tsk
;
slot
=
tsk
->
runtime
;
break
;
}
}
}
}
#endif
#endif
// if (!go)
// if (!go)
...
@@ -1137,6 +1132,7 @@ static ktime edf_timeslice_ns(struct task_struct *task)
...
@@ -1137,6 +1132,7 @@ static ktime edf_timeslice_ns(struct task_struct *task)
static
int
edf_check_sched_attr
(
struct
sched_attr
*
attr
)
static
int
edf_check_sched_attr
(
struct
sched_attr
*
attr
)
{
{
return
0
;
/* XXX */
if
(
!
attr
)
if
(
!
attr
)
goto
error
;
goto
error
;
...
...
This diff is collapsed.
Click to expand it.
tools/testing/unittest/edf/edf_test.c
+
8
−
8
View file @
06c8b14a
...
@@ -88,9 +88,9 @@ static void sched_edf_create_tasks_test(void)
...
@@ -88,9 +88,9 @@ static void sched_edf_create_tasks_test(void)
t
->
sched
=
&
sched_edf
;
t
->
sched
=
&
sched_edf
;
t
->
attr
.
policy
=
SCHED_EDF
;
t
->
attr
.
policy
=
SCHED_EDF
;
t
->
attr
.
period
=
us_to_ktime
(
8
00
);
t
->
attr
.
period
=
us_to_ktime
(
15
00
);
t
->
attr
.
deadline_rel
=
us_to_ktime
(
7
00
);
t
->
attr
.
deadline_rel
=
us_to_ktime
(
4
00
);
t
->
attr
.
wcet
=
us_to_ktime
(
2
00
);
t
->
attr
.
wcet
=
us_to_ktime
(
3
00
);
edf_enqueue
(
&
t
->
sched
->
tq
,
t
);
edf_enqueue
(
&
t
->
sched
->
tq
,
t
);
...
@@ -105,9 +105,9 @@ static void sched_edf_create_tasks_test(void)
...
@@ -105,9 +105,9 @@ static void sched_edf_create_tasks_test(void)
t
->
sched
=
&
sched_edf
;
t
->
sched
=
&
sched_edf
;
t
->
attr
.
policy
=
SCHED_EDF
;
t
->
attr
.
policy
=
SCHED_EDF
;
t
->
attr
.
period
=
us_to_ktime
(
30
0
);
t
->
attr
.
period
=
us_to_ktime
(
30
);
t
->
attr
.
deadline_rel
=
us_to_ktime
(
20
0
);
t
->
attr
.
deadline_rel
=
us_to_ktime
(
20
);
t
->
attr
.
wcet
=
us_to_ktime
(
10
0
);
t
->
attr
.
wcet
=
us_to_ktime
(
10
);
edf_enqueue
(
&
t
->
sched
->
tq
,
t
);
edf_enqueue
(
&
t
->
sched
->
tq
,
t
);
...
@@ -122,7 +122,7 @@ static void sched_edf_create_tasks_test(void)
...
@@ -122,7 +122,7 @@ static void sched_edf_create_tasks_test(void)
t
->
sched
=
&
sched_edf
;
t
->
sched
=
&
sched_edf
;
t
->
attr
.
policy
=
SCHED_EDF
;
t
->
attr
.
policy
=
SCHED_EDF
;
t
->
attr
.
period
=
us_to_ktime
(
2
000
);
t
->
attr
.
period
=
us_to_ktime
(
3
000
);
t
->
attr
.
deadline_rel
=
us_to_ktime
(
900
);
t
->
attr
.
deadline_rel
=
us_to_ktime
(
900
);
t
->
attr
.
wcet
=
us_to_ktime
(
100
);
t
->
attr
.
wcet
=
us_to_ktime
(
100
);
edf_enqueue
(
&
t
->
sched
->
tq
,
t
);
edf_enqueue
(
&
t
->
sched
->
tq
,
t
);
...
@@ -133,7 +133,7 @@ static void sched_edf_create_tasks_test(void)
...
@@ -133,7 +133,7 @@ static void sched_edf_create_tasks_test(void)
* @test sched_edf_create_tasks_test
* @test sched_edf_create_tasks_test
*/
*/
#define CYCLES 1
#define CYCLES 1
0000
static
void
sched_edf_schedule_test
(
void
)
static
void
sched_edf_schedule_test
(
void
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment