mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
percpu: add tracepoint support for percpu memory
Add support for tracepoints to the following events: chunk allocation, chunk free, area allocation, area free, and area allocation failure. This should let us replay percpu memory requests and evaluate corresponding decisions. Signed-off-by: Dennis Zhou <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
This commit is contained in:
parent
30a5b5367e
commit
df95e795a7
4 changed files with 141 additions and 0 deletions
12
mm/percpu.c
12
mm/percpu.c
|
|
@ -76,6 +76,9 @@
|
|||
#include <asm/tlbflush.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/percpu.h>
|
||||
|
||||
#include "percpu-internal.h"
|
||||
|
||||
#define PCPU_SLOT_BASE_SHIFT 5 /* 1-31 shares the same slot */
|
||||
|
|
@ -1015,11 +1018,17 @@ area_found:
|
|||
|
||||
ptr = __addr_to_pcpu_ptr(chunk->base_addr + off);
|
||||
kmemleak_alloc_percpu(ptr, size, gfp);
|
||||
|
||||
trace_percpu_alloc_percpu(reserved, is_atomic, size, align,
|
||||
chunk->base_addr, off, ptr);
|
||||
|
||||
return ptr;
|
||||
|
||||
fail_unlock:
|
||||
spin_unlock_irqrestore(&pcpu_lock, flags);
|
||||
fail:
|
||||
trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align);
|
||||
|
||||
if (!is_atomic && warn_limit) {
|
||||
pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",
|
||||
size, align, is_atomic, err);
|
||||
|
|
@ -1269,6 +1278,8 @@ void free_percpu(void __percpu *ptr)
|
|||
}
|
||||
}
|
||||
|
||||
trace_percpu_free_percpu(chunk->base_addr, off, ptr);
|
||||
|
||||
spin_unlock_irqrestore(&pcpu_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(free_percpu);
|
||||
|
|
@ -1719,6 +1730,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
|
|||
pcpu_chunk_relocate(pcpu_first_chunk, -1);
|
||||
|
||||
pcpu_stats_chunk_alloc();
|
||||
trace_percpu_create_chunk(base_addr);
|
||||
|
||||
/* we're done */
|
||||
pcpu_base_addr = base_addr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue