ANDROID: task_mmu: add vendor hook for swap entry
Add vendor hook in smaps_pte_entry for swap entry - android_vh_smaps_pte_entry - android_vh_show_smap This vendor hook is to show more information for swap entries of a process based on the characteristics, such as written-back, same-filled or huge (uncompressed). This also merges changes in https://android-review.googlesource.com/c/kernel/common/+/3164628 to count and show swap_shared with single vendor hook. Bug: 284059805 Change-Id: Ie4a48ae42212c056992d34a10b026b60439d0012 Signed-off-by: Sooyong Suk <s.suk@samsung.com>
This commit is contained in:
committed by
Matthias Männich
parent
0fc7ac756b
commit
3a2ed8898c
@@ -273,3 +273,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_scan_control);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_continue_reclaim);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_async_psi_bypass);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_retry);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <linux/minmax.h>
|
||||
#include <linux/overflow.h>
|
||||
#include <linux/buildid.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
#include <asm/elf.h>
|
||||
#include <asm/tlb.h>
|
||||
@@ -658,6 +659,10 @@ struct mem_size_stats {
|
||||
unsigned long shmem_thp;
|
||||
unsigned long file_thp;
|
||||
unsigned long swap;
|
||||
unsigned long swap_shared;
|
||||
unsigned long writeback;
|
||||
unsigned long same;
|
||||
unsigned long huge;
|
||||
unsigned long shared_hugetlb;
|
||||
unsigned long private_hugetlb;
|
||||
unsigned long ksm;
|
||||
@@ -820,6 +825,9 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
|
||||
} else {
|
||||
mss->swap_pss += (u64)PAGE_SIZE << PSS_SHIFT;
|
||||
}
|
||||
trace_android_vh_smaps_pte_entry(swpent, mapcount,
|
||||
&mss->swap_shared, &mss->writeback,
|
||||
&mss->same, &mss->huge);
|
||||
} else if (is_pfn_swap_entry(swpent)) {
|
||||
if (is_device_private_entry(swpent))
|
||||
present = true;
|
||||
@@ -1133,6 +1141,8 @@ static void __show_smap(struct seq_file *m, const struct mem_size_stats *mss,
|
||||
SEQ_PUT_DEC(" kB\nLocked: ",
|
||||
mss->pss_locked >> PSS_SHIFT);
|
||||
seq_puts(m, " kB\n");
|
||||
trace_android_vh_show_smap(m, mss->swap_shared, mss->writeback,
|
||||
mss->same, mss->huge);
|
||||
}
|
||||
|
||||
static int show_smap(struct seq_file *m, void *v)
|
||||
|
||||
@@ -130,6 +130,16 @@ DECLARE_RESTRICTED_HOOK(android_rvh_vfree_bypass,
|
||||
DECLARE_HOOK(android_vh_cma_alloc_retry,
|
||||
TP_PROTO(char *name, int *retry),
|
||||
TP_ARGS(name, retry));
|
||||
DECLARE_HOOK(android_vh_smaps_pte_entry,
|
||||
TP_PROTO(swp_entry_t entry, int mapcount,
|
||||
unsigned long *swap_shared, unsigned long *writeback,
|
||||
unsigned long *same, unsigned long *huge),
|
||||
TP_ARGS(entry, mapcount, swap_shared, writeback, same, huge));
|
||||
DECLARE_HOOK(android_vh_show_smap,
|
||||
TP_PROTO(struct seq_file *m,
|
||||
unsigned long swap_shared, unsigned long writeback,
|
||||
unsigned long same, unsigned long huge),
|
||||
TP_ARGS(m, swap_shared, writeback, same, huge));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
Reference in New Issue
Block a user