diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-12 01:59:42 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-12 01:59:42 -0400 |
commit | 12826089e20a61cc5afe2bf1108f561952ec7f9a (patch) | |
tree | f014e6a01733a188bb6a9831717d1e8f8423d92e /include | |
parent | bc4e46db66fc4470806f570d02982eedae140c4c (diff) |
Added preemptive locking.
Currently is always preempting. This needs to be configurable via proc.
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus/dgl.h | 17 | ||||
-rw-r--r-- | include/litmus/preempt.h | 3 | ||||
-rw-r--r-- | include/litmus/sched_trace.h | 13 | ||||
-rw-r--r-- | include/trace/events/litmus.h | 34 |
4 files changed, 62 insertions, 5 deletions
diff --git a/include/litmus/dgl.h b/include/litmus/dgl.h index 1721fd978c06..458b9b789a4e 100644 --- a/include/litmus/dgl.h +++ b/include/litmus/dgl.h | |||
@@ -4,7 +4,13 @@ | |||
4 | #include <litmus/color.h> | 4 | #include <litmus/color.h> |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | 6 | ||
7 | typedef void (*acquired_t)(int cpu); | 7 | struct dgl; |
8 | struct dgl_group_req; | ||
9 | |||
10 | typedef void (*acquired_t)(struct dgl_group_req *greq); | ||
11 | typedef void (*preempted_t)(struct dgl_group_req *greq); | ||
12 | typedef unsigned long long (*prio_t)(struct dgl *dgl, | ||
13 | struct dgl_group_req *greq); | ||
8 | 14 | ||
9 | /* | 15 | /* |
10 | * A request for @replica amount of a single resource. | 16 | * A request for @replica amount of a single resource. |
@@ -13,6 +19,8 @@ struct dgl_req { | |||
13 | unsigned short replicas; | 19 | unsigned short replicas; |
14 | struct list_head list; | 20 | struct list_head list; |
15 | struct dgl_group_req *greq; | 21 | struct dgl_group_req *greq; |
22 | |||
23 | int satisfied:1; | ||
16 | }; | 24 | }; |
17 | 25 | ||
18 | /* | 26 | /* |
@@ -25,7 +33,7 @@ struct dgl_group_req { | |||
25 | 33 | ||
26 | struct dgl_req *requests; | 34 | struct dgl_req *requests; |
27 | 35 | ||
28 | unsigned long long ts; | 36 | unsigned long long priority; |
29 | struct task_struct *task; | 37 | struct task_struct *task; |
30 | }; | 38 | }; |
31 | 39 | ||
@@ -35,6 +43,7 @@ struct dgl_group_req { | |||
35 | struct dgl_resource { | 43 | struct dgl_resource { |
36 | unsigned long free_replicas; | 44 | unsigned long free_replicas; |
37 | struct list_head waiting; | 45 | struct list_head waiting; |
46 | struct list_head acquired; | ||
38 | }; | 47 | }; |
39 | 48 | ||
40 | /* | 49 | /* |
@@ -51,7 +60,11 @@ struct dgl { | |||
51 | unsigned long num_resources; | 60 | unsigned long num_resources; |
52 | unsigned long num_replicas; | 61 | unsigned long num_replicas; |
53 | 62 | ||
63 | int sid_start; | ||
64 | |||
54 | acquired_t cpu_acquired; | 65 | acquired_t cpu_acquired; |
66 | prio_t assign_priority; | ||
67 | preempted_t cpu_preempted; | ||
55 | }; | 68 | }; |
56 | 69 | ||
57 | void dgl_init(struct dgl *dgl, unsigned long num_resources, | 70 | void dgl_init(struct dgl *dgl, unsigned long num_resources, |
diff --git a/include/litmus/preempt.h b/include/litmus/preempt.h index 5b69e26fc57d..cbf315aa01e9 100644 --- a/include/litmus/preempt.h +++ b/include/litmus/preempt.h | |||
@@ -13,8 +13,7 @@ extern DEFINE_PER_CPU_SHARED_ALIGNED(atomic_t, resched_state); | |||
13 | 13 | ||
14 | #ifdef CONFIG_PREEMPT_STATE_TRACE | 14 | #ifdef CONFIG_PREEMPT_STATE_TRACE |
15 | const char* sched_state_name(int s); | 15 | const char* sched_state_name(int s); |
16 | //#define TRACE_STATE(fmt, args...) TRACE("SCHED_STATE " fmt, args) | 16 | #define TRACE_STATE(fmt, args...) TRACE("SCHED_STATE " fmt, args) |
17 | #define TRACE_STATE(fmt, args...) /* ignore */ | ||
18 | #else | 17 | #else |
19 | #define TRACE_STATE(fmt, args...) /* ignore */ | 18 | #define TRACE_STATE(fmt, args...) /* ignore */ |
20 | #endif | 19 | #endif |
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index ae925fbda849..59fa5db6f40c 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
@@ -209,7 +209,8 @@ feather_callback void do_sched_trace_task_tardy(unsigned long id, | |||
209 | #define trace_litmus_server_switch_away(sid, job, tid, tjob) | 209 | #define trace_litmus_server_switch_away(sid, job, tid, tjob) |
210 | #define trace_litmus_server_release(sid, job, release, deadline) | 210 | #define trace_litmus_server_release(sid, job, release, deadline) |
211 | #define trace_litmus_server_completion(sid, job) | 211 | #define trace_litmus_server_completion(sid, job) |
212 | 212 | #define trace_litmus_server_block(sid) | |
213 | #define trace_litmus_server_resume(sid) | ||
213 | #endif | 214 | #endif |
214 | 215 | ||
215 | 216 | ||
@@ -348,6 +349,16 @@ feather_callback void do_sched_trace_task_tardy(unsigned long id, | |||
348 | trace_litmus_server_completion(sid, job); \ | 349 | trace_litmus_server_completion(sid, job); \ |
349 | } while (0) | 350 | } while (0) |
350 | 351 | ||
352 | #define sched_trace_server_resume(sid) \ | ||
353 | do { \ | ||
354 | trace_litmus_server_resume(sid); \ | ||
355 | } while (0) | ||
356 | |||
357 | #define sched_trace_server_block(sid) \ | ||
358 | do { \ | ||
359 | trace_litmus_server_block(sid); \ | ||
360 | } while (0) | ||
361 | |||
351 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ | 362 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ |
352 | 363 | ||
353 | #endif /* __KERNEL__ */ | 364 | #endif /* __KERNEL__ */ |
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h index 58ffdcd4c546..f7143aa0d184 100644 --- a/include/trace/events/litmus.h +++ b/include/trace/events/litmus.h | |||
@@ -437,6 +437,40 @@ TRACE_EVENT(litmus_server_completion, | |||
437 | TP_printk("completion(server(%d, %d))\n", __entry->sid, __entry->job) | 437 | TP_printk("completion(server(%d, %d))\n", __entry->sid, __entry->job) |
438 | ); | 438 | ); |
439 | 439 | ||
440 | TRACE_EVENT(litmus_server_resume, | ||
441 | |||
442 | TP_PROTO(int sid), | ||
443 | |||
444 | TP_ARGS(sid), | ||
445 | |||
446 | TP_STRUCT__entry( | ||
447 | __field( int, sid) | ||
448 | ), | ||
449 | |||
450 | TP_fast_assign( | ||
451 | __entry->sid = sid; | ||
452 | ), | ||
453 | |||
454 | TP_printk("resume(server(%d))\n", __entry->sid) | ||
455 | ); | ||
456 | |||
457 | TRACE_EVENT(litmus_server_block, | ||
458 | |||
459 | TP_PROTO(int sid), | ||
460 | |||
461 | TP_ARGS(sid), | ||
462 | |||
463 | TP_STRUCT__entry( | ||
464 | __field( int, sid) | ||
465 | ), | ||
466 | |||
467 | TP_fast_assign( | ||
468 | __entry->sid = sid; | ||
469 | ), | ||
470 | |||
471 | TP_printk("block(server(%d))\n", __entry->sid) | ||
472 | ); | ||
473 | |||
440 | #endif /* _SCHED_TASK_TRACEPOINT_H */ | 474 | #endif /* _SCHED_TASK_TRACEPOINT_H */ |
441 | 475 | ||
442 | /* Must stay outside the protection */ | 476 | /* Must stay outside the protection */ |