aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-10-28 18:27:48 -0400
committerTony Luck <tony.luck@intel.com>2005-10-28 18:27:48 -0400
commit9590204d31f8a5f47e890fbbdbcd37dd78f0581a (patch)
tree670235feba2ca1fffe0bd26ddecdf1c08f87618c /arch/ia64
parent8496f2a4513edbc0c1d40496f1b0868dfed36eb0 (diff)
parent4ac0068f44f192f2de95a7bb36df3e19767a45fb (diff)
Pull optimize-ptrace-threads into release branch
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/kernel/ptrace.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index bbb8bc7c0552..9a9c1bd01dbc 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -589,6 +589,7 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr)
589{ 589{
590 struct task_struct *g, *p; 590 struct task_struct *g, *p;
591 struct mm_struct *mm; 591 struct mm_struct *mm;
592 struct list_head *this, *next;
592 int mm_users; 593 int mm_users;
593 594
594 if (!(mm = get_task_mm(child))) 595 if (!(mm = get_task_mm(child)))
@@ -600,28 +601,21 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr)
600 goto out; /* not multi-threaded */ 601 goto out; /* not multi-threaded */
601 602
602 /* 603 /*
603 * First, traverse the child's thread-list. Good for scalability with 604 * Traverse the current process' children list. Every task that
604 * NPTL-threads. 605 * one attaches to becomes a child. And it is only attached children
606 * of the debugger that are of interest (ptrace_check_attach checks
607 * for this).
605 */ 608 */
606 p = child; 609 list_for_each_safe(this, next, &current->children) {
607 do { 610 p = list_entry(this, struct task_struct, sibling);
608 if (thread_matches(p, addr)) { 611 if (p->mm != mm)
609 child = p;
610 goto out;
611 }
612 if (mm_users-- <= 1)
613 goto out;
614 } while ((p = next_thread(p)) != child);
615
616 do_each_thread(g, p) {
617 if (child->mm != mm)
618 continue; 612 continue;
619
620 if (thread_matches(p, addr)) { 613 if (thread_matches(p, addr)) {
621 child = p; 614 child = p;
622 goto out; 615 goto out;
623 } 616 }
624 } while_each_thread(g, p); 617 }
618
625 out: 619 out:
626 mmput(mm); 620 mmput(mm);
627 return child; 621 return child;