Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kernel Program Behaviour Models
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixkhals
Kernel Program Behaviour Models
Commits
ce747d68
Commit
ce747d68
authored
Aug 26, 2022
by
ManuelWelte
Browse files
Options
Downloads
Patches
Plain Diff
Initial syscall implementation
parent
6bc5a61b
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/pb.c
+38
-0
38 additions, 0 deletions
kernel/sched/pb.c
kernel/sched/sched.h
+8
-0
8 additions, 0 deletions
kernel/sched/sched.h
with
46 additions
and
0 deletions
kernel/sched/pb.c
+
38
−
0
View file @
ce747d68
...
...
@@ -11,6 +11,43 @@ struct pb_plan {
};
typedef
struct
pb_plan
pb_plan_t
;
typedef
struct
pb_plan_info
pb_plan_info_t
;
SYSCALL_DEFINE1
(
pb_set_plan_debug
,
pb_plan_info_t
*
,
plan_info
)
{
pb_plan_info_t
_plan_info
;
int
res
;
res
=
copy_from_user
(
&
_plan_info
,
plan_info
,
sizeof
(
pb_plan_info_t
));
struct
task_struct
*
task
=
find_task_by_vpid
(
_plan_info
.
pid
);
task
->
sched_class
=
&
pb_sched_class
;
struct
rq
*
rq
;
rq
=
this_rq
();
struct
pb_rq
*
pb_rq
=
&
rq
->
pb
;
set_pb_plan_size
(
pb_rq
,
_plan_info
.
num_tasks
);
unsigned
int
i
;
for
(
i
=
0
;
i
<
_plan_info
.
num_tasks
;
i
++
)
{
set_pb_plan_entry
(
pb_rq
,
i
,
_plan_info
.
inst_cnt
[
i
],
i
,
task
);
}
pb_submit_plan
(
rq
);
// TODO:
// - perf_event stuff
// - ...
return
0
;
}
SYSCALL_DEFINE1
(
pb_set_plan
,
pb_plan_t
*
,
plan
)
{
pb_plan_t
_plan
=
{
0
};
int
res
;
...
...
@@ -24,6 +61,7 @@ SYSCALL_DEFINE1(pb_set_plan, pb_plan_t*, plan) {
*/
int
pb_submit_plan
(
struct
rq
*
rq
)
{
find_task_by_vpid
(
20
);
/*
* Must be volatile to ensure correct initialization order
*/
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/sched.h
+
8
−
0
View file @
ce747d68
...
...
@@ -540,6 +540,12 @@ struct pb_init_struct
u64
n_admin_cycles
;
// amount of timer ticks before PB tasks are allowed to run
};
struct
pb_plan_info
{
pid_t
pid
;
uint64_t
*
inst_cnt
;
size_t
num_tasks
;
};
struct
pb_rq
{
struct
plan_entry
*
plan
;
// plan (used to be proxy_task)
...
...
@@ -891,6 +897,8 @@ static inline int cpu_of(struct rq *rq)
#endif
}
struct
task_struct
*
find_task_by_vpid
(
pid_t
vnr
);
// used to determine the next mode of the PB-Scheduler
// This function is located in sched.h since pb.c and fair.c are using this function
static
inline
int
determine_next_mode_pb
(
struct
rq
*
rq
)
...
...
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