Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350082
b: refs/heads/master
c: 441f1eb
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov committed Feb 8, 2013
1 parent 423ea45 commit 80fb1fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 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: d4d3ccc6d1eb74bd315d49a3829c5ad6c48d21b0
refs/heads/master: 441f1eb7db8babe2b6b4bc805f023739dbb70e33
19 changes: 7 additions & 12 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
#define MAX_UPROBE_XOL_SLOTS UINSNS_PER_PAGE

static struct rb_root uprobes_tree = RB_ROOT;
/*
* allows us to skip the uprobe_mmap if there are no uprobe events active
* at this time. Probably a fine grained per inode count is better?
*/
#define no_uprobe_events() RB_EMPTY_ROOT(&uprobes_tree)

static DEFINE_SPINLOCK(uprobes_treelock); /* serialize rbtree access */

Expand Down Expand Up @@ -74,13 +79,6 @@ static struct mutex uprobes_mmap_mutex[UPROBES_HASH_SZ];

static struct percpu_rw_semaphore dup_mmap_sem;

/*
* uprobe_events allows us to skip the uprobe_mmap if there are no uprobe
* events active at this time. Probably a fine grained per inode count is
* better?
*/
static atomic_t uprobe_events = ATOMIC_INIT(0);

/* Have a copy of original instruction */
#define UPROBE_COPY_INSN 0
/* Can skip singlestep */
Expand Down Expand Up @@ -460,8 +458,6 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
kfree(uprobe);
uprobe = cur_uprobe;
iput(inode);
} else {
atomic_inc(&uprobe_events);
}

return uprobe;
Expand Down Expand Up @@ -685,7 +681,6 @@ static void delete_uprobe(struct uprobe *uprobe)
spin_unlock(&uprobes_treelock);
iput(uprobe->inode);
put_uprobe(uprobe);
atomic_dec(&uprobe_events);
}

struct map_info {
Expand Down Expand Up @@ -975,7 +970,7 @@ int uprobe_mmap(struct vm_area_struct *vma)
struct uprobe *uprobe, *u;
struct inode *inode;

if (!atomic_read(&uprobe_events) || !valid_vma(vma, true))
if (no_uprobe_events() || !valid_vma(vma, true))
return 0;

inode = vma->vm_file->f_mapping->host;
Expand Down Expand Up @@ -1021,7 +1016,7 @@ vma_has_uprobes(struct vm_area_struct *vma, unsigned long start, unsigned long e
*/
void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{
if (!atomic_read(&uprobe_events) || !valid_vma(vma, false))
if (no_uprobe_events() || !valid_vma(vma, false))
return;

if (!atomic_read(&vma->vm_mm->mm_users)) /* called by mmput() ? */
Expand Down

0 comments on commit 80fb1fc

Please sign in to comment.