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 /kernel | |
| 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 'kernel')
| -rw-r--r-- | kernel/fork.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 07cc743698d3..a4eb6f289365 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -819,6 +819,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, | |||
| 819 | mm->core_state = NULL; | 819 | mm->core_state = NULL; |
| 820 | atomic_long_set(&mm->nr_ptes, 0); | 820 | atomic_long_set(&mm->nr_ptes, 0); |
| 821 | mm_nr_pmds_init(mm); | 821 | mm_nr_pmds_init(mm); |
| 822 | mm_nr_puds_init(mm); | ||
| 822 | mm->map_count = 0; | 823 | mm->map_count = 0; |
| 823 | mm->locked_vm = 0; | 824 | mm->locked_vm = 0; |
| 824 | mm->pinned_vm = 0; | 825 | mm->pinned_vm = 0; |
| @@ -878,6 +879,9 @@ static void check_mm(struct mm_struct *mm) | |||
| 878 | if (mm_nr_pmds(mm)) | 879 | if (mm_nr_pmds(mm)) |
| 879 | pr_alert("BUG: non-zero nr_pmds on freeing mm: %ld\n", | 880 | pr_alert("BUG: non-zero nr_pmds on freeing mm: %ld\n", |
| 880 | mm_nr_pmds(mm)); | 881 | mm_nr_pmds(mm)); |
| 882 | if (mm_nr_puds(mm)) | ||
| 883 | pr_alert("BUG: non-zero nr_puds on freeing mm: %ld\n", | ||
| 884 | mm_nr_puds(mm)); | ||
| 881 | 885 | ||
| 882 | #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS | 886 | #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS |
| 883 | VM_BUG_ON_MM(mm->pmd_huge_pte, mm); | 887 | VM_BUG_ON_MM(mm->pmd_huge_pte, mm); |
