public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Hou Pengyang <houpengyang@huawei.com>
Cc: mingo@redhat.com, namhyung@kernel.org, a.p.zijlstra@chello.nl,
	wangnan0@huawei.com, linux-kernel@vger.kernel.org,
	zhu.wen-jie@hp.com
Subject: Re: [RFC] perf tools: Add hugetlbfs memory recognition
Date: Mon, 29 Jun 2015 10:42:34 -0300	[thread overview]
Message-ID: <20150629134234.GD11747@kernel.org> (raw)
In-Reply-To: <20150629132329.GC11747@kernel.org>

Em Mon, Jun 29, 2015 at 10:23:29AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Jun 27, 2015 at 05:08:20PM +0800, Hou Pengyang escreveu:
> > There is something about MAP_HUGETLB.
>  
> > In this patch, we check if a mmap area is hugetlbfs area by MAP_HUGETLB,
> > a bit in MMAP2 event.
>  
> > However, if mmap area is hugetlb related, MAP_HUGETLB does not always
> > appear. Because, there are two ways generating MMAP2 event.
>  
> > 1) when a new vm_area_struct is created, its info would be exported
> >    as a MMAP2 event.
> > 2) perf reads /proc/pid/maps for generating MMAP2 event.
>  
> > MAP_HUGETLB appears if MMAP2 event is generated on situation 1),
> > while not on situation 2).
>  
> > This is because on situation 2), perf reads /proc/pid/maps, which
> > contains only PROT_READ/WRITE/EXEC, MAP_SHARED/MAP_PRIVATE, while more
> > details appear in /proc/pid/smaps, such as MAP_HUGETLB.
> 
> Humm:
> 
> [root@zoo ~]# wc -l /proc/`pidof firefox`/maps
> 934 /proc/4551/maps
> [root@zoo ~]# wc -l /proc/`pidof firefox`/smaps
> 14944 /proc/4551/smaps
> [root@zoo ~]#
>  
> > So I wonder if there is a need to read /proc/pid/smaps instead of
> > /proc/pid/maps to generate MMAP2 event. Or we should solve the problem by
> > another way?
> 
> Doing some research now...

Bummer, seems that only smaps -> ... -> show_smap_vma_flags() will
expose that to userspace...

Perhaps we can look at some global stat for HugeTLB fs to figure out if
we really, really need to parse smaps instead of just maps? I.e. in my
system, a desktop one, F21, I have:

[root@zoo ~]# find /proc -name smaps | xargs grep -w ht
grep: /proc/31971/task/31971/smaps: No such file or directory
grep: /proc/31971/smaps: No such file or directory
[root@zoo ~]#

No "ht" HugeTLB areas, so no need to parse 16 times more bytes than by
just using /proc/PID/maps.

- Arnaldo

  reply	other threads:[~2015-06-29 13:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-27  8:49 [RFC] perf tools: Add hugetlbfs memory recognition Hou Pengyang
2015-06-27  9:08 ` Hou Pengyang
2015-06-29 13:23   ` Arnaldo Carvalho de Melo
2015-06-29 13:42     ` Arnaldo Carvalho de Melo [this message]
2015-06-30  9:33       ` Hou Pengyang
2015-06-30 14:50         ` Arnaldo Carvalho de Melo
2015-07-03 10:21           ` Hou Pengyang
2015-07-03 15:16             ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150629134234.GD11747@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=houpengyang@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    --cc=zhu.wen-jie@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox