Commit 449d0d7c authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Ingo Molnar

uprobes: Simplify the usage of uprobe->pending_list

uprobe->pending_list is only used to create the temporary list,
it has no meaning after we drop uprobes_mmap_hash(inode).

No need to initialize this node or remove it from tmp_list, and
we can use list_for_each_entry().
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20120615154353.GA9614@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent d9c4a30e
...@@ -513,7 +513,6 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset) ...@@ -513,7 +513,6 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
uprobe->inode = igrab(inode); uprobe->inode = igrab(inode);
uprobe->offset = offset; uprobe->offset = offset;
init_rwsem(&uprobe->consumer_rwsem); init_rwsem(&uprobe->consumer_rwsem);
INIT_LIST_HEAD(&uprobe->pending_list);
/* add to uprobes_tree, sorted on inode:offset */ /* add to uprobes_tree, sorted on inode:offset */
cur_uprobe = insert_uprobe(uprobe); cur_uprobe = insert_uprobe(uprobe);
...@@ -1037,7 +1036,7 @@ static void build_probe_list(struct inode *inode, struct list_head *head) ...@@ -1037,7 +1036,7 @@ static void build_probe_list(struct inode *inode, struct list_head *head)
int uprobe_mmap(struct vm_area_struct *vma) int uprobe_mmap(struct vm_area_struct *vma)
{ {
struct list_head tmp_list; struct list_head tmp_list;
struct uprobe *uprobe, *u; struct uprobe *uprobe;
struct inode *inode; struct inode *inode;
int ret, count; int ret, count;
...@@ -1055,10 +1054,9 @@ int uprobe_mmap(struct vm_area_struct *vma) ...@@ -1055,10 +1054,9 @@ int uprobe_mmap(struct vm_area_struct *vma)
ret = 0; ret = 0;
count = 0; count = 0;
list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { list_for_each_entry(uprobe, &tmp_list, pending_list) {
loff_t vaddr; loff_t vaddr;
list_del(&uprobe->pending_list);
if (!ret) { if (!ret) {
vaddr = vma_address(vma, uprobe->offset); vaddr = vma_address(vma, uprobe->offset);
...@@ -1106,7 +1104,7 @@ int uprobe_mmap(struct vm_area_struct *vma) ...@@ -1106,7 +1104,7 @@ int uprobe_mmap(struct vm_area_struct *vma)
void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end) void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{ {
struct list_head tmp_list; struct list_head tmp_list;
struct uprobe *uprobe, *u; struct uprobe *uprobe;
struct inode *inode; struct inode *inode;
if (!atomic_read(&uprobe_events) || !valid_vma(vma, false)) if (!atomic_read(&uprobe_events) || !valid_vma(vma, false))
...@@ -1123,12 +1121,10 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon ...@@ -1123,12 +1121,10 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
mutex_lock(uprobes_mmap_hash(inode)); mutex_lock(uprobes_mmap_hash(inode));
build_probe_list(inode, &tmp_list); build_probe_list(inode, &tmp_list);
list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { list_for_each_entry(uprobe, &tmp_list, pending_list) {
loff_t vaddr; loff_t vaddr;
list_del(&uprobe->pending_list);
vaddr = vma_address(vma, uprobe->offset); vaddr = vma_address(vma, uprobe->offset);
if (vaddr >= start && vaddr < end) { if (vaddr >= start && vaddr < end) {
/* /*
* An unregister could have removed the probe before * An unregister could have removed the probe before
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment