This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Wed May 1 06:42:33 2024 >From spaans Thu Aug 20 12:54:17 2015 Received: from pop.ziggo.nl [212.54.42.19] by squeeze.vs19.net with POP3 (fetchmail-6.3.21) for (single-drop); Thu, 20 Aug 2015 12:54:17 +0200 (CEST) Received: from md4.tb.mail.iss.local ([212.54.34.152]) by mc5.tb.mail.iss.local (Dovecot) with LMTP id 76/MGAew1VXpfwAAh0Kp1A for ; Thu, 20 Aug 2015 12:49:43 +0200 Received: from mx24.gn.mail.iss.as9143.net ([212.54.34.152]) by md4.tb.mail.iss.local (Dovecot) with LMTP id S1f1C14W1VVDZQAAkz+7wA ; Thu, 20 Aug 2015 12:50:31 +0200 Received: from vger.kernel.org ([209.132.180.67]) by mx24.gn.mail.iss.as9143.net with esmtp (Exim 4.82) (envelope-from ) id 1ZSNPj-0005H3-47 for bmw12-lkml@ziggo.nl; Thu, 20 Aug 2015 12:49:43 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751699AbbHTKtd (ORCPT ); Thu, 20 Aug 2015 06:49:33 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:33318 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750924AbbHTKtc convert rfc822-to-8bit (ORCPT ); Thu, 20 Aug 2015 06:49: Received: by wijp15 with SMTP id p15so12382430wij.0 for ; Thu, 20 Aug 2015 03:49:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=EVJy3 X-Received: by 10.180.39.172 with SMTP id q12mr12070808wik.17.1440067770732; Thu, 20 Aug 2015 03:49:30 -0700 (PDT) Received: from localhost (bband-dyn181.95-103-48.t-com.sk. [95.103.48.181]) by smtp.gmail.com with ESMTPSA id hn2sm4968282wjc.45.2015.08.20.03.49.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2015 03:49:30 - Date: Thu, 20 Aug 2015 12:49:29 +0200 From: Michal Hocko To: Naoya Horiguchi Cc: Andrew Morton , David Rientjes , =?iso-8859-1?Q?J=F6rn?= Engel , Mike Kravetz , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" References: <20150812000336.GB32192@hori1.linux.bs1.fc.nec.co.jp> <1440059182-19798-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1440059182-19798-2-git-send-email-n-horiguchi@ah.jp.nec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <1440059182-19798-2-git-send-email-n-horiguchi@ah.jp.nec.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-Id: X-Mailing-List: linux-kernel@vger.kernel.org X-Ziggo-spamsetting: Instelling=Gemiddeld Scorelimiet=14 X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.1 cv=aPQN0uJm c=1 sm=0 tr=0 a=UK1r566ZdBxH71SXbqIOeA==:17 a=VwQbUJbxAAAA:8 a=cIF5Tx0qAAAA:8 a=1XWaLZrsAAAA:8 a=pGLkceISAAAA:8 a=yEdEr6MRgwAA:10 a=IkcTkHD0fZMA:10 a=uRRa74qj2VoA:10 a=nrACCIEEAAAA:8 a=4K-K1uyHAAAA:8 a=W0vUJOdyAAAA:8 a=Hb X-Ziggo-Spam-Status: No X-Spam-Status: No X-Spam-Flag: No On Thu 20-08-15 08:26:26, Naoya Horiguchi wrote: > Currently /proc/PID/smaps provides no usage info for vma(VM_HUGETLB), which > is inconvenient when we want to know per-task or per-vma base hugetlb usage. > To solve this, this patch adds a new line for hugetlb usage like below: > > Size: 20480 kB > Rss: 0 kB > Pss: 0 kB > Shared_Clean: 0 kB > Shared_Dirty: 0 kB > Private_Clean: 0 kB > Private_Dirty: 0 kB > Referenced: 0 kB > Anonymous: 0 kB > AnonHugePages: 0 kB > HugetlbPages: 18432 kB > Swap: 0 kB > KernelPageSize: 2048 kB > MMUPageSize: 2048 kB > Locked: 0 kB > VmFlags: rd wr mr mw me de ht I have only now got to this thread. This is indeed very helpful. I would just suggest to update Documentation/filesystems/proc.txt to be explicit that Rss: doesn't count hugetlb pages for historical reasons. > Signed-off-by: Naoya Horiguchi > Acked-by: Joern Engel > Acked-by: David Rientjes Acked-by: Michal Hocko > --- > v3 -> v4: > - suspend Acked-by tag because v3->v4 change is not trivial > - I stated in previous discussion that HugetlbPages line can contain page > size info, but that's not necessary because we already have KernelPageSize > info. > - merged documentation update, where the current documentation doesn't mention > AnonHugePages, so it's also added. > --- > Documentation/filesystems/proc.txt | 7 +++++-- > fs/proc/task_mmu.c | 29 +++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+), 2 deletions(-) > > diff --git v4.2-rc4/Documentation/filesystems/proc.txt v4.2-rc4_patched/Documentation/filesystems/proc.txt > index 6f7fafde0884..22e40211ef64 100644 > --- v4.2-rc4/Documentation/filesystems/proc.txt > +++ v4.2-rc4_patched/Documentation/filesystems/proc.txt > @@ -423,6 +423,8 @@ Private_Clean: 0 kB > Private_Dirty: 0 kB > Referenced: 892 kB > Anonymous: 0 kB > +AnonHugePages: 0 kB > +HugetlbPages: 0 kB > Swap: 0 kB > KernelPageSize: 4 kB > MMUPageSize: 4 kB > @@ -440,8 +442,9 @@ indicates the amount of memory currently marked as referenced or accessed. > "Anonymous" shows the amount of memory that does not belong to any file. Even > a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE > and a page is modified, the file page is replaced by a private anonymous copy. > -"Swap" shows how much would-be-anonymous memory is also used, but out on > -swap. > +"AnonHugePages" shows the ammount of memory backed by transparent hugepage. > +"HugetlbPages" shows the ammount of memory backed by hugetlbfs page. > +"Swap" shows how much would-be-anonymous memory is also used, but out on swap. > > "VmFlags" field deserves a separate description. This member represents the kernel > flags associated with the particular virtual memory area in two letter encoded > diff --git v4.2-rc4/fs/proc/task_mmu.c v4.2-rc4_patched/fs/proc/task_mmu.c > index ca1e091881d4..2c37938b82ee 100644 > --- v4.2-rc4/fs/proc/task_mmu.c > +++ v4.2-rc4_patched/fs/proc/task_mmu.c > @@ -445,6 +445,7 @@ struct mem_size_stats { > unsigned long anonymous; > unsigned long anonymous_thp; > unsigned long swap; > + unsigned long hugetlb; > u64 pss; > }; > > @@ -610,12 +611,38 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) > seq_putc(m, '\n'); > } > > +#ifdef CONFIG_HUGETLB_PAGE > +static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask, > + unsigned long addr, unsigned long end, > + struct mm_walk *walk) > +{ > + struct mem_size_stats *mss = walk->private; > + struct vm_area_struct *vma = walk->vma; > + struct page *page = NULL; > + > + if (pte_present(*pte)) { > + page = vm_normal_page(vma, addr, *pte); > + } else if (is_swap_pte(*pte)) { > + swp_entry_t swpent = pte_to_swp_entry(*pte); > + > + if (is_migration_entry(swpent)) > + page = migration_entry_to_page(swpent); > + } > + if (page) > + mss->hugetlb += huge_page_size(hstate_vma(vma)); > + return 0; > +} > +#endif /* HUGETLB_PAGE */ > + > static int show_smap(struct seq_file *m, void *v, int is_pid) > { > struct vm_area_struct *vma = v; > struct mem_size_stats mss; > struct mm_walk smaps_walk = { > .pmd_entry = smaps_pte_range, > +#ifdef CONFIG_HUGETLB_PAGE > + .hugetlb_entry = smaps_hugetlb_range, > +#endif > .mm = vma->vm_mm, > .private = &mss, > }; > @@ -637,6 +664,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) > "Referenced: %8lu kB\n" > "Anonymous: %8lu kB\n" > "AnonHugePages: %8lu kB\n" > + "HugetlbPages: %8lu kB\n" > "Swap: %8lu kB\n" > "KernelPageSize: %8lu kB\n" > "MMUPageSize: %8lu kB\n" > @@ -651,6 +679,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) > mss.referenced >> 10, > mss.anonymous >> 10, > mss.anonymous_thp >> 10, > + mss.hugetlb >> 10, > mss.swap >> 10, > vma_kernel_pagesize(vma) >> 10, > vma_mmu_pagesize(vma) >> 10, > -- > 2.4.3 > N?????r??y????b?X??ǧv?^?)޺{.n?+????{????zX????ܨ}???Ơz?&j:+v???????zZ+??+zf???h???~????i???z??w?????????&?)ߢf??^jǫy?m??@A?a??? 0??h???i -- Michal Hocko SUSE Labs -- 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/