diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-02-12 11:45:17 -0500 |
---|---|---|
committer | Namhoon Kim <namhoonk@cs.unc.edu> | 2014-10-21 10:03:20 -0400 |
commit | 87c71e1c704021c7381821a6c654096db4f07b20 (patch) | |
tree | 41ecc426bb69e45a2f98f88bdf5baf26ed380715 | |
parent | 1042b270f038a2c654d93aa3fd8b9ae9abe542d9 (diff) |
Hook into fork(), exec(), and exit()
Allow LITMUS^RT to do some work when a process is created or
terminated.
-rw-r--r-- | fs/exec.c | 3 | ||||
-rw-r--r-- | kernel/exit.c | 4 | ||||
-rw-r--r-- | kernel/fork.c | 9 |
3 files changed, 16 insertions, 0 deletions
@@ -56,6 +56,8 @@ | |||
56 | #include <linux/oom.h> | 56 | #include <linux/oom.h> |
57 | #include <linux/compat.h> | 57 | #include <linux/compat.h> |
58 | 58 | ||
59 | #include <litmus/litmus.h> | ||
60 | |||
59 | #include <asm/uaccess.h> | 61 | #include <asm/uaccess.h> |
60 | #include <asm/mmu_context.h> | 62 | #include <asm/mmu_context.h> |
61 | #include <asm/tlb.h> | 63 | #include <asm/tlb.h> |
@@ -1506,6 +1508,7 @@ static int do_execve_common(const char *filename, | |||
1506 | goto out_unmark; | 1508 | goto out_unmark; |
1507 | 1509 | ||
1508 | sched_exec(); | 1510 | sched_exec(); |
1511 | litmus_exec(); | ||
1509 | 1512 | ||
1510 | bprm->file = file; | 1513 | bprm->file = file; |
1511 | bprm->filename = filename; | 1514 | bprm->filename = filename; |
diff --git a/kernel/exit.c b/kernel/exit.c index 7bb73f9d09db..ab36666c0875 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -59,6 +59,8 @@ | |||
59 | #include <asm/pgtable.h> | 59 | #include <asm/pgtable.h> |
60 | #include <asm/mmu_context.h> | 60 | #include <asm/mmu_context.h> |
61 | 61 | ||
62 | extern void exit_od_table(struct task_struct *t); | ||
63 | |||
62 | static void exit_mm(struct task_struct * tsk); | 64 | static void exit_mm(struct task_struct * tsk); |
63 | 65 | ||
64 | static void __unhash_process(struct task_struct *p, bool group_dead) | 66 | static void __unhash_process(struct task_struct *p, bool group_dead) |
@@ -781,6 +783,8 @@ void do_exit(long code) | |||
781 | tty_audit_exit(); | 783 | tty_audit_exit(); |
782 | audit_free(tsk); | 784 | audit_free(tsk); |
783 | 785 | ||
786 | exit_od_table(tsk); | ||
787 | |||
784 | tsk->exit_code = code; | 788 | tsk->exit_code = code; |
785 | taskstats_exit(tsk, group_dead); | 789 | taskstats_exit(tsk, group_dead); |
786 | 790 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index ff7be9dac4c1..b8aa56baa0f4 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -81,6 +81,9 @@ | |||
81 | 81 | ||
82 | #include <trace/events/sched.h> | 82 | #include <trace/events/sched.h> |
83 | 83 | ||
84 | #include <litmus/litmus.h> | ||
85 | #include <litmus/sched_plugin.h> | ||
86 | |||
84 | #define CREATE_TRACE_POINTS | 87 | #define CREATE_TRACE_POINTS |
85 | #include <trace/events/task.h> | 88 | #include <trace/events/task.h> |
86 | 89 | ||
@@ -238,6 +241,9 @@ void __put_task_struct(struct task_struct *tsk) | |||
238 | WARN_ON(tsk == current); | 241 | WARN_ON(tsk == current); |
239 | 242 | ||
240 | security_task_free(tsk); | 243 | security_task_free(tsk); |
244 | |||
245 | exit_litmus(tsk); | ||
246 | |||
241 | exit_creds(tsk); | 247 | exit_creds(tsk); |
242 | delayacct_tsk_free(tsk); | 248 | delayacct_tsk_free(tsk); |
243 | put_signal_struct(tsk->signal); | 249 | put_signal_struct(tsk->signal); |
@@ -312,6 +318,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
312 | 318 | ||
313 | tsk->stack = ti; | 319 | tsk->stack = ti; |
314 | 320 | ||
321 | /* Don't let the new task be a real-time task. */ | ||
322 | litmus_fork(tsk); | ||
323 | |||
315 | setup_thread_stack(tsk, orig); | 324 | setup_thread_stack(tsk, orig); |
316 | clear_user_return_notifier(tsk); | 325 | clear_user_return_notifier(tsk); |
317 | clear_tsk_need_resched(tsk); | 326 | clear_tsk_need_resched(tsk); |