ANDROID: mm: Reset unused page flag bits on free

Add vendor hook to reset unused bits in page flags to zero when
releasing a page. This reserves space for OEMs to define
vendor-specific features.

Bug: 420361650
Change-Id: Ife2b96de64eea670d257f1a8d9fd07d16c0ddc83
Signed-off-by: Yang Yang <yang.yang@vivo.com>
This commit is contained in:
Yang Yang
2025-06-04 12:04:42 +08:00
committed by Treehugger Robot
parent f0bd864fe0
commit 8fb77f6f9d
3 changed files with 6 additions and 0 deletions

View File

@@ -490,6 +490,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_lruvec_add_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_lruvec_del_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_add_lazyfree_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_async_mmap_readahead);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_free_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_page_mapcount);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_add_page_to_lrulist);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_del_page_from_lrulist);

View File

@@ -431,6 +431,9 @@ DECLARE_HOOK(android_vh_add_lazyfree_bypass,
DECLARE_HOOK(android_vh_do_async_mmap_readahead,
TP_PROTO(struct vm_fault *vmf, struct folio *folio, bool *skip),
TP_ARGS(vmf, folio, skip));
DECLARE_HOOK(android_vh_mm_free_page,
TP_PROTO(struct page *page),
TP_ARGS(page));
DECLARE_HOOK(android_vh_cma_debug_show_areas,
TP_PROTO(bool *show),

View File

@@ -1238,6 +1238,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
}
}
(page + i)->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
trace_android_vh_mm_free_page(page + i);
}
}
if (PageMappingFlags(page))
@@ -1253,6 +1254,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
page_cpupid_reset_last(page);
page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
trace_android_vh_mm_free_page(page);
reset_page_owner(page, order);
free_page_pinner(page, order);
page_table_check_free(page, order);