All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
@ 2017-03-22  0:51 ` Johannes Weiner
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2017-03-22  0:51 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kirill A. Shutemov, Michal Hocko, Vladimir Davydov, linux-mm,
	cgroups, linux-kernel, kernel-team

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

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

* [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
@ 2017-03-22  0:51 ` Johannes Weiner
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2017-03-22  0:51 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kirill A. Shutemov, Michal Hocko, Vladimir Davydov, linux-mm,
	cgroups, linux-kernel, kernel-team

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

--
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] 8+ messages in thread

* Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
  2017-03-22  0:51 ` Johannes Weiner
@ 2017-03-24 11:07   ` Kirill A. Shutemov
  -1 siblings, 0 replies; 8+ messages in thread
From: Kirill A. Shutemov @ 2017-03-24 11:07 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Michal Hocko, Vladimir Davydov, linux-mm, cgroups,
	linux-kernel, kernel-team

On Tue, Mar 21, 2017 at 08:51:11PM -0400, 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>

Sorry for missing that:

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Do we want it into stable?

Cc: <stable@vger.kernel.org>	[4.8+]

-- 
 Kirill A. Shutemov

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

* Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
@ 2017-03-24 11:07   ` Kirill A. Shutemov
  0 siblings, 0 replies; 8+ messages in thread
From: Kirill A. Shutemov @ 2017-03-24 11:07 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Michal Hocko, Vladimir Davydov, linux-mm, cgroups,
	linux-kernel, kernel-team

On Tue, Mar 21, 2017 at 08:51:11PM -0400, 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>

Sorry for missing that:

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Do we want it into stable?

Cc: <stable@vger.kernel.org>	[4.8+]

-- 
 Kirill A. Shutemov

--
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] 8+ messages in thread

* Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
  2017-03-24 11:07   ` Kirill A. Shutemov
@ 2017-03-24 13:46     ` Johannes Weiner
  -1 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2017-03-24 13:46 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Andrew Morton, Michal Hocko, Vladimir Davydov, linux-mm, cgroups,
	linux-kernel, kernel-team

On Fri, Mar 24, 2017 at 02:07:55PM +0300, Kirill A. Shutemov wrote:
> On Tue, Mar 21, 2017 at 08:51:11PM -0400, 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>
> 
> Sorry for missing that:
> 
> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Thanks!

> Do we want it into stable?
> 
> Cc: <stable@vger.kernel.org>	[4.8+]

Yep, that makes sense.

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

* Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
@ 2017-03-24 13:46     ` Johannes Weiner
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2017-03-24 13:46 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Andrew Morton, Michal Hocko, Vladimir Davydov, linux-mm, cgroups,
	linux-kernel, kernel-team

On Fri, Mar 24, 2017 at 02:07:55PM +0300, Kirill A. Shutemov wrote:
> On Tue, Mar 21, 2017 at 08:51:11PM -0400, 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>
> 
> Sorry for missing that:
> 
> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Thanks!

> Do we want it into stable?
> 
> Cc: <stable@vger.kernel.org>	[4.8+]

Yep, that makes sense.

--
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] 8+ messages in thread

* Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
  2017-03-22  0:51 ` Johannes Weiner
@ 2017-03-28 14:52   ` Michal Hocko
  -1 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2017-03-28 14:52 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Kirill A. Shutemov, Vladimir Davydov, linux-mm,
	cgroups, linux-kernel, kernel-team

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

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

* Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
@ 2017-03-28 14:52   ` Michal Hocko
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2017-03-28 14:52 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Kirill A. Shutemov, Vladimir Davydov, linux-mm,
	cgroups, linux-kernel, kernel-team

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

--
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] 8+ messages in thread

end of thread, other threads:[~2017-03-28 15:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22  0:51 [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats Johannes Weiner
2017-03-22  0:51 ` Johannes Weiner
2017-03-24 11:07 ` Kirill A. Shutemov
2017-03-24 11:07   ` Kirill A. Shutemov
2017-03-24 13:46   ` Johannes Weiner
2017-03-24 13:46     ` Johannes Weiner
2017-03-28 14:52 ` Michal Hocko
2017-03-28 14:52   ` Michal Hocko

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.