[Devel] [PATCH RH7] vmalloc: cancel huge vmalloc allocations by fatal signal or oom

Vasily Averin vvs at virtuozzo.com
Mon Sep 13 10:32:01 MSK 2021


Currently huge vmalloc allocation cannot be cancelled even by OOM-killer.

https://jira.sw.ru/browse/PSBM-132705
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 mm/vmalloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f3c1f5c..a976d15 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1629,7 +1629,8 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 		struct page *page;
 		gfp_t tmp_mask = gfp_mask | __GFP_NOWARN;
 
-		if (unlikely(test_thread_flag(TIF_MEMDIE))) {
+		if (unlikely(test_thread_flag(TIF_MEMDIE) ||
+			     fatal_signal_pending(current))) {
 			area->nr_pages = i;
 			goto nofail;
 		}
-- 
1.8.3.1



More information about the Devel mailing list