linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Convert all THP vmstat counters to pages
@ 2020-12-08  4:18 Muchun Song
  2020-12-08  4:18 ` [PATCH v3 1/7] mm: memcontrol: fix NR_ANON_THPS account Muchun Song
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Muchun Song @ 2020-12-08  4:18 UTC (permalink / raw)
  To: gregkh, rafael, adobriyan, akpm, hannes, mhocko, vdavydov.dev,
	hughd, shakeelb, guro, samitolvanen, feng.tang, neilb,
	iamjoonsoo.kim, rdunlap
  Cc: linux-kernel, linux-fsdevel, linux-mm, cgroups, Muchun Song

Hi,

This patch series is aimed to convert all THP vmstat counters to pages.

The unit of some vmstat counters are pages, some are bytes, some are
HPAGE_PMD_NR, and some are KiB. When we want to expose these vmstat
counters to the userspace, we have to know the unit of the vmstat counters
is which one. When the unit is bytes or kB, both clearly distinguishable
by the B/KB suffix. But for the THP vmstat counters, We may make mistakes.

For example, the below is some bug fix for the THP vmstat counters:
  - 7de2e9f195b9 ("mm: memcontrol: correct the NR_ANON_THPS counter of hierarchical memcg")
  - Not committed which is the first commit in this series ("mm: memcontrol: fix NR_ANON_THPS account")

This patch series can make the code clear. And make all the unit of the THP
vmstat counters in pages. Finally, the unit of the vmstat counters are
pages, kB and bytes. The B/KB suffix can tell us that the unit is bytes
or kB. The rest which is without suffix are pages.

As Hugh said, "It does need to be recognized that, with these changes, every
THP stats update overflows the per-cpu counter, resorting to atomic global
updates.

But this change is consistent with 4.7's 8f182270dfec ("mm/swap.c: flush
lru pvecs on compound page arrival"): we accepted greater overhead for
greater accuracy back then, so I think it's okay to do so for THP stats."

This was inspired by Johannes and Roman. Thanks to them.

Changes in v2 -> v3:
  - Change the series subject from "Convert all vmstat counters to pages or bytes"
    to "Convert all THP vmstat counters to pages".
  - Remove convert of KB to B.

Changes in v1 -> v2:
  - Change the series subject from "Convert all THP vmstat counters to pages"
    to "Convert all vmstat counters to pages or bytes".
  - Convert NR_KERNEL_SCS_KB account to bytes.
  - Convert vmstat slab counters to bytes.
  - Remove {global_}node_page_state_pages.

Muchun Song (7):
  mm: memcontrol: fix NR_ANON_THPS account
  mm: memcontrol: convert NR_ANON_THPS account to pages
  mm: memcontrol: convert NR_FILE_THPS account to pages
  mm: memcontrol: convert NR_SHMEM_THPS account to pages
  mm: memcontrol: convert NR_SHMEM_PMDMAPPED account to pages
  mm: memcontrol: convert NR_FILE_PMDMAPPED account to pages
  mm: memcontrol: make the slab calculation consistent

 drivers/base/node.c |  15 ++----
 fs/proc/meminfo.c   |  10 ++--
 mm/filemap.c        |   4 +-
 mm/huge_memory.c    |   9 ++--
 mm/khugepaged.c     |   4 +-
 mm/memcontrol.c     | 139 ++++++++++++++++++++++++++--------------------------
 mm/page_alloc.c     |   7 ++-
 mm/rmap.c           |  19 ++++---
 mm/shmem.c          |   3 +-
 9 files changed, 107 insertions(+), 103 deletions(-)

-- 
2.11.0



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

end of thread, other threads:[~2020-12-15 16:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08  4:18 [PATCH v3 0/7] Convert all THP vmstat counters to pages Muchun Song
2020-12-08  4:18 ` [PATCH v3 1/7] mm: memcontrol: fix NR_ANON_THPS account Muchun Song
2020-12-09  1:58   ` Roman Gushchin
2020-12-08  4:18 ` [PATCH v3 2/7] mm: memcontrol: convert NR_ANON_THPS account to pages Muchun Song
2020-12-15 13:30   ` Michal Hocko
2020-12-15 13:37     ` [External] " Muchun Song
2020-12-08  4:18 ` [PATCH v3 3/7] mm: memcontrol: convert NR_FILE_THPS " Muchun Song
2020-12-08  4:18 ` [PATCH v3 4/7] mm: memcontrol: convert NR_SHMEM_THPS " Muchun Song
2020-12-08  4:18 ` [PATCH v3 5/7] mm: memcontrol: convert NR_SHMEM_PMDMAPPED " Muchun Song
2020-12-08  4:18 ` [PATCH v3 6/7] mm: memcontrol: convert NR_FILE_PMDMAPPED " Muchun Song
2020-12-08  4:18 ` [PATCH v3 7/7] mm: memcontrol: make the slab calculation consistent Muchun Song
2020-12-08  7:20   ` Pankaj Gupta
2020-12-08  7:53     ` [External] " Muchun Song
2020-12-15 13:35   ` Michal Hocko
2020-12-15 16:21     ` [External] " Muchun Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).