procfs: provide stack information for threads
[linux-2.6.git] / fs / proc / task_mmu.c
index 366b101..2a1bef9 100644 (file)
@@ -243,6 +243,25 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
                                } else if (vma->vm_start <= mm->start_stack &&
                                           vma->vm_end >= mm->start_stack) {
                                        name = "[stack]";
+                               } else {
+                                       unsigned long stack_start;
+                                       struct proc_maps_private *pmp;
+
+                                       pmp = m->private;
+                                       stack_start = pmp->task->stack_start;
+
+                                       if (vma->vm_start <= stack_start &&
+                                           vma->vm_end >= stack_start) {
+                                               pad_len_spaces(m, len);
+                                               seq_printf(m,
+                                                "[threadstack:%08lx]",
+#ifdef CONFIG_STACK_GROWSUP
+                                                vma->vm_end - stack_start
+#else
+                                                stack_start - vma->vm_start
+#endif
+                                               );
+                                       }
                                }
                        } else {
                                name = "[vdso]";