diff options
author | Tony Luck <tony.luck@intel.com> | 2005-10-28 15:27:48 -0700 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-10-28 15:27:48 -0700 |
commit | 9590204d31f8a5f47e890fbbdbcd37dd78f0581a (patch) | |
tree | 670235feba2ca1fffe0bd26ddecdf1c08f87618c /arch | |
parent | 8496f2a4513edbc0c1d40496f1b0868dfed36eb0 (diff) | |
parent | 4ac0068f44f192f2de95a7bb36df3e19767a45fb (diff) | |
download | blackbird-op-linux-9590204d31f8a5f47e890fbbdbcd37dd78f0581a.tar.gz blackbird-op-linux-9590204d31f8a5f47e890fbbdbcd37dd78f0581a.zip |
Pull optimize-ptrace-threads into release branch
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/ptrace.c | 26 |
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) { struct task_struct *g, *p; struct mm_struct *mm; + struct list_head *this, *next; int mm_users; if (!(mm = get_task_mm(child))) @@ -600,28 +601,21 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr) goto out; /* not multi-threaded */ /* - * First, traverse the child's thread-list. Good for scalability with - * NPTL-threads. + * Traverse the current process' children list. Every task that + * one attaches to becomes a child. And it is only attached children + * of the debugger that are of interest (ptrace_check_attach checks + * for this). */ - p = child; - do { - if (thread_matches(p, addr)) { - child = p; - goto out; - } - if (mm_users-- <= 1) - goto out; - } while ((p = next_thread(p)) != child); - - do_each_thread(g, p) { - if (child->mm != mm) + list_for_each_safe(this, next, ¤t->children) { + p = list_entry(this, struct task_struct, sibling); + if (p->mm != mm) continue; - if (thread_matches(p, addr)) { child = p; goto out; } - } while_each_thread(g, p); + } + out: mmput(mm); return child; |