ANDROID: vendor_hook: Add hooks in unuse_pte_range() and try_to_unuse()

When the page is unused, a vendor hook android_vh_unuse_swap_page
should be called to specify that the page should not be swapped
to the specified swap location any more.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: I3fc3675020517f7cc69c76a06150dfb2380dae21
This commit is contained in:
Bing Han
2022-06-10 18:53:44 +08:00
committed by Treehugger Robot
parent 7222a0b29b
commit bc4c73c182
3 changed files with 6 additions and 0 deletions

View File

@@ -421,3 +421,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page);

View File

@@ -185,6 +185,9 @@ DECLARE_HOOK(android_vh_page_isolated_for_reclaim,
DECLARE_HOOK(android_vh_account_swap_pages, DECLARE_HOOK(android_vh_account_swap_pages,
TP_PROTO(struct swap_info_struct *si, bool *skip), TP_PROTO(struct swap_info_struct *si, bool *skip),
TP_ARGS(si, skip)); TP_ARGS(si, skip));
DECLARE_HOOK(android_vh_unuse_swap_page,
TP_PROTO(struct swap_info_struct *si, struct page *page),
TP_ARGS(si, page));
/* macro versions of hooks are no longer required */ /* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_MM_H */ #endif /* _TRACE_HOOK_MM_H */

View File

@@ -2014,6 +2014,7 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
} }
try_to_free_swap(page); try_to_free_swap(page);
trace_android_vh_unuse_swap_page(si, page);
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
@@ -2252,6 +2253,7 @@ retry:
lock_page(page); lock_page(page);
wait_on_page_writeback(page); wait_on_page_writeback(page);
try_to_free_swap(page); try_to_free_swap(page);
trace_android_vh_unuse_swap_page(si, page);
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);