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).

Bug: 284059805

Change-Id: Ie4a48ae42212c056992d34a10b026b60439d0012
Signed-off-by: Sooyong Suk <s.suk@samsung.com>
This commit is contained in:
Sooyong Suk 2023-05-24 09:34:19 +09:00 committed by Suren Baghdasaryan
parent aee36dd530
commit 847b3f6c96
3 changed files with 18 additions and 0 deletions

View file

@ -287,3 +287,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_pageout_swap_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_swapin_walk_pmd_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_madvise_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap);

View file

@ -19,6 +19,7 @@
#include <linux/shmem_fs.h>
#include <linux/uaccess.h>
#include <linux/pkeys.h>
#include <trace/hooks/mm.h>
#include <asm/elf.h>
#include <asm/tlb.h>
@ -403,6 +404,9 @@ struct mem_size_stats {
unsigned long shmem_thp;
unsigned long file_thp;
unsigned long swap;
unsigned long writeback;
unsigned long same;
unsigned long huge;
unsigned long shared_hugetlb;
unsigned long private_hugetlb;
u64 pss;
@ -552,6 +556,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,
&mss->writeback,
&mss->same, &mss->huge);
} else if (is_pfn_swap_entry(swpent)) {
if (is_migration_entry(swpent))
migration = true;
@ -844,6 +851,7 @@ 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->writeback, mss->same, mss->huge);
}
static int show_smap(struct seq_file *m, void *v)

View file

@ -81,6 +81,14 @@ DECLARE_HOOK(android_vh_madvise_swapin_walk_pmd_entry,
DECLARE_HOOK(android_vh_process_madvise_end,
TP_PROTO(int behavior, ssize_t *ret),
TP_ARGS(behavior, ret));
DECLARE_HOOK(android_vh_smaps_pte_entry,
TP_PROTO(swp_entry_t entry, unsigned long *writeback,
unsigned long *same, unsigned long *huge),
TP_ARGS(entry, writeback, same, huge));
DECLARE_HOOK(android_vh_show_smap,
TP_PROTO(struct seq_file *m, unsigned long writeback,
unsigned long same, unsigned long huge),
TP_ARGS(m, writeback, same, huge));
#endif /* _TRACE_HOOK_MM_H */