mm,thp: stats for file backed THP
In preparation for non-shmem THP, this patch adds a few stats and exposes them in /proc/meminfo, /sys/bus/node/devices/<node>/meminfo, and /proc/<pid>/task/<tid>/smaps. This patch is mostly a rewrite of Kirill A. Shutemov's earlier version: https://lkml.kernel.org/r/20170126115819.58875-5-kirill.shutemov@linux.intel.com/ Link: http://lkml.kernel.org/r/20190801184244.3169074-5-songliubraving@fb.com Signed-off-by: Song Liu <songliubraving@fb.com> Acked-by: Rik van Riel <riel@surriel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Hillf Danton <hdanton@sina.com> Cc: Hugh Dickins <hughd@google.com> Cc: William Kucharski <william.kucharski@oracle.com> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
520e5ba415
Коммит
60fbf0ab5d
|
@ -427,6 +427,8 @@ static ssize_t node_read_meminfo(struct device *dev,
|
|||
"Node %d AnonHugePages: %8lu kB\n"
|
||||
"Node %d ShmemHugePages: %8lu kB\n"
|
||||
"Node %d ShmemPmdMapped: %8lu kB\n"
|
||||
"Node %d FileHugePages: %8lu kB\n"
|
||||
"Node %d FilePmdMapped: %8lu kB\n"
|
||||
#endif
|
||||
,
|
||||
nid, K(node_page_state(pgdat, NR_FILE_DIRTY)),
|
||||
|
@ -452,6 +454,10 @@ static ssize_t node_read_meminfo(struct device *dev,
|
|||
nid, K(node_page_state(pgdat, NR_SHMEM_THPS) *
|
||||
HPAGE_PMD_NR),
|
||||
nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
|
||||
HPAGE_PMD_NR),
|
||||
nid, K(node_page_state(pgdat, NR_FILE_THPS) *
|
||||
HPAGE_PMD_NR),
|
||||
nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) *
|
||||
HPAGE_PMD_NR)
|
||||
#endif
|
||||
);
|
||||
|
|
|
@ -132,6 +132,10 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
|
|||
global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR);
|
||||
show_val_kb(m, "ShmemPmdMapped: ",
|
||||
global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR);
|
||||
show_val_kb(m, "FileHugePages: ",
|
||||
global_node_page_state(NR_FILE_THPS) * HPAGE_PMD_NR);
|
||||
show_val_kb(m, "FilePmdMapped: ",
|
||||
global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CMA
|
||||
|
|
|
@ -417,6 +417,7 @@ struct mem_size_stats {
|
|||
unsigned long lazyfree;
|
||||
unsigned long anonymous_thp;
|
||||
unsigned long shmem_thp;
|
||||
unsigned long file_thp;
|
||||
unsigned long swap;
|
||||
unsigned long shared_hugetlb;
|
||||
unsigned long private_hugetlb;
|
||||
|
@ -588,7 +589,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
|
|||
else if (is_zone_device_page(page))
|
||||
/* pass */;
|
||||
else
|
||||
VM_BUG_ON_PAGE(1, page);
|
||||
mss->file_thp += HPAGE_PMD_SIZE;
|
||||
smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), locked);
|
||||
}
|
||||
#else
|
||||
|
@ -809,6 +810,7 @@ static void __show_smap(struct seq_file *m, const struct mem_size_stats *mss,
|
|||
SEQ_PUT_DEC(" kB\nLazyFree: ", mss->lazyfree);
|
||||
SEQ_PUT_DEC(" kB\nAnonHugePages: ", mss->anonymous_thp);
|
||||
SEQ_PUT_DEC(" kB\nShmemPmdMapped: ", mss->shmem_thp);
|
||||
SEQ_PUT_DEC(" kB\nFilePmdMapped: ", mss->file_thp);
|
||||
SEQ_PUT_DEC(" kB\nShared_Hugetlb: ", mss->shared_hugetlb);
|
||||
seq_put_decimal_ull_width(m, " kB\nPrivate_Hugetlb: ",
|
||||
mss->private_hugetlb >> 10, 7);
|
||||
|
|
|
@ -235,6 +235,8 @@ enum node_stat_item {
|
|||
NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
|
||||
NR_SHMEM_THPS,
|
||||
NR_SHMEM_PMDMAPPED,
|
||||
NR_FILE_THPS,
|
||||
NR_FILE_PMDMAPPED,
|
||||
NR_ANON_THPS,
|
||||
NR_UNSTABLE_NFS, /* NFS unstable pages */
|
||||
NR_VMSCAN_WRITE,
|
||||
|
|
|
@ -1158,6 +1158,8 @@ const char * const vmstat_text[] = {
|
|||
"nr_shmem",
|
||||
"nr_shmem_hugepages",
|
||||
"nr_shmem_pmdmapped",
|
||||
"nr_file_hugepages",
|
||||
"nr_file_pmdmapped",
|
||||
"nr_anon_transparent_hugepages",
|
||||
"nr_unstable",
|
||||
"nr_vmscan_write",
|
||||
|
|
Загрузка…
Ссылка в новой задаче