ANDROID: vendor_hook: Add hook in shmem_writepage()

Add vendor hook android_vh_set_shmem_page_flag in shmem_writepage to
set a flag in page_ext, which indicates that this page is a shmem page,
to be used in android_vh_get_swap_page. The shared page should not be
reclaimed to the extended memory, ie, the specified swap location.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: I33a9007c88b4d8aab3da044c8a05eb45d7e74f3a
This commit is contained in:
Bing Han
2022-07-11 17:12:21 +08:00
parent 8ee37d0bcd
commit 0e1cb27700
3 changed files with 6 additions and 0 deletions

View File

@@ -430,3 +430,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_swapinfo);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_shmem_page_flag);

View File

@@ -215,6 +215,9 @@ DECLARE_HOOK(android_vh_alloc_si,
DECLARE_HOOK(android_vh_free_pages,
TP_PROTO(struct page *page, unsigned int order),
TP_ARGS(page, order));
DECLARE_HOOK(android_vh_set_shmem_page_flag,
TP_PROTO(struct page *page),
TP_ARGS(page));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_MM_H */

View File

@@ -46,6 +46,7 @@
#undef CREATE_TRACE_POINTS
#include <trace/hooks/shmem_fs.h>
#include <trace/hooks/mm.h>
static struct vfsmount *shm_mnt;
@@ -1430,6 +1431,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
SetPageUptodate(page);
}
trace_android_vh_set_shmem_page_flag(page);
swap = get_swap_page(page);
if (!swap.val)
goto redirty;