lkml.org 
[lkml]   [2015]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC][PATCH] procfs: Add /proc/<pid>/mapped_files
Date
On Wed, Jan 14 2015, Calvin Owens <calvinowens@fb.com> wrote:

> Commit b76437579d1344b6 ("procfs: mark thread stack correctly in
> proc/<pid>/maps") introduced logic to mark thread stacks with the
> "[stack:%d]" marker in /proc/<pid>/maps.
>
> This causes reading /proc/<pid>/maps to take O(N^2) time, where N is
> the number of threads sharing an address space, since each line of
> output requires iterating over the VMA list looking for ranges that
> correspond to the stack pointer in any task's register set. When
> dealing with highly-threaded Java applications, reading this file can
> take hours and trigger softlockup dumps.
>
> Eliminating the "[stack:%d]" marker is not a viable option since it's
> been there for some time, and I don't see a way to do the stack check
> more efficiently that wouldn't end up making the whole thing really
> ugly.

Just thinking out loud: Could one simply mark a VMA as being used for
stack during the clone call (is there room in vm_flags, or does
VM_GROWSDOWN already tell the whole story?), and then write the TID into
a new field in the VMA - I think one could make a union with vm_pgoff so
as not to enlarge the structure.

This would allow eliminating the loop over tasks in vm_is_stack.

Rasmus


\
 
 \ /
  Last update: 2015-01-14 15:41    [W:0.337 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site