ANDROID: vendor_hooks: protect multi-mapcount pages in kernel
Support two hooks as follows to protect multi-mapcount pages in kernel: - trace_android_vh_page_should_be_protect - trace_android_vh_mapped_page_try_sorthead Bug: 236578020 Signed-off-by: Peifeng Li <lipeifeng@oppo.com> Change-Id: I688aceabf17d9de2feac7c3ad7144d307de6ef29
This commit is contained in:
parent
3f775b9367
commit
e56f8712cf
@ -398,6 +398,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);
|
||||
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);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_should_be_protected);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mark_page_accessed);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_id_remove);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_offline);
|
||||
|
@ -169,6 +169,12 @@ DECLARE_HOOK(android_vh_show_mapcount_pages,
|
||||
DECLARE_HOOK(android_vh_do_traversal_lruvec,
|
||||
TP_PROTO(struct lruvec *lruvec),
|
||||
TP_ARGS(lruvec));
|
||||
DECLARE_HOOK(android_vh_page_should_be_protected,
|
||||
TP_PROTO(struct page *page, bool *should_protect),
|
||||
TP_ARGS(page, should_protect));
|
||||
DECLARE_HOOK(android_vh_mark_page_accessed,
|
||||
TP_PROTO(struct page *page),
|
||||
TP_ARGS(page));
|
||||
DECLARE_HOOK(android_vh_cma_drain_all_pages_bypass,
|
||||
TP_PROTO(unsigned int migratetype, bool *bypass),
|
||||
TP_ARGS(migratetype, bypass));
|
||||
|
@ -437,6 +437,7 @@ void mark_page_accessed(struct page *page)
|
||||
{
|
||||
page = compound_head(page);
|
||||
|
||||
trace_android_vh_mark_page_accessed(page);
|
||||
if (!PageReferenced(page)) {
|
||||
SetPageReferenced(page);
|
||||
} else if (PageUnevictable(page)) {
|
||||
|
13
mm/vmscan.c
13
mm/vmscan.c
@ -1020,6 +1020,11 @@ static enum page_references page_check_references(struct page *page,
|
||||
{
|
||||
int referenced_ptes, referenced_page;
|
||||
unsigned long vm_flags;
|
||||
bool should_protect = false;
|
||||
|
||||
trace_android_vh_page_should_be_protected(page, &should_protect);
|
||||
if (unlikely(should_protect))
|
||||
return PAGEREF_ACTIVATE;
|
||||
|
||||
referenced_ptes = page_referenced(page, 1, sc->target_mem_cgroup,
|
||||
&vm_flags);
|
||||
@ -2057,6 +2062,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
|
||||
int file = is_file_lru(lru);
|
||||
struct pglist_data *pgdat = lruvec_pgdat(lruvec);
|
||||
bool bypass = false;
|
||||
bool should_protect = false;
|
||||
|
||||
lru_add_drain();
|
||||
|
||||
@ -2091,6 +2097,13 @@ static void shrink_active_list(unsigned long nr_to_scan,
|
||||
}
|
||||
}
|
||||
|
||||
trace_android_vh_page_should_be_protected(page, &should_protect);
|
||||
if (unlikely(should_protect)) {
|
||||
nr_rotated += thp_nr_pages(page);
|
||||
list_add(&page->lru, &l_active);
|
||||
continue;
|
||||
}
|
||||
|
||||
trace_android_vh_page_referenced_check_bypass(page, nr_to_scan, lru, &bypass);
|
||||
if (bypass)
|
||||
goto skip_page_referenced;
|
||||
|
Loading…
Reference in New Issue
Block a user