ANDROID: mm: add vendor hook to allow nonworkingset for gcma

Gcma put page is only allowing workingset pages by default to increase
cleancache hit ratio. On my device, the utilization ratio of the gcma area
as cached pages is really low like almost zero. So I'd like to add a vendor
hook to allow non-workingset pages when gcma usage is low.

Bug: 433652944
Change-Id: I43a3900db416b2af6758d8b8905299eba0e38f39
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk
2025-07-24 08:54:46 +09:00
committed by Treehugger Robot
parent cab1c94446
commit b85940e9ff
3 changed files with 9 additions and 3 deletions
+1
View File
@@ -581,6 +581,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gcma_cc_allow_nonworkingset);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gcma_cc_store_page_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gzvm_vcpu_exit_reason);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gzvm_handle_demand_page_pre);
+3
View File
@@ -540,6 +540,9 @@ DECLARE_HOOK(android_vh_filemap_add_folio,
TP_PROTO(struct address_space *mapping, struct folio *folio,
pgoff_t index),
TP_ARGS(mapping, folio, index));
DECLARE_HOOK(android_vh_gcma_cc_allow_nonworkingset,
TP_PROTO(bool *allow_nonworkingset),
TP_ARGS(allow_nonworkingset));
DECLARE_HOOK(android_vh_gcma_cc_store_page_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
+5 -3
View File
@@ -752,6 +752,7 @@ static void gcma_cc_store_page(int hash_id, struct cleancache_filekey key,
bool is_new = false;
bool workingset = PageWorkingset(page);
bool bypass = false;
bool allow_nonworkingset = false;
trace_android_vh_gcma_cc_store_page_bypass(&bypass);
if (bypass)
@@ -767,10 +768,11 @@ static void gcma_cc_store_page(int hash_id, struct cleancache_filekey key,
if (!gcma_fs)
return;
trace_android_vh_gcma_cc_allow_nonworkingset(&allow_nonworkingset);
find_inode:
inode = find_and_get_gcma_inode(gcma_fs, &key);
if (!inode) {
if (!workingset)
if (!workingset && !allow_nonworkingset)
return;
inode = add_gcma_inode(gcma_fs, &key);
if (!IS_ERR(inode))
@@ -789,14 +791,14 @@ load_page:
xa_lock(&inode->pages);
g_page = xa_load(&inode->pages, offset);
if (g_page) {
if (!workingset) {
if (!workingset && !allow_nonworkingset) {
gcma_erase_page(inode, offset, g_page, true);
goto out_unlock;
}
goto copy;
}
if (!workingset)
if (!workingset && !allow_nonworkingset)
goto out_unlock;
g_page = gcma_alloc_page();