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
800bfc9c
Commit
800bfc9c
authored
5 years ago
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
saving a working state
parent
21662754
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
init/main.c
+1
-1
1 addition, 1 deletion
init/main.c
kernel/sched/edf.c
+50
-10
50 additions, 10 deletions
kernel/sched/edf.c
with
51 additions
and
11 deletions
init/main.c
+
1
−
1
View file @
800bfc9c
...
@@ -266,7 +266,7 @@ int kernel_main(void)
...
@@ -266,7 +266,7 @@ int kernel_main(void)
attr
.
policy
=
SCHED_EDF
;
attr
.
policy
=
SCHED_EDF
;
attr
.
period
=
us_to_ktime
(
400
);
attr
.
period
=
us_to_ktime
(
400
);
attr
.
deadline_rel
=
us_to_ktime
(
200
);
attr
.
deadline_rel
=
us_to_ktime
(
200
);
attr
.
wcet
=
us_to_ktime
(
9
0
);
attr
.
wcet
=
us_to_ktime
(
10
0
);
sched_set_attr
(
t
,
&
attr
);
sched_set_attr
(
t
,
&
attr
);
kthread_wake_up
(
t
);
kthread_wake_up
(
t
);
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/edf.c
+
50
−
10
View file @
800bfc9c
...
@@ -547,6 +547,48 @@ static ktime edf_hyperperiod(struct task_queue *tq)
...
@@ -547,6 +547,48 @@ static ktime edf_hyperperiod(struct task_queue *tq)
lcm
=
lcm
*
(
tsk
->
attr
.
period
/
a
);
lcm
=
lcm
*
(
tsk
->
attr
.
period
/
a
);
}
}
/* argh, need to consider everything */
list_for_each_entry_safe
(
tsk
,
tmp
,
&
tq
->
run
,
node
)
{
a
=
lcm
;
b
=
tsk
->
attr
.
period
;
/* already a multiple? */
if
(
a
%
b
==
0
)
continue
;
while
(
a
!=
b
)
{
if
(
a
>
b
)
a
-=
b
;
else
b
-=
a
;
}
lcm
=
lcm
*
(
tsk
->
attr
.
period
/
a
);
}
/* meh ... */
list_for_each_entry_safe
(
tsk
,
tmp
,
&
tq
->
wake
,
node
)
{
a
=
lcm
;
b
=
tsk
->
attr
.
period
;
/* already a multiple? */
if
(
a
%
b
==
0
)
continue
;
while
(
a
!=
b
)
{
if
(
a
>
b
)
a
-=
b
;
else
b
-=
a
;
}
lcm
=
lcm
*
(
tsk
->
attr
.
period
/
a
);
}
return
lcm
;
return
lcm
;
}
}
...
@@ -583,7 +625,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -583,7 +625,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
static
int64_t
dmin
=
0x7fffffffffffffLL
;
static
int64_t
dmin
=
0x7fffffffffffffLL
;
printk
(
"
\n
vvvv EDF analysis vvvv (%lld
m
s)
\n\n
"
,
ktime_to_
m
s
(
p
));
//
printk("\nvvvv EDF analysis vvvv (%lld
u
s) \n\n", ktime_to_
u
s(p));
/* list_empty(....) */
/* list_empty(....) */
...
@@ -591,7 +633,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -591,7 +633,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
printk
(
"appears to be empty
\n
"
);
printk
(
"appears to be empty
\n
"
);
list_for_each_entry_safe
(
tsk
,
tmp
,
&
tq
->
new
,
node
)
{
list_for_each_entry_safe
(
tsk
,
tmp
,
&
tq
->
new
,
node
)
{
printk
(
"%s
\n
"
,
tsk
->
name
);
//
printk("%s\n", tsk->name);
if
(
tsk
->
attr
.
period
>
max
)
{
if
(
tsk
->
attr
.
period
>
max
)
{
t0
=
tsk
;
t0
=
tsk
;
max
=
tsk
->
attr
.
period
;
max
=
tsk
->
attr
.
period
;
...
@@ -603,7 +645,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -603,7 +645,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
BUG_ON
(
p
<
t0
->
attr
.
period
);
BUG_ON
(
p
<
t0
->
attr
.
period
);
h
=
p
/
t0
->
attr
.
period
;
h
=
p
/
t0
->
attr
.
period
;
printk
(
"Period factor %lld, duration %lld actual min period: %lld
\n
"
,
h
,
ktime_to_
m
s
(
p
),
ktime_to_
m
s
(
t0
->
attr
.
period
));
printk
(
"Period factor %lld, duration %lld actual min period: %lld
\n
"
,
h
,
ktime_to_
u
s
(
p
),
ktime_to_
u
s
(
t0
->
attr
.
period
));
...
@@ -612,7 +654,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -612,7 +654,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
f1
=
ut
/
h
;
f1
=
ut
/
h
;
printk
(
"max UH: %lld, UT: %lld
\n
"
,
ktime_to_
m
s
(
uh
),
ktime_to_
m
s
(
ut
));
//
printk("max UH: %lld, UT: %lld\n", ktime_to_
u
s(uh), ktime_to_
u
s(ut));
...
@@ -622,7 +664,6 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -622,7 +664,6 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
if
(
!
list_empty
(
&
tq
->
wake
))
{
if
(
!
list_empty
(
&
tq
->
wake
))
{
list_for_each_entry_safe
(
tsk2
,
tmp2
,
&
tq
->
wake
,
node
)
{
list_for_each_entry_safe
(
tsk2
,
tmp2
,
&
tq
->
wake
,
node
)
{
printk
(
"%d
\n
"
,
__LINE__
);
if
(
tsk2
->
attr
.
policy
!=
SCHED_EDF
)
if
(
tsk2
->
attr
.
policy
!=
SCHED_EDF
)
continue
;
continue
;
...
@@ -634,7 +675,6 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -634,7 +675,6 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
if
(
!
list_empty
(
&
tq
->
run
))
{
if
(
!
list_empty
(
&
tq
->
run
))
{
list_for_each_entry_safe
(
tsk2
,
tmp2
,
&
tq
->
run
,
node
)
{
list_for_each_entry_safe
(
tsk2
,
tmp2
,
&
tq
->
run
,
node
)
{
printk
(
"%d
\n
"
,
__LINE__
);
if
(
tsk2
->
attr
.
policy
!=
SCHED_EDF
)
if
(
tsk2
->
attr
.
policy
!=
SCHED_EDF
)
continue
;
continue
;
...
@@ -667,7 +707,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -667,7 +707,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
/* slots after deadline of T0 */
/* slots after deadline of T0 */
st
=
h
*
tsk
->
attr
.
wcet
*
f1
/
tsk
->
attr
.
period
;
st
=
h
*
tsk
->
attr
.
wcet
*
f1
/
tsk
->
attr
.
period
;
printk
(
"%s tail usage: %lld
\n
"
,
tsk
->
name
,
ktime_to_ms
(
st
));
//
printk("%s tail usage: %lld\n", tsk->name, ktime_to_ms(st));
if
(
st
>
ut
)
{
if
(
st
>
ut
)
{
printk
(
"NOT SCHEDULABLE in tail: %s
\n
"
,
tsk
->
name
);
printk
(
"NOT SCHEDULABLE in tail: %s
\n
"
,
tsk
->
name
);
BUG
();
BUG
();
...
@@ -675,7 +715,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -675,7 +715,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
ut
=
ut
-
st
;
ut
=
ut
-
st
;
printk
(
"UH: %lld, UT: %lld
\n
"
,
ktime_to_ms
(
uh
),
ktime_to_ms
(
ut
));
//
printk("UH: %lld, UT: %lld\n", ktime_to_ms(uh), ktime_to_ms(ut));
...
@@ -697,7 +737,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -697,7 +737,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
return
-
EINVAL
;
return
-
EINVAL
;
printk
(
"changed task mode to RR
\n
"
,
u
);
printk
(
"changed task mode to RR
\n
"
,
u
);
}
else
{
}
else
{
printk
(
"Utilisation: %g
\n
"
,
u
);
//
printk("Utilisation: %g\n", u);
return
0
;
return
0
;
}
}
}
}
...
@@ -705,7 +745,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
...
@@ -705,7 +745,7 @@ static int edf_schedulable(struct task_queue *tq, const struct task_struct *task
u
=
(
double
)
(
int32_t
)
task
->
attr
.
wcet
/
(
double
)
(
int32_t
)
task
->
attr
.
period
;
u
=
(
double
)
(
int32_t
)
task
->
attr
.
wcet
/
(
double
)
(
int32_t
)
task
->
attr
.
period
;
printk
(
"was the first task, utilisation: %g
\n
"
,
u
);
//
printk("was the first task, utilisation: %g\n", u);
return
0
;
return
0
;
}
}
...
...
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