linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Konstantin Khlebnikov <koct9i@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v1 1/3] /proc/kpageflags: return KPF_BUDDY for "tail" buddy pages
Date: Thu, 4 Feb 2016 19:42:26 +0300	[thread overview]
Message-ID: <20160204164226.GA16895@esperanza> (raw)
In-Reply-To: <1454569683-17918-1-git-send-email-n-horiguchi@ah.jp.nec.com>

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 <vdavydov@virtuozzo.com>

> 
> 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 <vdavydov@virtuozzo.com>
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 <vdavydov@virtuozzo.com>

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;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2016-02-04 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04  7:08 [PATCH v1 1/3] /proc/kpageflags: return KPF_BUDDY for "tail" buddy pages Naoya Horiguchi
2016-02-04  7:08 ` [PATCH v1 2/3] /proc/kpageflags: return KPF_SLAB for slab tail pages Naoya Horiguchi
2016-02-04 16:43   ` Vladimir Davydov
2016-02-04  7:08 ` [PATCH v1 3/3] tools/vm/page-types.c: support swap entry Naoya Horiguchi
2016-02-04 16:42 ` Vladimir Davydov [this message]
2016-02-04 23:29   ` [PATCH v1 1/3] /proc/kpageflags: return KPF_BUDDY for "tail" buddy pages Naoya Horiguchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160204164226.GA16895@esperanza \
    --to=vdavydov@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=nao.horiguchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).