Binder内存分配方法通过binder_alloc_buf()方法,内存管理单元为binder_buffffer结构体,只有 在binder_transaction过程中才需要分配buffffer。具体代码在/kernel/drivers/android/binder.c 678行,我选取了重点部分 static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, size_t data_size, size...
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, "%d: binder_alloc_buf size %zd got %p\n", proc->pid, size, buffer); buffer->data_size = data_size; buffer->offsets_size = offsets_size; buffer->async_transaction = is_async; if (is_async) { proc->free_async_space -= size + sizeof(stru...
if(is_async && proc->free_async_space < size +sizeof(structbinder_buffer)) { //对于oneway的Binder调用,可申请内核空间,最大上限是buffer_size的一半,也就是mmap时候传递的值的一半。 binder_debug(BINDER_DEBUG_BUFFER_ALLOC, "%d: binder_alloc_buf size %zd failed, no async space left\n", proc...
static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, size_t data_size, size_t offsets_size, int is_async) { //省略部分代码 if (is_async && proc->free_async_space < size + sizeof(struct binder_buffer)) { //对于oneway的Binder调用,可申请内核空间,最大上限是buffer_...
binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC, "%d: binder_alloc_buf size %zd async free %zd\n", proc->pid, size, proc->free_async_space); } 下面我们再来看看内存的释放。 BC_FREE_BUFFER命令是通知驱动进行内存的释放,binder_free_buf函数是真正实现的逻辑,这个函数与binder_alloc_buf是刚好对应的...
binder_alloc: 6756: binder_alloc_buf, no vma 这个错误表示进程6756试图分配一个binder buffer,但是没有找到对应的binder_vma。这可能是因为进程6756已经退出,或者没有正确地初始化binder_vma。 binder: 361:1322 transaction failed 29189/-3, size 84-0 line 3480 ...
"%d: binder_alloc_buf size %zd failed, no async space left\n", alloc->pid, size); return ERR_PTR(-ENOSPC); } /* Pad 0-size buffers so they get assigned unique addresses */ size = max(size, sizeof(void *));//这个就是总的size 大小,就算没数据,也至少是一个void* 大小 ...
size_t buffer_size; struct rb_node *best_fit = NULL; void *has_page_addr; void *end_page_addr; size_t size; if (proc->vma == NULL) { printk(KERN_ERR "binder: %d: binder_alloc_buf, no vma\n", proc->pid); return NULL; ...
(is_async&&proc->free_async_space<size+sizeof(struct binder_buffer)){//对于oneway的Binder调用,可申请内核空间,最大上限是buffer_size的一半,也就是mmap时候传递的值的一半。binder_debug(BINDER_DEBUG_BUFFER_ALLOC,"%d: binder_alloc_buf size %zd failed, no async space left\n",proc->pid,size);...
//proc->pid, size, proc->free_async_space binder: 1788: binder_alloc_buf size 148 async free 520004 binder: 1788: binder_free_buf size 148 async free 520192解析:binder_alloc_buf:进程1788,申请148 Bytes,则该进程的可用异步空间大小520004 Bytes; binder_free_buf: 进程1788,释放148 Bytes,则该...