ANDROID: vendor_hooks: Add hook in try_to_unmap_one()

Add hook in try_to_unmap_one() to trace this function for debug memory
swap bugs.

Bug: 198385827
Change-Id: I1fdbe60e09bb491b949e06a07133710453ecca03
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
(cherry picked from commit 955f917251d8ff9c04cf0404e35bf6be5e3666c5)
This commit is contained in:
Jiewen Wang 2021-09-06 16:55:03 +08:00 committed by Suren Baghdasaryan
parent 73c9d4a9d5
commit 5a70133feb
3 changed files with 7 additions and 0 deletions

View File

@ -306,3 +306,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_check_status);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_alloc_rqs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_rq_ctx_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);

View File

@ -39,6 +39,9 @@ DECLARE_HOOK(android_vh_pcplist_add_cma_pages_bypass,
DECLARE_HOOK(android_vh_mmap_region,
TP_PROTO(struct vm_area_struct *vma, unsigned long addr),
TP_ARGS(vma, addr));
DECLARE_HOOK(android_vh_try_to_unmap_one,
TP_PROTO(struct vm_area_struct *vma, struct page *page, unsigned long addr, bool ret),
TP_ARGS(vma, page, addr, ret));
#endif /* _TRACE_HOOK_MM_H */

View File

@ -79,6 +79,8 @@
#include <trace/events/tlb.h>
#include <trace/hooks/mm.h>
#include "internal.h"
static struct kmem_cache *anon_vma_cachep;
@ -1674,6 +1676,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
}
mmu_notifier_invalidate_range_end(&range);
trace_android_vh_try_to_unmap_one(vma, page, address, ret);
return ret;
}