diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c51478a185cc..cd688e896239 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2490,6 +2490,7 @@ static int binder_proc_transaction(struct binder_transaction *t, struct binder_priority node_prio; bool oneway = !!(t->flags & TF_ONE_WAY); bool pending_async = false; + bool skip = false; BUG_ON(!node); binder_node_lock(node); @@ -2517,7 +2518,10 @@ static int binder_proc_transaction(struct binder_transaction *t, return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY; } - if (!thread && !pending_async) + trace_android_vh_binder_proc_transaction_entry(proc, t, + &thread, node->debug_id, pending_async, !oneway, &skip); + + if (!thread && !pending_async && !skip) thread = binder_select_thread_ilocked(proc); trace_android_vh_binder_proc_transaction(current, proc->tsk, @@ -4032,6 +4036,10 @@ retry: size_t trsize = sizeof(*trd); binder_inner_proc_lock(proc); + trace_android_vh_binder_select_worklist_ilocked(&list, thread, + proc, wait_for_proc_work); + if (list) + goto skip; if (!binder_worklist_empty_ilocked(&thread->todo)) list = &thread->todo; else if (!binder_worklist_empty_ilocked(&proc->todo) && @@ -4045,7 +4053,7 @@ retry: goto retry; break; } - +skip: if (end - ptr < sizeof(tr) + 4) { binder_inner_proc_unlock(proc); break; diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ef6b8e851608..f8d55c68584c 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -277,8 +277,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_binder_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_select_worklist_ilocked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); @@ -289,6 +291,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf_pr_cont); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_slab_bypass); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_check_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork); diff --git a/fs/incfs/data_mgmt.c b/fs/incfs/data_mgmt.c index a383c5b5ad7f..fbab68a280d5 100644 --- a/fs/incfs/data_mgmt.c +++ b/fs/incfs/data_mgmt.c @@ -175,7 +175,6 @@ void incfs_free_mount_info(struct mount_info *mi) kfree(mi->pseudo_file_xattr[i].data); kfree(mi->mi_per_uid_read_timeouts); incfs_free_sysfs_node(mi->mi_sysfs_node); - kfree(mi->mi_options.sysfs_name); kfree(mi); } diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index 42d974f76573..a5c090f38388 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -59,6 +59,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction, DECLARE_HOOK(android_vh_binder_preset, TP_PROTO(struct hlist_head *hhead, struct mutex *lock), TP_ARGS(hhead, lock)); +DECLARE_HOOK(android_vh_binder_proc_transaction_entry, + TP_PROTO(struct binder_proc *proc, struct binder_transaction *t, + struct binder_thread **thread, int node_debug_id, bool pending_async, + bool sync, bool *skip), + TP_ARGS(proc, t, thread, node_debug_id, pending_async, sync, skip)); DECLARE_HOOK(android_vh_binder_proc_transaction, TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, struct task_struct *binder_th_task, int node_debug_id, @@ -69,6 +74,10 @@ DECLARE_HOOK(android_vh_binder_proc_transaction_end, struct task_struct *binder_th_task, unsigned int code, bool pending_async, bool sync), TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync)); +DECLARE_HOOK(android_vh_binder_select_worklist_ilocked, + TP_PROTO(struct list_head **list, struct binder_thread *thread, struct binder_proc *proc, + int wait_for_proc_work), + TP_ARGS(list, thread, proc, wait_for_proc_work)); DECLARE_HOOK(android_vh_binder_new_ref, TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id), TP_ARGS(proc, ref_desc, node_debug_id)); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index ecbff00093ee..95fb17af29e8 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -25,6 +25,10 @@ DECLARE_HOOK(android_vh_tune_inactive_ratio, DECLARE_RESTRICTED_HOOK(android_rvh_set_balance_anon_file_reclaim, TP_PROTO(bool *balance_anon_file_reclaim), TP_ARGS(balance_anon_file_reclaim), 1); +DECLARE_HOOK(android_vh_page_referenced_check_bypass, + TP_PROTO(struct page *page, unsigned long nr_to_scan, int lru, bool *bypass), + TP_ARGS(page, nr_to_scan, lru, bypass)); + #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5b9b465582d6..845a88712f0b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4476,13 +4476,12 @@ __perform_reclaim(gfp_t gfp_mask, unsigned int order, const struct alloc_context *ac) { unsigned int noreclaim_flag; - unsigned long pflags, progress; + unsigned long progress; cond_resched(); /* We now go into synchronous reclaim */ cpuset_memory_pressure_bump(); - psi_memstall_enter(&pflags); fs_reclaim_acquire(gfp_mask); noreclaim_flag = memalloc_noreclaim_save(); @@ -4491,7 +4490,6 @@ __perform_reclaim(gfp_t gfp_mask, unsigned int order, memalloc_noreclaim_restore(noreclaim_flag); fs_reclaim_release(gfp_mask); - psi_memstall_leave(&pflags); cond_resched(); @@ -4505,11 +4503,13 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, unsigned long *did_some_progress) { struct page *page = NULL; + unsigned long pflags; bool drained = false; + psi_memstall_enter(&pflags); *did_some_progress = __perform_reclaim(gfp_mask, order, ac); if (unlikely(!(*did_some_progress))) - return NULL; + goto out; retry: page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); @@ -4525,6 +4525,8 @@ retry: drained = true; goto retry; } +out: + psi_memstall_leave(&pflags); return page; } diff --git a/mm/vmscan.c b/mm/vmscan.c index 3f5a834dd764..46d8e65071d8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2083,6 +2083,7 @@ static void shrink_active_list(unsigned long nr_to_scan, unsigned nr_rotated = 0; int file = is_file_lru(lru); struct pglist_data *pgdat = lruvec_pgdat(lruvec); + bool bypass = false; lru_add_drain(); @@ -2117,6 +2118,10 @@ static void shrink_active_list(unsigned long nr_to_scan, } } + trace_android_vh_page_referenced_check_bypass(page, nr_to_scan, lru, &bypass); + if (bypass) + goto skip_page_referenced; + if (page_referenced(page, 0, sc->target_mem_cgroup, &vm_flags)) { /* @@ -2134,7 +2139,7 @@ static void shrink_active_list(unsigned long nr_to_scan, continue; } } - +skip_page_referenced: ClearPageActive(page); /* we are de-activating */ SetPageWorkingset(page); list_add(&page->lru, &l_inactive);