ANDROID: add vendor hook for mapping_shrinkable

To control inode memory reclaim, add restricted vendor hook.

Bug: 347958166
Change-Id: Iefb9ef66c9fd5abae99adb1200263e4642f991cc
Signed-off-by: Minchan Kim <minchan@google.com>
This commit is contained in:
Minchan Kim
2024-08-12 17:24:05 +00:00
parent 660e1a2695
commit bbf690e531
4 changed files with 16 additions and 0 deletions

View File

@@ -336,6 +336,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_madvise_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_madvise_pageout_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_madvise_pageout_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_reclaim_folio_list);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mapping_shrinkable);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate);

View File

@@ -137,6 +137,8 @@ static inline bool mapping_empty(struct address_space *mapping)
return xa_empty(&mapping->i_pages);
}
extern void _trace_android_rvh_mapping_shrinkable(bool *shrinkable);
/*
* mapping_shrinkable - test if page cache state allows inode reclaim
* @mapping: the page cache mapping
@@ -161,7 +163,11 @@ static inline bool mapping_empty(struct address_space *mapping)
static inline bool mapping_shrinkable(struct address_space *mapping)
{
void *head;
bool shrinkable = false;
_trace_android_rvh_mapping_shrinkable(&shrinkable);
if (shrinkable)
return true;
/*
* On highmem systems, there could be lowmem pressure from the
* inodes before there is highmem pressure from the page

View File

@@ -112,6 +112,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_madvise_pageout_end,
DECLARE_RESTRICTED_HOOK(android_rvh_reclaim_folio_list,
TP_PROTO(struct list_head *folio_list, void *private),
TP_ARGS(folio_list, private), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_mapping_shrinkable,
TP_PROTO(bool *shrinkable),
TP_ARGS(shrinkable), 1);
DECLARE_HOOK(android_vh_smaps_pte_entry,
TP_PROTO(swp_entry_t entry, unsigned long *writeback,
unsigned long *same, unsigned long *huge),

View File

@@ -60,6 +60,12 @@
#include <asm/mman.h>
void _trace_android_rvh_mapping_shrinkable(bool *shrinkable)
{
trace_android_rvh_mapping_shrinkable(shrinkable);
}
EXPORT_SYMBOL_GPL(_trace_android_rvh_mapping_shrinkable);
/*
* Shared mappings implemented 30.11.1994. It's not fully working yet,
* though.