mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
UPSTREAM: mm: emit tracepoint when RSS changes
Useful to track how RSS is changing per TGID to detect spikes in RSS and
memory hogs. Several Android teams have been using this patch in various
kernel trees for half a year now. Many reported to me it is really
useful so I'm posting it upstream.
Initial patch developed by Tim Murray. Changes I made from original patch:
o Prevent any additional space consumed by mm_struct.
Regarding the fact that the RSS may change too often thus flooding the
traces - note that, there is some "hysterisis" with this already. That
is - We update the counter only if we receive 64 page faults due to
SPLIT_RSS_ACCOUNTING. However, during zapping or copying of pte range,
the RSS is updated immediately which can become noisy/flooding. In a
previous discussion, we agreed that BPF or ftrace can be used to rate
limit the signal if this becomes an issue.
Also note that I added wrappers to trace_rss_stat to prevent compiler
errors where linux/mm.h is included from tracing code, causing errors
such as:
CC kernel/trace/power-traces.o
In file included from ./include/trace/define_trace.h:102,
from ./include/trace/events/kmem.h:342,
from ./include/linux/mm.h:31,
from ./include/linux/ring_buffer.h:5,
from ./include/linux/trace_events.h:6,
from ./include/trace/events/power.h:12,
from kernel/trace/power-traces.c:15:
./include/trace/trace_events.h:113:22: error: field ‘ent’ has incomplete type
struct trace_entry ent; \
Change-Id: I26e72db29ec89a305c29a50159279339067f4983
Link: http://lore.kernel.org/r/[email protected]
Acked-by: Michal Hocko <[email protected]>
Co-developed-by: Tim Murray <[email protected]>
Signed-off-by: Tim Murray <[email protected]>
Signed-off-by: Joel Fernandes (Google) <[email protected]>
Signed-off-by: Joel Fernandes <[email protected]>
This commit is contained in:
parent
7dc1159904
commit
77510796c6
3 changed files with 38 additions and 3 deletions
|
|
@ -72,6 +72,8 @@
|
|||
#include <linux/oom.h>
|
||||
#include <linux/numa.h>
|
||||
|
||||
#include <trace/events/kmem.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/mmu_context.h>
|
||||
#include <asm/pgalloc.h>
|
||||
|
|
@ -140,6 +142,10 @@ static int __init init_zero_pfn(void)
|
|||
}
|
||||
core_initcall(init_zero_pfn);
|
||||
|
||||
void mm_trace_rss_stat(int member, long count)
|
||||
{
|
||||
trace_rss_stat(member, count);
|
||||
}
|
||||
|
||||
#if defined(SPLIT_RSS_COUNTING)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue