* [PATCH 9/9] memcg: accounting for ldt_struct objects
@ 2021-03-09 8:04 Vasily Averin
0 siblings, 0 replies; only message in thread
From: Vasily Averin @ 2021-03-09 8:04 UTC (permalink / raw)
To: cgroups, linux-mm; +Cc: Johannes Weiner, Michal Hocko, Vladimir Davydov
Objects can be created from memcg-limited tasks
but its misuse may lead to host OOM.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
arch/x86/kernel/ldt.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index aa15132..a1889a0 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -154,7 +154,7 @@ static struct ldt_struct *alloc_ldt_struct(unsigned int num_entries)
if (num_entries > LDT_ENTRIES)
return NULL;
- new_ldt = kmalloc(sizeof(struct ldt_struct), GFP_KERNEL);
+ new_ldt = kmalloc(sizeof(struct ldt_struct), GFP_KERNEL_ACCOUNT);
if (!new_ldt)
return NULL;
@@ -168,9 +168,10 @@ static struct ldt_struct *alloc_ldt_struct(unsigned int num_entries)
* than PAGE_SIZE.
*/
if (alloc_size > PAGE_SIZE)
- new_ldt->entries = vzalloc(alloc_size);
+ new_ldt->entries = __vmalloc(alloc_size,
+ GFP_KERNEL_ACCOUNT | __GFP_ZERO);
else
- new_ldt->entries = (void *)get_zeroed_page(GFP_KERNEL);
+ new_ldt->entries = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
if (!new_ldt->entries) {
kfree(new_ldt);
--
1.8.3.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-09 8:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 8:04 [PATCH 9/9] memcg: accounting for ldt_struct objects Vasily Averin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox