Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754996AbbGCPRm (ORCPT ); Fri, 3 Jul 2015 11:17:42 -0400 Received: from mail.kernel.org ([198.145.29.136]:33398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754987AbbGCPQm (ORCPT ); Fri, 3 Jul 2015 11:16:42 -0400 Date: Fri, 3 Jul 2015 12:16:36 -0300 From: Arnaldo Carvalho de Melo To: Hou Pengyang 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 Message-ID: <20150703151636.GA3976@kernel.org> References: <1435394953-146405-1-git-send-email-houpengyang@huawei.com> <558E6804.5060602@huawei.com> <20150629132329.GC11747@kernel.org> <20150629134234.GD11747@kernel.org> <55926251.9000404@huawei.com> <20150630145049.GE5888@kernel.org> <5596623C.6060404@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5596623C.6060404@huawei.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1343 Lines: 32 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? > >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? > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/