On Mon, Dec 28, 2020 at 8:50 PM Jiri Olsa <jo...@redhat.com> wrote:
>
> On Mon, Dec 21, 2020 at 04:00:28PM +0900, Namhyung Kim wrote:
> > To synthesize information to resolve sample IPs, it needs to scan task
> > and mmap info from the /proc filesystem.  For each process, it
> > opens (and reads) status and maps file respectively.  But as kernel
> > threads don't have memory maps so we can skip the maps file.
> >
> > To find kernel threads, check "VmPeak:" line in /proc/<PID>/status
> > file.  It's about the peak virtual memory usage so only user-level
> > tasks have that.  Also check "Threads:" line (which follows the VmPeak
> > line whether or not it exists) to be sure it's read enough data - just
> > in case of deeply nested pid namespaces or large number of
> > supplementary groups are involved.
>
> how much does this save? for kernel threads the maps file is empty
> and we just open the file and close
>
> also perhaps just stat(".....maps") and check the size would be easier?

The numbers are in the cover letter and it's around 5% on an idle
machine which has mostly kernel threads.  I think most of the win
came from this change.

It's just to avoid those syscalls, so I wanted to use the available
info in the status file.

Thanks,
Namhyung

Reply via email to