diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-08-23 17:55:08 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-08-23 17:55:08 -0400 |
commit | 8b6d4e51e23c3c4137c2ab5c0352dc8233dfa3f9 (patch) | |
tree | 28949609d34d45f91f0dc9923879c0105bcb705d /include/linux/rt_domain.h | |
parent | c6b0b69c55658bb0c88433444dc288f91b0cb357 (diff) |
Introduce rt_domain_t.
Diffstat (limited to 'include/linux/rt_domain.h')
-rw-r--r-- | include/linux/rt_domain.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/include/linux/rt_domain.h b/include/linux/rt_domain.h new file mode 100644 index 0000000000..7157a04ac2 --- /dev/null +++ b/include/linux/rt_domain.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* CLEANUP: Add comments and make it less messy. | ||
2 | * | ||
3 | */ | ||
4 | |||
5 | #ifndef __UNC_RT_DOMAIN_H__ | ||
6 | #define __UNC_RT_DOMAIN_H__ | ||
7 | |||
8 | struct _rt_domain; | ||
9 | |||
10 | typedef int (*check_resched_needed_t)(struct _rt_domain *rt); | ||
11 | typedef void (*release_at_t)(struct task_struct *t, jiffie_t start); | ||
12 | |||
13 | typedef struct _rt_domain { | ||
14 | /* runnable rt tasks are in here */ | ||
15 | rwlock_t ready_lock; | ||
16 | struct list_head ready_queue; | ||
17 | |||
18 | /* real-time tasks waiting for release are in here */ | ||
19 | spinlock_t release_lock; | ||
20 | struct list_head release_queue; | ||
21 | |||
22 | /* how do we check if we need to kick another CPU? */ | ||
23 | check_resched_needed_t check_resched; | ||
24 | |||
25 | /* how are tasks ordered in the ready queue? */ | ||
26 | list_cmp_t order; | ||
27 | } rt_domain_t; | ||
28 | |||
29 | #define next_ready(rt) \ | ||
30 | (list_entry((rt)->ready_queue.next, struct task_struct, rt_list)) | ||
31 | |||
32 | #define ready_jobs_pending(rt) \ | ||
33 | (!list_empty(&(rt)->ready_queue)) | ||
34 | |||
35 | void rt_domain_init(rt_domain_t *rt, check_resched_needed_t f, | ||
36 | list_cmp_t order); | ||
37 | |||
38 | void __add_ready(rt_domain_t* rt, struct task_struct *new); | ||
39 | void __add_release(rt_domain_t* rt, struct task_struct *task); | ||
40 | |||
41 | struct task_struct* __take_ready(rt_domain_t* rt); | ||
42 | struct task_struct* __peek_ready(rt_domain_t* rt); | ||
43 | |||
44 | void try_release_pending(rt_domain_t* rt); | ||
45 | void __release_pending(rt_domain_t* rt); | ||
46 | |||
47 | void rerelease_all(rt_domain_t *rt, release_at_t release); | ||
48 | void __rerelease_all(rt_domain_t *rt, release_at_t release); | ||
49 | |||
50 | static inline void add_ready(rt_domain_t* rt, struct task_struct *new) | ||
51 | { | ||
52 | unsigned long flags; | ||
53 | /* first we need the write lock for rt_ready_queue */ | ||
54 | write_lock_irqsave(&rt->ready_lock, flags); | ||
55 | __add_ready(rt, new); | ||
56 | write_unlock_irqrestore(&rt->ready_lock, flags); | ||
57 | } | ||
58 | |||
59 | static inline void add_release(rt_domain_t* rt, struct task_struct *task) | ||
60 | { | ||
61 | unsigned long flags; | ||
62 | /* first we need the write lock for rt_ready_queue */ | ||
63 | spin_lock_irqsave(&rt->release_lock, flags); | ||
64 | __add_release(rt, task); | ||
65 | spin_unlock_irqrestore(&rt->release_lock, flags); | ||
66 | } | ||
67 | |||
68 | |||
69 | #endif | ||