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
94cd0420
Commit
94cd0420
authored
Mar 17, 2023
by
FKHals
Browse files
Options
Downloads
Patches
Plain Diff
Distinguish syscalls in pb-scheduler
to prepare for using the pbm-model as the scheduling policy.
parent
6735145f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
kernel/exit.c
+10
-0
10 additions, 0 deletions
kernel/exit.c
kernel/fork.c
+10
-0
10 additions, 0 deletions
kernel/fork.c
kernel/sched/pb.c
+16
-0
16 additions, 0 deletions
kernel/sched/pb.c
kernel/sched/sched.h
+3
-0
3 additions, 0 deletions
kernel/sched/sched.h
with
39 additions
and
0 deletions
kernel/exit.c
+
10
−
0
View file @
94cd0420
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
#include
<asm/mmu_context.h>
#include
<asm/mmu_context.h>
#include
"behave.h"
#include
"behave.h"
#include
"sched/sched.h"
static
void
__unhash_process
(
struct
task_struct
*
p
,
bool
group_dead
)
static
void
__unhash_process
(
struct
task_struct
*
p
,
bool
group_dead
)
{
{
...
@@ -767,6 +768,15 @@ void __noreturn do_exit(long code)
...
@@ -767,6 +768,15 @@ void __noreturn do_exit(long code)
struct
task_struct
*
tsk
=
current
;
struct
task_struct
*
tsk
=
current
;
int
group_dead
;
int
group_dead
;
struct
rq
*
rq
;
rq
=
this_rq
();
// prevent syscalls from outside of the measured program (e.g. admin tasks) to be recognized
if
(
PB_EXEC_MODE
==
rq
->
pb
.
mode
)
{
// set flag so that the pb-scheduler knows which syscall triggered the scheduling
rq
->
pb
.
triggering_syscall
=
sched_trig_EXIT
;
}
// call the readout before the process is terminated
// call the readout before the process is terminated
if
(
is_relevant_process
(
tsk
))
{
if
(
is_relevant_process
(
tsk
))
{
pbm_exit
(
tsk
->
pid
,
tsk
->
real_parent
->
pid
);
pbm_exit
(
tsk
->
pid
,
tsk
->
real_parent
->
pid
);
...
...
This diff is collapsed.
Click to expand it.
kernel/fork.c
+
10
−
0
View file @
94cd0420
...
@@ -102,6 +102,7 @@
...
@@ -102,6 +102,7 @@
#include
<trace/events/task.h>
#include
<trace/events/task.h>
#include
"behave.h"
#include
"behave.h"
#include
"sched/sched.h"
/*
/*
* Minimum number of threads to boot the kernel
* Minimum number of threads to boot the kernel
...
@@ -2016,10 +2017,19 @@ long _do_fork(unsigned long clone_flags,
...
@@ -2016,10 +2017,19 @@ long _do_fork(unsigned long clone_flags,
int
trace
=
0
;
int
trace
=
0
;
long
nr
;
long
nr
;
struct
rq
*
rq
;
pbm_NODE
*
fork_date
;
pbm_NODE
*
fork_date
;
pid_t
parent_pid
=
current
->
pid
;
pid_t
parent_pid
=
current
->
pid
;
fork_date
=
NULL
;
fork_date
=
NULL
;
rq
=
this_rq
();
// prevent syscalls from outside of the measured program (e.g. admin tasks) to be recognized
if
(
PB_EXEC_MODE
==
rq
->
pb
.
mode
)
{
// set flag so that the pb-scheduler knows which syscall triggered the scheduling
rq
->
pb
.
triggering_syscall
=
sched_trig_FORK
;
}
// FIXME: This will not get called for mpirun since then bash will be the parent here
// FIXME: This will not get called for mpirun since then bash will be the parent here
if
(
is_relevant_process
(
current
))
{
if
(
is_relevant_process
(
current
))
{
printk
(
KERN_EMERG
"DO FORK CALLED by: '%s' %u
\n
"
,
current
->
comm
,
parent_pid
);
printk
(
KERN_EMERG
"DO FORK CALLED by: '%s' %u
\n
"
,
current
->
comm
,
parent_pid
);
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/pb.c
+
16
−
0
View file @
94cd0420
...
@@ -283,6 +283,22 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
...
@@ -283,6 +283,22 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
// EXEC Mode is next, so we return our next task to be executed
// EXEC Mode is next, so we return our next task to be executed
if
(
next_mode
==
PB_EXEC_MODE
)
{
if
(
next_mode
==
PB_EXEC_MODE
)
{
switch
(
pb
->
triggering_syscall
)
{
case
sched_trig_FORK
:
printk
(
KERN_WARNING
"FORK TRIGGERED THIS!!!
\n
"
);
break
;
case
sched_trig_EXIT
:
printk
(
KERN_WARNING
"EXIT TRIGGERED THIS!!!
\n
"
);
break
;
default:
printk
(
KERN_WARNING
"OTHER STUFF TRIGGERED THIS!!!
\n
"
);
break
;
}
// reset the flag so that the relevant syscalls can be detected if they are the trigger
pb
->
triggering_syscall
=
sched_trig_OTHER
;
// printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
// printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
if
(
current_mode
==
PB_ADMIN_MODE
)
{
if
(
current_mode
==
PB_ADMIN_MODE
)
{
printk
(
KERN_DEBUG
"PB ADMIN,STOP,%u,%llu
\n
"
,
pb
->
c_entry
,
sched_clock
());
printk
(
KERN_DEBUG
"PB ADMIN,STOP,%u,%llu
\n
"
,
pb
->
c_entry
,
sched_clock
());
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/sched.h
+
3
−
0
View file @
94cd0420
...
@@ -546,6 +546,8 @@ struct pb_plan {
...
@@ -546,6 +546,8 @@ struct pb_plan {
size_t
num_tasks
;
// number of tasks in the plan
size_t
num_tasks
;
// number of tasks in the plan
};
};
enum
sched_trigger_syscall
{
sched_trig_FORK
,
sched_trig_EXIT
,
sched_trig_OTHER
};
struct
pb_rq
struct
pb_rq
{
{
struct
plan_entry
*
plan
;
// plan (used to be proxy_task)
struct
plan_entry
*
plan
;
// plan (used to be proxy_task)
...
@@ -563,6 +565,7 @@ struct pb_rq
...
@@ -563,6 +565,7 @@ struct pb_rq
u64
total_instr
;
// total counted instructions for current plan
u64
total_instr
;
// total counted instructions for current plan
struct
perf_event
*
pevent
;
// linux perf handle
struct
perf_event
*
pevent
;
// linux perf handle
enum
sched_trigger_syscall
triggering_syscall
;
// which syscall triggered the scheduler
/*
/*
* flag determining whether the plan is completely initialized and should be run
* flag determining whether the plan is completely initialized and should be run
...
...
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