diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2016-02-02 19:57:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-03 11:28:43 -0500 |
commit | 65376df582174ffcec9e6471bf5b0dd79ba05e4a (patch) | |
tree | 60c4841a00605605bf8c315783ed48648333e865 /mm/util.c | |
parent | 5c2ff95e41c9290d16556cd02e35b25d81be8fe0 (diff) |
proc: revert /proc/<pid>/maps [stack:TID] annotation
Commit b76437579d13 ("procfs: mark thread stack correctly in
proc/<pid>/maps") added [stack:TID] annotation to /proc/<pid>/maps.
Finding the task of a stack VMA requires walking the entire thread list,
turning this into quadratic behavior: a thousand threads means a
thousand stacks, so the rendering of /proc/<pid>/maps needs to look at a
million combinations.
The cost is not in proportion to the usefulness as described in the
patch.
Drop the [stack:TID] annotation to make /proc/<pid>/maps (and
/proc/<pid>/numa_maps) usable again for higher thread counts.
The [stack] annotation inside /proc/<pid>/task/<tid>/maps is retained, as
identifying the stack VMA there is an O(1) operation.
Siddesh said:
"The end users needed a way to identify thread stacks programmatically and
there wasn't a way to do that. I'm afraid I no longer remember (or have
access to the resources that would aid my memory since I changed
employers) the details of their requirement. However, I did do this on my
own time because I thought it was an interesting project for me and nobody
really gave any feedback then as to its utility, so as far as I am
concerned you could roll back the main thread maps information since the
information is available in the thread-specific files"
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
Cc: Shaohua Li <shli@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -230,36 +230,11 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, | |||
230 | } | 230 | } |
231 | 231 | ||
232 | /* Check if the vma is being used as a stack by this task */ | 232 | /* Check if the vma is being used as a stack by this task */ |
233 | static int vm_is_stack_for_task(struct task_struct *t, | 233 | int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t) |
234 | struct vm_area_struct *vma) | ||
235 | { | 234 | { |
236 | return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t)); | 235 | return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t)); |
237 | } | 236 | } |
238 | 237 | ||
239 | /* | ||
240 | * Check if the vma is being used as a stack. | ||
241 | * If is_group is non-zero, check in the entire thread group or else | ||
242 | * just check in the current task. Returns the task_struct of the task | ||
243 | * that the vma is stack for. Must be called under rcu_read_lock(). | ||
244 | */ | ||
245 | struct task_struct *task_of_stack(struct task_struct *task, | ||
246 | struct vm_area_struct *vma, bool in_group) | ||
247 | { | ||
248 | if (vm_is_stack_for_task(task, vma)) | ||
249 | return task; | ||
250 | |||
251 | if (in_group) { | ||
252 | struct task_struct *t; | ||
253 | |||
254 | for_each_thread(task, t) { | ||
255 | if (vm_is_stack_for_task(t, vma)) | ||
256 | return t; | ||
257 | } | ||
258 | } | ||
259 | |||
260 | return NULL; | ||
261 | } | ||
262 | |||
263 | #if defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT) | 238 | #if defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT) |
264 | void arch_pick_mmap_layout(struct mm_struct *mm) | 239 | void arch_pick_mmap_layout(struct mm_struct *mm) |
265 | { | 240 | { |