PD#TV-3541
Problem:
1.only vmalloc 4KB at first.
2.if user space need more memory, try to allocate a new vmalloc
range with large size and move all related data to new place.
3.the first 4KB is not free when release this binder.
Solution:
free the first 4KB when release binder.
Verify:
R311
Change-Id: I4429de04a260671e4626b77ec340e47e436d5c8d
Signed-off-by: changqing.gao <changqing.gao@amlogic.com>
goto err_get_vm_area_failed;
}
alloc->buffer = area->addr;
+#ifdef CONFIG_AMLOGIC_BINDER_VMALLOC
+ alloc->first_addr = area->addr;
+#endif
alloc->user_buffer_offset =
vma->vm_start - (uintptr_t)alloc->buffer;
mutex_unlock(&binder_alloc_mmap_lock);
vfree(alloc->buffer);
#ifdef CONFIG_AMLOGIC_BINDER_VMALLOC
free_back_buffer(alloc);
+ if (alloc->first_addr && alloc->first_addr != alloc->buffer)
+ vfree(alloc->first_addr);
#endif
}
mutex_unlock(&alloc->mutex);
#ifdef CONFIG_AMLOGIC_BINDER_VMALLOC
size_t mapped_size;
void *back_buffer[MAX_BUFFER];
+ void *first_addr;
#endif /* CONFIG_AMLOGIC_BINDER_VMALLOC */
ptrdiff_t user_buffer_offset;
struct list_head buffers;