diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2017-11-15 20:35:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 21:21:04 -0500 |
commit | b4e98d9ac775907cc53fb08fcb6776deb7694e30 (patch) | |
tree | 4a82caff5eab86a66f078622acfd68df5ac92235 /fs/proc | |
parent | 7d6c4dfa4de96d11b9d6adaf5aa5ca8c54670258 (diff) |
mm: account pud page tables
On a machine with 5-level paging support a process can allocate
significant amount of memory and stay unnoticed by oom-killer and memory
cgroup. The trick is to allocate a lot of PUD page tables. We don't
account PUD page tables, only PMD and PTE.
We already addressed the same issue for PMD page tables, see commit
dc6c9a35b66b ("mm: account pmd page tables to the process").
Introduction of 5-level paging brings the same issue for PUD page
tables.
The patch expands accounting to PUD level.
[kirill.shutemov@linux.intel.com: s/pmd_t/pud_t/]
Link: http://lkml.kernel.org/r/20171004074305.x35eh5u7ybbt5kar@black.fi.intel.com
[heiko.carstens@de.ibm.com: s390/mm: fix pud table accounting]
Link: http://lkml.kernel.org/r/20171103090551.18231-1-heiko.carstens@de.ibm.com
Link: http://lkml.kernel.org/r/20171002080427.3320-1-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/task_mmu.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 6744bd706ecf..a05ce6186f99 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | void task_mem(struct seq_file *m, struct mm_struct *mm) | 27 | void task_mem(struct seq_file *m, struct mm_struct *mm) |
28 | { | 28 | { |
29 | unsigned long text, lib, swap, ptes, pmds, anon, file, shmem; | 29 | unsigned long text, lib, swap, ptes, pmds, puds, anon, file, shmem; |
30 | unsigned long hiwater_vm, total_vm, hiwater_rss, total_rss; | 30 | unsigned long hiwater_vm, total_vm, hiwater_rss, total_rss; |
31 | 31 | ||
32 | anon = get_mm_counter(mm, MM_ANONPAGES); | 32 | anon = get_mm_counter(mm, MM_ANONPAGES); |
@@ -52,6 +52,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) | |||
52 | swap = get_mm_counter(mm, MM_SWAPENTS); | 52 | swap = get_mm_counter(mm, MM_SWAPENTS); |
53 | ptes = PTRS_PER_PTE * sizeof(pte_t) * atomic_long_read(&mm->nr_ptes); | 53 | ptes = PTRS_PER_PTE * sizeof(pte_t) * atomic_long_read(&mm->nr_ptes); |
54 | pmds = PTRS_PER_PMD * sizeof(pmd_t) * mm_nr_pmds(mm); | 54 | pmds = PTRS_PER_PMD * sizeof(pmd_t) * mm_nr_pmds(mm); |
55 | puds = PTRS_PER_PUD * sizeof(pud_t) * mm_nr_puds(mm); | ||
55 | seq_printf(m, | 56 | seq_printf(m, |
56 | "VmPeak:\t%8lu kB\n" | 57 | "VmPeak:\t%8lu kB\n" |
57 | "VmSize:\t%8lu kB\n" | 58 | "VmSize:\t%8lu kB\n" |
@@ -68,6 +69,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) | |||
68 | "VmLib:\t%8lu kB\n" | 69 | "VmLib:\t%8lu kB\n" |
69 | "VmPTE:\t%8lu kB\n" | 70 | "VmPTE:\t%8lu kB\n" |
70 | "VmPMD:\t%8lu kB\n" | 71 | "VmPMD:\t%8lu kB\n" |
72 | "VmPUD:\t%8lu kB\n" | ||
71 | "VmSwap:\t%8lu kB\n", | 73 | "VmSwap:\t%8lu kB\n", |
72 | hiwater_vm << (PAGE_SHIFT-10), | 74 | hiwater_vm << (PAGE_SHIFT-10), |
73 | total_vm << (PAGE_SHIFT-10), | 75 | total_vm << (PAGE_SHIFT-10), |
@@ -82,6 +84,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) | |||
82 | mm->stack_vm << (PAGE_SHIFT-10), text, lib, | 84 | mm->stack_vm << (PAGE_SHIFT-10), text, lib, |
83 | ptes >> 10, | 85 | ptes >> 10, |
84 | pmds >> 10, | 86 | pmds >> 10, |
87 | puds >> 10, | ||
85 | swap << (PAGE_SHIFT-10)); | 88 | swap << (PAGE_SHIFT-10)); |
86 | hugetlb_report_usage(m, mm); | 89 | hugetlb_report_usage(m, mm); |
87 | } | 90 | } |