ANDROID: vendor_hooks: Add hook for binder_detect_low_async_space_locked
Add hook for binder_detect_low_async_space_locked, which gives the vendor a choice whether or not this alloc new buf should go on or not Bug: 322915513 Change-Id: Ie7f1567dae6dee0fb22b014cd1eacc3308ccb205 Signed-off-by: chenweitao <chenweitao@oppo.com>
This commit is contained in:
parent
7b6a6228df
commit
7ce117301e
@ -383,6 +383,7 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
|
||||
void __user *end_page_addr;
|
||||
size_t size, data_offsets_size;
|
||||
int ret;
|
||||
bool should_fail = false;
|
||||
|
||||
/* Check binder_alloc is fully initialized */
|
||||
if (!binder_alloc_get_vma(alloc)) {
|
||||
@ -409,6 +410,13 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
trace_android_vh_binder_alloc_new_buf_locked(size, &alloc->free_async_space, is_async);
|
||||
trace_android_vh_binder_detect_low_async_space_locked(is_async, &alloc->free_async_space, pid, &should_fail);
|
||||
if (should_fail) {
|
||||
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
|
||||
"%d: binder_alloc_buf size %zd failed, not allowed to alloc more async space\n",
|
||||
alloc->pid, size);
|
||||
return ERR_PTR(-EPERM);
|
||||
}
|
||||
if (is_async &&
|
||||
alloc->free_async_space < size + sizeof(struct binder_buffer)) {
|
||||
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
|
||||
|
@ -375,3 +375,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_ioctl_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_looper_exited);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_spawn_new_thread);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_has_special_work_ilocked);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_detect_low_async_space_locked);
|
||||
|
@ -82,6 +82,10 @@ DECLARE_HOOK(android_vh_binder_select_special_worklist,
|
||||
DECLARE_HOOK(android_vh_binder_alloc_new_buf_locked,
|
||||
TP_PROTO(size_t size, size_t *free_async_space, int is_async),
|
||||
TP_ARGS(size, free_async_space, is_async));
|
||||
|
||||
DECLARE_HOOK(android_vh_binder_detect_low_async_space_locked,
|
||||
TP_PROTO(int is_async, size_t *free_async_space, int pid, bool *should_fail),
|
||||
TP_ARGS(is_async, free_async_space, pid, should_fail));
|
||||
struct binder_transaction_data;
|
||||
DECLARE_HOOK(android_vh_binder_reply,
|
||||
TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc,
|
||||
|
Loading…
Reference in New Issue
Block a user