hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/mm/util.c
....@@ -29,6 +29,7 @@
2929 #include "internal.h"
3030 #ifndef __GENKSYMS__
3131 #include <trace/hooks/syscall_check.h>
32
+#include <trace/hooks/mm.h>
3233 #endif
3334
3435 /**
....@@ -587,6 +588,7 @@
587588 {
588589 gfp_t kmalloc_flags = flags;
589590 void *ret;
591
+ bool use_vmalloc = false;
590592
591593 /*
592594 * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables)
....@@ -594,6 +596,10 @@
594596 */
595597 if ((flags & GFP_KERNEL) != GFP_KERNEL)
596598 return kmalloc_node(size, flags, node);
599
+
600
+ trace_android_vh_kvmalloc_node_use_vmalloc(size, &kmalloc_flags, &use_vmalloc);
601
+ if (use_vmalloc)
602
+ goto use_vmalloc_node;
597603
598604 /*
599605 * We want to attempt a large physically contiguous block first because
....@@ -624,6 +630,7 @@
624630 return NULL;
625631 }
626632
633
+use_vmalloc_node:
627634 return __vmalloc_node(size, 1, flags, node,
628635 __builtin_return_address(0));
629636 }