Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752673AbbHJAtO (ORCPT ); Sun, 9 Aug 2015 20:49:14 -0400 Received: from TYO201.gate.nec.co.jp ([210.143.35.51]:62917 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887AbbHJAsh (ORCPT ); Sun, 9 Aug 2015 20:48:37 -0400 From: Naoya Horiguchi To: Andrew Morton , David Rientjes , =?utf-8?B?SsO2cm4gRW5nZWw=?= CC: Mike Kravetz , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Naoya Horiguchi , Naoya Horiguchi Subject: Re: [PATCH v2 2/2] mm: hugetlb: add VmHugetlbRSS: field in /proc/pid/status Thread-Topic: [PATCH v2 2/2] mm: hugetlb: add VmHugetlbRSS: field in /proc/pid/status Thread-Index: AQHQ0OIlNooU2LmARkWmBcUyPsoxEp4Aj7WAgANDyYA= Date: Mon, 10 Aug 2015 00:47:08 +0000 Message-ID: <1439167624-17772-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <20150807155537.d483456f753355059f9ce10a@linux-foundation.org> In-Reply-To: <20150807155537.d483456f753355059f9ce10a@linux-foundation.org> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.128.101.31] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t7A0nJZZ031943 Content-Length: 2174 Lines: 64 On Fri, Aug 07, 2015 at 03:55:37PM -0700, Andrew Morton wrote: > On Fri, 7 Aug 2015 07:24:50 +0000 Naoya Horiguchi wrote: > > > Currently there's no easy way to get per-process usage of hugetlb pages, which > > is inconvenient because applications which use hugetlb typically want to control > > their processes on the basis of how much memory (including hugetlb) they use. > > So this patch simply provides easy access to the info via /proc/pid/status. > > > > This patch shouldn't change the OOM behavior (so hugetlb usage is ignored as > > is now,) which I guess is fine until we have some strong reason to do it. > > > > A procfs change triggers a documentation change. Always, please. > Documentation/filesystems/proc.txt is the place. OK, I'll do this. > > > > ... > > > > @@ -504,6 +519,9 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, > > { > > return &mm->page_table_lock; > > } > > + > > +#define get_hugetlb_rss(mm) 0 > > +#define mod_hugetlb_rss(mm, value) do {} while (0) > > I don't think these have to be macros? inline functions are nicer in > several ways: more readable, more likely to be documented, can prevent > unused variable warnings. Right, I'll use inline functions. > > #endif /* CONFIG_HUGETLB_PAGE */ > > > > static inline spinlock_t *huge_pte_lock(struct hstate *h, > > > > ... > > > > --- v4.2-rc4.orig/mm/memory.c > > +++ v4.2-rc4/mm/memory.c > > @@ -620,12 +620,12 @@ int __pte_alloc_kernel(pmd_t *pmd, unsigned long address) > > return 0; > > } > > > > -static inline void init_rss_vec(int *rss) > > +inline void init_rss_vec(int *rss) > > { > > memset(rss, 0, sizeof(int) * NR_MM_COUNTERS); > > } > > > > -static inline void add_mm_rss_vec(struct mm_struct *mm, int *rss) > > +inline void add_mm_rss_vec(struct mm_struct *mm, int *rss) > > { > > int i; > > The inlines are a bit odd, but this does save ~10 bytes in memory.o for > some reason. so I'll keep going with this. Thanks, Naoya Horiguchi????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?