diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-11-01 19:40:02 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-11-11 17:57:41 -0500 |
commit | c6182ba4a548baf0d1238d0df54e7d38ed299c3e (patch) | |
tree | 3d1f5272e7051ade00ffccb76c69514923ad6cdf | |
parent | 8e10e1803e695a08f1fb59e90dac4ba0d8744f89 (diff) |
sched_trace: make buffer size configurable
Large sched_trace buffers cause boot problems on the ARM box. Allow
the user to specify smaller buffers.
-rw-r--r-- | litmus/Kconfig | 20 | ||||
-rw-r--r-- | litmus/sched_task_trace.c | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/litmus/Kconfig b/litmus/Kconfig index 9888589ef126..f1de6fabfc17 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig | |||
@@ -108,6 +108,26 @@ config SCHED_TASK_TRACE | |||
108 | Say Yes for debugging. | 108 | Say Yes for debugging. |
109 | Say No for overhead tracing. | 109 | Say No for overhead tracing. |
110 | 110 | ||
111 | config SCHED_TASK_TRACE_SHIFT | ||
112 | int "Buffer size for sched_trace_xxx() events" | ||
113 | depends on SCHED_TASK_TRACE | ||
114 | range 8 13 | ||
115 | default 9 | ||
116 | help | ||
117 | |||
118 | Select the buffer size of sched_trace_xxx() events as a power of two. | ||
119 | These buffers are statically allocated as per-CPU data. Each event | ||
120 | requires 24 bytes storage plus one additional flag byte. Too large | ||
121 | buffers can cause issues with the per-cpu allocator (and waste | ||
122 | memory). Too small buffers can cause scheduling events to be lost. The | ||
123 | "right" size is workload dependent and depends on the number of tasks, | ||
124 | each task's period, each task's number of suspensions, and how often | ||
125 | the buffer is flushed. | ||
126 | |||
127 | Examples: 12 => 4k events | ||
128 | 10 => 1k events | ||
129 | 8 => 512 events | ||
130 | |||
111 | config SCHED_OVERHEAD_TRACE | 131 | config SCHED_OVERHEAD_TRACE |
112 | bool "Record timestamps for overhead measurements" | 132 | bool "Record timestamps for overhead measurements" |
113 | depends on FEATHER_TRACE | 133 | depends on FEATHER_TRACE |
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c index 39a543e22d41..5fcabb55eb8f 100644 --- a/litmus/sched_task_trace.c +++ b/litmus/sched_task_trace.c | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | /* set MAJOR to 0 to have it dynamically assigned */ | 19 | /* set MAJOR to 0 to have it dynamically assigned */ |
20 | #define FT_TASK_TRACE_MAJOR 253 | 20 | #define FT_TASK_TRACE_MAJOR 253 |
21 | #define NO_EVENTS 4096 /* this is a buffer of 12 4k pages per CPU */ | 21 | #define NO_EVENTS (1 << CONFIG_SCHED_TASK_TRACE_SHIFT) |
22 | 22 | ||
23 | #define now() litmus_clock() | 23 | #define now() litmus_clock() |
24 | 24 | ||
@@ -41,6 +41,9 @@ static int __init init_sched_task_trace(void) | |||
41 | { | 41 | { |
42 | struct local_buffer* buf; | 42 | struct local_buffer* buf; |
43 | int i, ok = 0; | 43 | int i, ok = 0; |
44 | printk("Allocated %u sched_trace_xxx() events per CPU " | ||
45 | "(buffer size: %u bytes)\n", | ||
46 | NO_EVENTS, sizeof(struct local_buffer)); | ||
44 | ftdev_init(&st_dev, THIS_MODULE); | 47 | ftdev_init(&st_dev, THIS_MODULE); |
45 | for (i = 0; i < NR_CPUS; i++) { | 48 | for (i = 0; i < NR_CPUS; i++) { |
46 | buf = &per_cpu(st_event_buffer, i); | 49 | buf = &per_cpu(st_event_buffer, i); |