mm: rmap: fix huge file mmap accounting in the memcg stats
Subsystems (4)
Johannes Weiner
maintainerPATCH 1/1 mm: rmap: fix huge file mmap accounting in the memcg stats
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.
--- include/linux/memcontrol.h | 6 ++++++ mm/rmap.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/linux/memcontrol.h +6 -0
@@ -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) {
mm/rmap.c +2 -2
@@ -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);
Signature · 7 lines
2.12.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Johannes Weiner
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 <[email protected]>
Sorry for missing that:
Do we want it into stable?
Signature · 1 line
Kirill A. Shutemov
Johannes Weiner
maintainerQuoted 10 lines · Kirill A. Shutemov
Quoted 5 lines · Johannes Weiner
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 <[email protected]>Sorry for missing that:
Reviewed-by Kirill A. Shutemov <[email protected]>
Thanks!
Quoted 3 lines
Do we want it into stable?
Cc <[email protected]> [4.8+]
Yep, that makes sense.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Johannes Weiner
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 <[email protected]>
with the CC: stable
thanks!
Quoted 47 lines
--- include/linux/memcontrol.h | 6 ++++++ mm/rmap.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-)include/linux/memcontrol.h +6
-0@@ -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) {mm/rmap.c +2
-2@@ -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);Signature · 1 line
2.12.0
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>