From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934382AbcBDQmh (ORCPT ); Thu, 4 Feb 2016 11:42:37 -0500 Received: from mx2.parallels.com ([199.115.105.18]:45493 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934203AbcBDQmg (ORCPT ); Thu, 4 Feb 2016 11:42:36 -0500 Date: Thu, 4 Feb 2016 19:42:26 +0300 From: Vladimir Davydov To: Naoya Horiguchi CC: Andrew Morton , Konstantin Khlebnikov , , , Naoya Horiguchi Subject: Re: [PATCH v1 1/3] /proc/kpageflags: return KPF_BUDDY for "tail" buddy pages Message-ID: <20160204164226.GA16895@esperanza> References: <1454569683-17918-1-git-send-email-n-horiguchi@ah.jp.nec.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1454569683-17918-1-git-send-email-n-horiguchi@ah.jp.nec.com> X-ClientProxiedBy: US-EXCH.sw.swsoft.com (10.255.249.47) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2016 at 04:08:01PM +0900, Naoya Horiguchi wrote: > Currently /proc/kpageflags returns nothing for "tail" buddy pages, which > is inconvenient when grasping how free pages are distributed. This patch > sets KPF_BUDDY for such pages. Looks reasonable to me, Reviewed-by: Vladimir Davydov > > With this patch: > > $ grep MemFree /proc/meminfo ; tools/vm/page-types -b buddy > MemFree: 3134992 kB > flags page-count MB symbolic-flags long-symbolic-flags > 0x0000000000000400 779272 3044 __________B_______________________________ buddy > 0x0000000000000c00 4385 17 __________BM______________________________ buddy,mmap > total 783657 3061 Why are buddy pages reported as mmapped? That looks weird. Shouldn't we fix it? Something like this, may be? -- From: Vladimir Davydov Subject: [PATCH] proc: kpageflags: do not report buddy and balloon pages as mapped PageBuddy and PageBalloon are not usual page flags - they are identified by a special negative (so as not to confuse with mapped pages) value of page->_mapcount. Since /proc/kpageflags uses page_mapcount helper to check if a page is mapped, it reports pages of these kinds as being mapped, which is confusing. Fix that by replacing page_mapcount with page_mapped. Signed-off-by: Vladimir Davydov diff --git a/fs/proc/page.c b/fs/proc/page.c index b2855eea5405..332450d87ea4 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -105,7 +105,7 @@ u64 stable_page_flags(struct page *page) * Note that page->_mapcount is overloaded in SLOB/SLUB/SLQB, so the * simple test in page_mapcount() is not enough. */ - if (!PageSlab(page) && page_mapcount(page)) + if (!PageSlab(page) && page_mapped(page)) u |= 1 << KPF_MMAP; if (PageAnon(page)) u |= 1 << KPF_ANON;