aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 07:18:50 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 06:21:19 -0400
commite82bc71470695e6a8a319962737b4abff85bf0c6 (patch)
tree01694ae07bcc9ab740693a0bd019bbeaa051927c
parentfec18fc634e6ff5d6bef6cf0b5844fd82483576d (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.c3
-rw-r--r--kernel/exit.c4
-rw-r--r--kernel/fork.c9
3 files changed, 16 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 1977c2a553ac..c359db61c8a3 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -57,6 +57,8 @@
57#include <linux/oom.h> 57#include <linux/oom.h>
58#include <linux/compat.h> 58#include <linux/compat.h>
59 59
60#include <litmus/litmus.h>
61
60#include <asm/uaccess.h> 62#include <asm/uaccess.h>
61#include <asm/mmu_context.h> 63#include <asm/mmu_context.h>
62#include <asm/tlb.h> 64#include <asm/tlb.h>
@@ -1527,6 +1529,7 @@ static int do_execveat_common(int fd, struct filename *filename,
1527 goto out_unmark; 1529 goto out_unmark;
1528 1530
1529 sched_exec(); 1531 sched_exec();
1532 litmus_exec();
1530 1533
1531 bprm->file = file; 1534 bprm->file = file;
1532 if (fd == AT_FDCWD || filename->name[0] == '/') { 1535 if (fd == AT_FDCWD || filename->name[0] == '/') {
diff --git a/kernel/exit.c b/kernel/exit.c
index 22fcc05dec40..a27a04c4fa35 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -61,6 +61,8 @@
61 61
62static void exit_mm(struct task_struct *tsk); 62static void exit_mm(struct task_struct *tsk);
63 63
64extern void exit_od_table(struct task_struct *t);
65
64static void __unhash_process(struct task_struct *p, bool group_dead) 66static void __unhash_process(struct task_struct *p, bool group_dead)
65{ 67{
66 nr_threads--; 68 nr_threads--;
@@ -727,6 +729,8 @@ void do_exit(long code)
727 tty_audit_exit(); 729 tty_audit_exit();
728 audit_free(tsk); 730 audit_free(tsk);
729 731
732 exit_od_table(tsk);
733
730 tsk->exit_code = code; 734 tsk->exit_code = code;
731 taskstats_exit(tsk, group_dead); 735 taskstats_exit(tsk, group_dead);
732 736
diff --git a/kernel/fork.c b/kernel/fork.c
index 03c1eaaa6ef5..16b6ca38856e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -85,6 +85,9 @@
85 85
86#include <trace/events/sched.h> 86#include <trace/events/sched.h>
87 87
88#include <litmus/litmus.h>
89#include <litmus/sched_plugin.h>
90
88#define CREATE_TRACE_POINTS 91#define CREATE_TRACE_POINTS
89#include <trace/events/task.h> 92#include <trace/events/task.h>
90 93
@@ -253,6 +256,9 @@ void __put_task_struct(struct task_struct *tsk)
253 256
254 task_numa_free(tsk); 257 task_numa_free(tsk);
255 security_task_free(tsk); 258 security_task_free(tsk);
259
260 exit_litmus(tsk);
261
256 exit_creds(tsk); 262 exit_creds(tsk);
257 delayacct_tsk_free(tsk); 263 delayacct_tsk_free(tsk);
258 put_signal_struct(tsk->signal); 264 put_signal_struct(tsk->signal);
@@ -355,6 +361,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
355 tsk->seccomp.filter = NULL; 361 tsk->seccomp.filter = NULL;
356#endif 362#endif
357 363
364 /* Don't let the new task be a real-time task. */
365 litmus_fork(tsk);
366
358 setup_thread_stack(tsk, orig); 367 setup_thread_stack(tsk, orig);
359 clear_user_return_notifier(tsk); 368 clear_user_return_notifier(tsk);
360 clear_tsk_need_resched(tsk); 369 clear_tsk_need_resched(tsk);