Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1611081 > unrolled thread

Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats

Started byMichal Hocko <mhocko@kernel.org>
First post2017-03-28 17:20 +0200
Last post2017-03-28 17:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg  stats Michal Hocko <mhocko@kernel.org> - 2017-03-28 17:20 +0200

#1611081 — Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats

FromMichal Hocko <mhocko@kernel.org>
Date2017-03-28 17:20 +0200
SubjectRe: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
Message-ID<tq14B-16f-5@gated-at.bofh.it>
On Tue 21-03-17 20:51:11, Johannes Weiner wrote:
> Huge pages are accounted as single units in the memcg's "file_mapped"
> counter. Account the correct number of base pages, like we do in the
> corresponding node counter.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

with the CC: stable 
Acked-by: Michal Hocko <mhocko@suse.com>

thanks!
> ---
>  include/linux/memcontrol.h | 6 ++++++
>  mm/rmap.c                  | 4 ++--
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index baa274150210..c5ebb32fef49 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -741,6 +741,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
>  	return false;
>  }
>  
> +static inline void mem_cgroup_update_page_stat(struct page *page,
> +					       enum mem_cgroup_stat_index idx,
> +					       int nr)
> +{
> +}
> +
>  static inline void mem_cgroup_inc_page_stat(struct page *page,
>  					    enum mem_cgroup_stat_index idx)
>  {
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 1d82057144ba..f514cdd84482 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1154,7 +1154,7 @@ void page_add_file_rmap(struct page *page, bool compound)
>  			goto out;
>  	}
>  	__mod_node_page_state(page_pgdat(page), NR_FILE_MAPPED, nr);
> -	mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED);
> +	mem_cgroup_update_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED, nr);
>  out:
>  	unlock_page_memcg(page);
>  }
> @@ -1194,7 +1194,7 @@ static void page_remove_file_rmap(struct page *page, bool compound)
>  	 * pte lock(a spinlock) is held, which implies preemption disabled.
>  	 */
>  	__mod_node_page_state(page_pgdat(page), NR_FILE_MAPPED, -nr);
> -	mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED);
> +	mem_cgroup_update_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED, -nr);
>  
>  	if (unlikely(PageMlocked(page)))
>  		clear_page_mlock(page);
> -- 
> 2.12.0
> 

-- 
Michal Hocko
SUSE Labs

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web