linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Prakash Sangappa <prakash.sangappa@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, minchan@kernel.org,
	rientjes@google.com, dancol@google.com,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Subject: Re: [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
Date: Wed, 25 Oct 2017 08:55:27 +0200	[thread overview]
Message-ID: <20171025065527.wmii7ce5y5i4exx5@dhcp22.suse.cz> (raw)
In-Reply-To: <1508889368-14489-1-git-send-email-prakash.sangappa@oracle.com>

[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. This is one of
those backward compatibility issues when you start accounting something
too late.

> 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>

  reply	other threads:[~2017-10-25  6:55 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 [this message]
2017-10-25 22:45   ` 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=20171025065527.wmii7ce5y5i4exx5@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dancol@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --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