Re: [RFC] perf tools: Add hugetlbfs memory recognition

From: Arnaldo Carvalho de Melo
Date: Fri Jul 03 2015 - 11:17:46 EST


Em Fri, Jul 03, 2015 at 06:21:48PM +0800, Hou Pengyang escreveu:
> On 2015/6/30 22:50, Arnaldo Carvalho de Melo wrote:
> >Well, we _can_ detect this automatically, its just a matter of parsing
> >/proc/PID/smaps, right?

<SNIP>

> >What I was discussing was a way only parse smaps when we know we need
> >to, i.e. when we, for instance, parsing /proc/PID/maps, find a map that
> >we think may be a hugetlb one, maybe some other way to tell us that
> >hugetlb maps are in place, looking at the hugetlbfs stats somehow?

<SNIP>

> from /proc/self/mounts, we can get mount point of hugetlbfs.
> in my system, it is "/mnt/huge". So that, when mmap2 event
> comes from userspace, we can compare prefix of filename with
> hugetlbfs mount point (e.g "/mnt/huge") to check if it is a
> file in hugetlbfs. if it is, set MAP_HUGELTB, otherwise, not set.

> There is no need to parse /proc/PID/smaps now, what's more,
> it is not difficult to parse "/proc/self/mounts".

A-ha! please take a look at using the find_mountpoint() function
in tools/lib/api/fs/, I guess that should be enough for you?

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/