Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128202
b: refs/heads/master
c: 9741b30
h: refs/heads/master
v: v3
  • Loading branch information
Robert Richter committed Dec 29, 2008
1 parent 9369f62 commit 99a775f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 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: d45d23bed4bf7b25b7dcc336552a251db1aa1279
refs/heads/master: 9741b309bb4493eedd3cdb5c97b566338a0da2cc
39 changes: 19 additions & 20 deletions trunk/drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,29 @@ static void add_sample_entry(unsigned long offset, unsigned long event)
}


static int add_us_sample(struct mm_struct *mm, struct op_sample *s)
/*
* Add a sample to the global event buffer. If possible the
* sample is converted into a persistent dentry/offset pair
* for later lookup from userspace. Return 0 on failure.
*/
static int
add_sample(struct mm_struct *mm, struct op_sample *s, int in_kernel)
{
unsigned long cookie;
off_t offset;

if (in_kernel) {
add_sample_entry(s->eip, s->event);
return 1;
}

/* add userspace sample */

if (!mm) {
atomic_inc(&oprofile_stats.sample_lost_no_mm);
return 0;
}

cookie = lookup_dcookie(mm, s->eip, &offset);

if (cookie == INVALID_COOKIE) {
Expand All @@ -415,25 +433,6 @@ static int add_us_sample(struct mm_struct *mm, struct op_sample *s)
}


/* Add a sample to the global event buffer. If possible the
* sample is converted into a persistent dentry/offset pair
* for later lookup from userspace.
*/
static int
add_sample(struct mm_struct *mm, struct op_sample *s, int in_kernel)
{
if (in_kernel) {
add_sample_entry(s->eip, s->event);
return 1;
} else if (mm) {
return add_us_sample(mm, s);
} else {
atomic_inc(&oprofile_stats.sample_lost_no_mm);
}
return 0;
}


static void release_mm(struct mm_struct *mm)
{
if (!mm)
Expand Down

0 comments on commit 99a775f

Please sign in to comment.