diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/oprofile/cpu_buffer.c | 2 | ||||
| -rw-r--r-- | drivers/oprofile/cpu_buffer.h | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index e859d23cfc5..1b6590746be 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
| @@ -258,7 +258,7 @@ op_add_code(struct oprofile_cpu_buffer *cpu_buf, unsigned long backtrace, | |||
| 258 | sample->event = flags; | 258 | sample->event = flags; |
| 259 | 259 | ||
| 260 | if (size) | 260 | if (size) |
| 261 | sample->data[0] = (unsigned long)task; | 261 | op_cpu_buffer_add_data(&entry, (unsigned long)task); |
| 262 | 262 | ||
| 263 | op_cpu_buffer_write_commit(&entry); | 263 | op_cpu_buffer_write_commit(&entry); |
| 264 | 264 | ||
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h index e634dcf2f26..e178dd2799c 100644 --- a/drivers/oprofile/cpu_buffer.h +++ b/drivers/oprofile/cpu_buffer.h | |||
| @@ -78,6 +78,18 @@ int op_cpu_buffer_write_commit(struct op_entry *entry); | |||
| 78 | struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu); | 78 | struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu); |
| 79 | unsigned long op_cpu_buffer_entries(int cpu); | 79 | unsigned long op_cpu_buffer_entries(int cpu); |
| 80 | 80 | ||
| 81 | /* returns the remaining free size of data in the entry */ | ||
| 82 | static inline | ||
| 83 | int op_cpu_buffer_add_data(struct op_entry *entry, unsigned long val) | ||
| 84 | { | ||
| 85 | if (!entry->size) | ||
| 86 | return 0; | ||
| 87 | *entry->data = val; | ||
| 88 | entry->size--; | ||
| 89 | entry->data++; | ||
| 90 | return entry->size; | ||
| 91 | } | ||
| 92 | |||
| 81 | /* extra data flags */ | 93 | /* extra data flags */ |
| 82 | #define KERNEL_CTX_SWITCH (1UL << 0) | 94 | #define KERNEL_CTX_SWITCH (1UL << 0) |
| 83 | #define IS_KERNEL (1UL << 1) | 95 | #define IS_KERNEL (1UL << 1) |
