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


Groups > linux.kernel > #1606120 > unrolled thread

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

Started byJohannes Weiner <hannes@cmpxchg.org>
First post2017-03-22 02:00 +0100
Last post2017-03-24 14:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats Johannes Weiner <hannes@cmpxchg.org> - 2017-03-22 02:00 +0100
    Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg  stats "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-24 12:10 +0100
      Re: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg  stats Johannes Weiner <hannes@cmpxchg.org> - 2017-03-24 14:50 +0100

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

FromJohannes Weiner <hannes@cmpxchg.org>
Date2017-03-22 02:00 +0100
Subject[PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
Message-ID<tnCN4-2HJ-9@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


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

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-03-24 12:10 +0100
SubjectRe: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
Message-ID<tovgv-E0-47@gated-at.bofh.it>
In reply to#1606120
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

[toc] | [prev] | [next] | [standalone]


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

FromJohannes Weiner <hannes@cmpxchg.org>
Date2017-03-24 14:50 +0100
SubjectRe: [PATCH] mm: rmap: fix huge file mmap accounting in the memcg stats
Message-ID<toxLk-2hq-13@gated-at.bofh.it>
In reply to#1608330
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web