| .. | .. |
|---|
| 29 | 29 | #include "internal.h" |
|---|
| 30 | 30 | #ifndef __GENKSYMS__ |
|---|
| 31 | 31 | #include <trace/hooks/syscall_check.h> |
|---|
| 32 | +#include <trace/hooks/mm.h> |
|---|
| 32 | 33 | #endif |
|---|
| 33 | 34 | |
|---|
| 34 | 35 | /** |
|---|
| .. | .. |
|---|
| 587 | 588 | { |
|---|
| 588 | 589 | gfp_t kmalloc_flags = flags; |
|---|
| 589 | 590 | void *ret; |
|---|
| 591 | + bool use_vmalloc = false; |
|---|
| 590 | 592 | |
|---|
| 591 | 593 | /* |
|---|
| 592 | 594 | * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables) |
|---|
| .. | .. |
|---|
| 594 | 596 | */ |
|---|
| 595 | 597 | if ((flags & GFP_KERNEL) != GFP_KERNEL) |
|---|
| 596 | 598 | 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; |
|---|
| 597 | 603 | |
|---|
| 598 | 604 | /* |
|---|
| 599 | 605 | * We want to attempt a large physically contiguous block first because |
|---|
| .. | .. |
|---|
| 624 | 630 | return NULL; |
|---|
| 625 | 631 | } |
|---|
| 626 | 632 | |
|---|
| 633 | +use_vmalloc_node: |
|---|
| 627 | 634 | return __vmalloc_node(size, 1, flags, node, |
|---|
| 628 | 635 | __builtin_return_address(0)); |
|---|
| 629 | 636 | } |
|---|