Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128218
b: refs/heads/master
c: bd7dc46
h: refs/heads/master
v: v3
  • Loading branch information
Robert Richter committed Jan 7, 2009
1 parent ffec7bf commit b67e5d5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d9928c25a6960cf128c2078a89fe6f8e0180ff60
refs/heads/master: bd7dc46f770d317ada1348294ff1f319243b803b
6 changes: 4 additions & 2 deletions trunk/drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ void sync_buffer(int cpu)
{
struct mm_struct *mm = NULL;
struct mm_struct *oldmm;
unsigned long val;
struct task_struct *new;
unsigned long cookie = 0;
int in_kernel = 1;
Expand Down Expand Up @@ -559,10 +560,11 @@ void sync_buffer(int cpu)
state = sb_sample_start;
add_kernel_ctx_switch(flags & IS_KERNEL);
}
if (flags & USER_CTX_SWITCH) {
if (flags & USER_CTX_SWITCH
&& op_cpu_buffer_get_data(&entry, &val)) {
/* userspace context switch */
new = (struct task_struct *)val;
oldmm = mm;
new = (struct task_struct *)sample->data[0];
release_mm(oldmm);
mm = take_tasks_mm(new);
if (mm != oldmm)
Expand Down
20 changes: 20 additions & 0 deletions trunk/drivers/oprofile/cpu_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ int op_cpu_buffer_add_data(struct op_entry *entry, unsigned long val)
return entry->size;
}

/* returns the size of data in the entry */
static inline
int op_cpu_buffer_get_size(struct op_entry *entry)
{
return entry->size;
}

/* returns 0 if empty or the size of data including the current value */
static inline
int op_cpu_buffer_get_data(struct op_entry *entry, unsigned long *val)
{
int size = entry->size;
if (!size)
return 0;
*val = *entry->data;
entry->size--;
entry->data++;
return size;
}

/* extra data flags */
#define KERNEL_CTX_SWITCH (1UL << 0)
#define IS_KERNEL (1UL << 1)
Expand Down

0 comments on commit b67e5d5

Please sign in to comment.