ANDROID: vendor_hook: Add hook to not be stuck ro rmap lock in kswapd or direct_reclaim

Add hooks to support trylock in rmaplock when reclaiming in kswapd or
direct_reclaim, in order to avoid wait lock for a long time.

- android_vh_handle_failed_page_trylock
- android_vh_page_trylock_set
- android_vh_page_trylock_clear
- android_vh_page_trylock_get_result
- android_vh_do_page_trylock

Bug: 240003372

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0f605b35ae41f15b3ca7bc72cd5f003175c318a5
This commit is contained in:
Peifeng Li
2022-07-24 13:47:14 +08:00
parent 91bfc78bc0
commit 1f8f6d59a2
5 changed files with 53 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
#include <linux/oom.h>
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#include <linux/rwsem.h>
#ifdef __GENKSYMS__
struct slabinfo;
@@ -148,6 +149,10 @@ DECLARE_HOOK(android_vh_mmap_region,
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));
DECLARE_HOOK(android_vh_do_page_trylock,
TP_PROTO(struct page *page, struct rw_semaphore *sem,
bool *got_lock, bool *success),
TP_ARGS(page, sem, got_lock, success));
DECLARE_HOOK(android_vh_drain_all_pages_bypass,
TP_PROTO(gfp_t gfp_mask, unsigned int order, unsigned long alloc_flags,
int migratetype, unsigned long did_some_progress,