Added _heavy_ lamport locks. A heavy lamport lock has its own dedicated lamport...
[projects/modsched/linux.git] / include / linux / process_server.h
1 /*********************
2  * process server header
3  * dkatz
4  *********************/
5
6 #include <linux/sched.h>
7 #include <asm/ptrace.h>
8
9 #ifndef _PROCESS_SERVER_H
10 #define _PROCESS_SERVER_H
11
12
13 /**
14  * Constants
15  */
16 #define RETURN_DISPOSITION_NONE 0
17 #define RETURN_DISPOSITION_EXIT 1
18 #define RETURN_DISPOSITION_MIGRATE 2
19 #define PROCESS_SERVER_CLONE_SUCCESS 0
20 #define PROCESS_SERVER_CLONE_FAIL 1
21
22 //configuration
23 //#define SUPPORT_FOR_CLUSTERING
24 #undef SUPPORT_FOR_CLUSTERING
25
26 //#define PROCESS_SERVER_USE_KMOD
27 #undef PROCESS_SERVER_USE_KMOD
28
29 #define PROCESS_SERVER_ENFORCE_VMA_MOD_ATOMICITY
30 //#undef PROCESS_SERVER_ENFORCE_VMA_MOD_ATOMICITY
31
32 //#define PROCESS_SERVER_USE_DISTRIBUTED_MM_LOCK
33 //#undef PROCESS_SERVER_USE_DISTRIBUTED_MM_LOCK
34
35 #define PROCESS_SERVER_USE_HEAVY_LOCK
36 //#undef PROCESS_SERVER_USE_HEAVY_LOCK
37
38 #if defined(PROCESS_SERVER_USE_DISTRIBUTED_MM_LOCK) && defined(PROCESS_SERVER_USE_HEAVY_LOCK)
39 #error cannot have both PROCESS_SERVER_USE_DISTRIBUTED_MM_LOCK and PROCESS_SERVER_USE_HEAVY_LOCK
40 #endif
41
42 /*
43  * Migration hook.
44  */
45 int process_server_do_migration(struct task_struct* task, int cpu);
46 void process_server_do_return_disposition(void);
47
48 /*
49  * Utilities for other modules to hook
50  * into the process server.
51  */
52 #ifdef PROCESS_SERVER_USE_KMOD
53 int process_server_import_address_space(unsigned long* ip, unsigned long *sp, struct pt_regs* regs);
54 #else
55 // long sys_process_server_import_task(void* info, struct pt_regs* regs) 
56 #endif
57 int process_server_notify_delegated_subprocess_starting(pid_t pid, pid_t remote_pid, int remote_cpu);
58 int process_server_do_exit(void);
59 int process_server_do_group_exit(void);
60 int process_server_notify_mmap(struct file *file, unsigned long addr,
61                                 unsigned long len, unsigned long prot,
62                                 unsigned long flags, unsigned long pgoff);
63 int process_server_notify_munmap(struct mm_struct *mm, unsigned long start, size_t len);
64 int process_server_pull_remote_mappings(struct mm_struct *mm, struct vm_area_struct *vma,
65                                 unsigned long address, unsigned int flags,
66                                 struct vm_area_struct **vma_out,
67                                 unsigned long error_code);
68 int process_server_do_munmap(struct mm_struct* mm, 
69                                 unsigned long start, 
70                                 unsigned long len);
71 void process_server_do_mprotect(struct task_struct* task,
72                                 unsigned long addr,
73                                 size_t len,
74                                 unsigned long prot);
75 int process_server_dup_task(struct task_struct* orig, struct task_struct* task);
76 unsigned long process_server_do_mmap_pgoff(struct file *file, unsigned long addr,
77                                            unsigned long len, unsigned long prot,
78                                            unsigned long flags, unsigned long pgoff);
79 int process_server_acquire_page_lock(unsigned long address);
80 int process_server_acquire_page_lock_range(unsigned long address, size_t sz);
81 int process_server_acquire_heavy_lock(void);
82 int process_server_acquire_distributed_mm_lock(void);
83 void process_server_release_page_lock(unsigned long address);
84 void process_server_release_page_lock_range(unsigned long address, size_t sz);
85 void process_server_release_heavy_lock(void);
86 void process_server_release_distributed_mm_lock(void);
87
88 #endif // _PROCESS_SERVER_H