All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
@ 2017-10-24 23:56 ` Prakash Sangappa
  0 siblings, 0 replies; 6+ messages in thread
From: Prakash Sangappa @ 2017-10-24 23:56 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: akpm, mhocko, minchan, rientjes, dancol, prakash.sangappa

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.

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
@ 2017-10-24 23:56 ` Prakash Sangappa
  0 siblings, 0 replies; 6+ messages in thread
From: Prakash Sangappa @ 2017-10-24 23:56 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: akpm, mhocko, minchan, rientjes, dancol, prakash.sangappa

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.

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

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
  2017-10-24 23:56 ` Prakash Sangappa
@ 2017-10-25  6:55   ` Michal Hocko
  -1 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2017-10-25  6:55 UTC (permalink / raw)
  To: Prakash Sangappa
  Cc: linux-kernel, linux-mm, akpm, minchan, rientjes, dancol, Naoya Horiguchi

[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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
@ 2017-10-25  6:55   ` Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2017-10-25  6:55 UTC (permalink / raw)
  To: Prakash Sangappa
  Cc: linux-kernel, linux-mm, akpm, minchan, rientjes, dancol, Naoya Horiguchi

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
  2017-10-25  6:55   ` Michal Hocko
@ 2017-10-25 22:45     ` Naoya Horiguchi
  -1 siblings, 0 replies; 6+ messages in thread
From: Naoya Horiguchi @ 2017-10-25 22:45 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Prakash Sangappa, linux-kernel, linux-mm, akpm, minchan,
	rientjes, dancol

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps
@ 2017-10-25 22:45     ` Naoya Horiguchi
  0 siblings, 0 replies; 6+ messages in thread
From: Naoya Horiguchi @ 2017-10-25 22:45 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Prakash Sangappa, linux-kernel, linux-mm, akpm, minchan,
	rientjes, dancol

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-25 22:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 23:56 [PATCH] Hugetlb pages rss accounting is incorrect in /proc/<pid>/smaps Prakash Sangappa
2017-10-24 23:56 ` Prakash Sangappa
2017-10-25  6:55 ` Michal Hocko
2017-10-25  6:55   ` Michal Hocko
2017-10-25 22:45   ` Naoya Horiguchi
2017-10-25 22:45     ` Naoya Horiguchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.