linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Steve Capper <steve.capper@linaro.org>
To: Joern Engel <joern@logfs.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] hugetlb: properly account rss
Date: Wed, 3 Jul 2013 14:41:19 +0100	[thread overview]
Message-ID: <20130703134118.GA4978@linaro.org> (raw)
In-Reply-To: <1371581225-27535-2-git-send-email-joern@logfs.org>

On Tue, Jun 18, 2013 at 02:47:04PM -0400, Joern Engel wrote:
> When moving a program from mmap'ing small pages to mmap'ing huge pages,
> a remarkable drop in rss ensues.  For some reason hugepages were never
> accounted for in rss, which in my book is a clear bug.  Sadly this bug
> has been present in hugetlbfs since it was merged back in 2002.  There
> is every chance existing programs depend on hugepages not being counted
> as rss.
> 
> I think the correct solution is to fix the bug and wait for someone to
> complain.  It is just as likely that noone cares - as evidenced by the
> fact that noone seems to have noticed for ten years.
> 
> Signed-off-by: Joern Engel <joern@logfs.org>
> ---
>  mm/hugetlb.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 

Hi,
This patch has caused a few warnings for me today when it was integrated into
linux-next. The libhugetlbfs test suite gave me:
[ 94.320661] BUG: Bad rss-counter state mm:ffff880119461040 idx:1 val:-512
[ 94.330346] BUG: Bad rss-counter state mm:ffff880119460680 idx:1 val:-2560
[ 94.341746] BUG: Bad rss-counter state mm:ffff880119460d00 idx:1 val:-512
[ 94.347518] BUG: Bad rss-counter state mm:ffff880119460d00 idx:1 val:-512
[ 94.415203] BUG: Bad rss-counter state mm:ffff8801194f9040 idx:1 val:-1024

[ ...]

I think I've found the cause; MAP_SHARED mappings.
alloc_huge_page and __unmap_hugepage_range are called for shared pages. Also,
__unmap_hugepage_range is called more times than alloc_huge_page (which makes
sense as multiple views of a shared mapping are unmapped) leading to negative
counter values.

Excluding VM_SHARED VMAs from the counter increment/decrement stopped the
warnings for me. Although this may not be the best way to address the issue.

Cheers,
-- 
Steve

--
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:[~2013-07-03 13:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 18:47 [PATCH 0/2] hugetlb fixes Joern Engel
2013-06-18 18:47 ` [PATCH 1/2] hugetlb: properly account rss Joern Engel
2013-06-28 22:03   ` Andrew Morton
2013-07-03 13:41   ` Steve Capper [this message]
2013-07-03 14:55     ` Steve Capper
2013-06-18 18:47 ` [PATCH 2/2] mmap: allow MAP_HUGETLB for hugetlbfs files Joern Engel
2013-06-19  1:22   ` Jianguo Wu
2013-06-19 16:25     ` [PATCH] mmap: allow MAP_HUGETLB for hugetlbfs files v2 Jörn Engel
2013-06-20  1:31       ` Jianguo Wu
2013-06-19 16:25     ` [PATCH 2/2] mmap: allow MAP_HUGETLB for hugetlbfs files Jörn Engel
2013-06-18 18:50 ` [PATCH 0/2] hugetlb fixes Jörn Engel
2013-06-18 20:27   ` Andrew Morton
2013-06-18 20:04     ` Jörn Engel

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=20130703134118.GA4978@linaro.org \
    --to=steve.capper@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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