Skip to content

Commit 5671ce2

Browse files
hcahcaAlexander Gordeev
authored andcommitted
s390/mm: Use __GFP_ACCOUNT for user page table allocations
Add missing kmemcg accounting of user page table allocations. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent e11727b commit 5671ce2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

arch/s390/mm/pgalloc.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616

1717
unsigned long *crst_table_alloc(struct mm_struct *mm)
1818
{
19-
struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER);
19+
gfp_t gfp = GFP_KERNEL_ACCOUNT;
20+
struct ptdesc *ptdesc;
2021
unsigned long *table;
2122

23+
if (mm == &init_mm)
24+
gfp &= ~__GFP_ACCOUNT;
25+
ptdesc = pagetable_alloc(gfp, CRST_ALLOC_ORDER);
2226
if (!ptdesc)
2327
return NULL;
2428
table = ptdesc_to_virt(ptdesc);
@@ -117,7 +121,7 @@ struct ptdesc *page_table_alloc_pgste(struct mm_struct *mm)
117121
struct ptdesc *ptdesc;
118122
u64 *table;
119123

120-
ptdesc = pagetable_alloc(GFP_KERNEL, 0);
124+
ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, 0);
121125
if (ptdesc) {
122126
table = (u64 *)ptdesc_to_virt(ptdesc);
123127
__arch_set_page_dat(table, 1);
@@ -136,10 +140,13 @@ void page_table_free_pgste(struct ptdesc *ptdesc)
136140

137141
unsigned long *page_table_alloc(struct mm_struct *mm)
138142
{
143+
gfp_t gfp = GFP_KERNEL_ACCOUNT;
139144
struct ptdesc *ptdesc;
140145
unsigned long *table;
141146

142-
ptdesc = pagetable_alloc(GFP_KERNEL, 0);
147+
if (mm == &init_mm)
148+
gfp &= ~__GFP_ACCOUNT;
149+
ptdesc = pagetable_alloc(gfp, 0);
143150
if (!ptdesc)
144151
return NULL;
145152
if (!pagetable_pte_ctor(mm, ptdesc)) {

0 commit comments

Comments
 (0)