linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Prakash Sangappa <prakash.sangappa@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"minchan@kernel.org" <minchan@kernel.org>,
	"rientjes@google.com" <rientjes@google.com>,
	"dancol@google.com" <dancol@google.com>
Subject: Re: [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
Date: Wed, 25 Oct 2017 22:45:10 +0000	[thread overview]
Message-ID: <20171025224508.GA18691@hori1.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20171025065527.wmii7ce5y5i4exx5@dhcp22.suse.cz>

On Wed, Oct 25, 2017 at 08:55:27AM +0200, Michal Hocko wrote:
> [CCing Naoya]
> 
> On Tue 24-10-17 16:56:08, Prakash Sangappa wrote:
> > Resident set size(Rss) accounting of hugetlb pages is not done
> > currently in /proc/<pid>/smaps. The pmap command reads rss from
> > this file and so it shows Rss to be 0 in pmap -x output for
> > hugetlb mapped vmas. This patch fixes it.
> 
> We do not account in rss because we do have a dedicated counters
> depending on whether the hugetlb page is mapped privately or it is
> shared. The reason this is not in RSS IIRC is that a large unexpected
> RSS from hugetlb pages might confuse system monitors.

Yes, that was the intention of separate counters for hugetlb.

> This is one of
> those backward compatibility issues when you start accounting something
> too late.

So new monitoring applications are supposed to check the new counters
to track hugetlb usages.

Thanks,
Naoya Horiguchi


> 
> > Signed-off-by: Prakash Sangappa <prakash.sangappa@oracle.com>
> > ---
> >  fs/proc/task_mmu.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index 5589b4b..c7e1048 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -724,6 +724,7 @@ static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask,
> >  			mss->shared_hugetlb += huge_page_size(hstate_vma(vma));
> >  		else
> >  			mss->private_hugetlb += huge_page_size(hstate_vma(vma));
> > +		mss->resident += huge_page_size(hstate_vma(vma));
> >  	}
> >  	return 0;
> >  }
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Michal Hocko
> SUSE Labs
> 
> --
> 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>
--
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>

      reply	other threads:[~2017-10-25 22:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 23:56 Prakash Sangappa
2017-10-25  6:55 ` Michal Hocko
2017-10-25 22:45   ` Naoya Horiguchi [this message]

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=20171025224508.GA18691@hori1.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=dancol@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=minchan@kernel.org \
    --cc=prakash.sangappa@oracle.com \
    --cc=rientjes@google.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