android: binder: use VM_ALLOC to get vm area.
PATCH 1/1 android: binder: use VM_ALLOC to get vm area.
VM_IOREMAP is used to access hardware through a mechanism called I/O mapped memory. Android binder is a IPC machanism which will not access I/O memory.
Also VM_IOREMAP has alignment requiement which may not needed in binder.
----__get_vm_area_node()
{
...
if (flags & VM_IOREMAP)
align = 1ul << clamp_t(int, fls_long(size),
PAGE_SHIFT, IOREMAP_MAX_ORDER);...
}
----
This patch use VM_ALLOC to get vm area.
--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
@@ -2885,7 +2885,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) goto err_already_mapped; } - area =get_vm_area (vma->vm_end - vma->vm_start,VM_IOREMAP ); + area =get_vm_area (vma->vm_end - vma->vm_start,VM_ALLOC );if (area ==NULL ) { ret = -ENOMEM ; failure_string ="get_vm_area" ;
Signature · 1 line
1.9.1
Arve Hjønnevåg
maintainerQuoted 47 lines · Greg KH
Quoted 29 lines · Ganesh Mahendran
VM_IOREMAPis used to access hardware through a mechanism called I/O mapped memory. Android binder is a IPC machanism which will not access I/O memory.Also
VM_IOREMAPhas alignment requiement which may not needed in binder.
----__get_vm_area_node()
{
...if (flags & VM_IOREMAP) align = 1ul << clamp_t(int, fls_long(size), PAGE_SHIFT, IOREMAP_MAX_ORDER);...
}
----This patch use
VM_ALLOCto get vm area.Signed-off-by Ganesh Mahendran <[email protected]>--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/android/binder.c +0
-0drivers/android/binder.c static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · line 2891
Quoted 8 lines
drivers/android/binder.c +1
-1@@ -2885,7 +2885,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) goto err_already_mapped; } - area =get_vm_area (vma->vm_end - vma->vm_start,VM_IOREMAP ); + area =get_vm_area (vma->vm_end - vma->vm_start,VM_ALLOC );if (area ==NULL ) { ret = -ENOMEM ; failure_string ="get_vm_area" ;What change have you noticed with this patch? Have you tested it? Found that previously reserved iomemory is now free for binder to use where it wasn't? What kind of change does the system now run as because of this?
And are you _sure_ the alignment requirement isn't needed for binder? Have you verified this with the userspace binder library?
Quoted 6 lines
This is messy, tricky, stuff, I'm loath to change it without loads of testing having happened...
thanks,
greg k-h
There is no alignment requirement on this area unless cache_is_vipt_aliasing returns true. In that case the area needs to be aligned with vma->vm_start which is done manually in the code right after this allocation. If there are no other side effects of changing this flag this change should be safe, but please run all the tests at
https://android.googlesource.com/platform/frameworks/native/+/master/libs/binder/tests/
to test it.
Signature · 1 line
Arve Hjønnevåg
Greg KH
maintainerQuoted 29 lines · Ganesh Mahendran
VM_IOREMAPis used to access hardware through a mechanism called I/O mapped memory. Android binder is a IPC machanism which will not access I/O memory.Also
VM_IOREMAPhas alignment requiement which may not needed in binder.
----__get_vm_area_node()
{
...if (flags & VM_IOREMAP) align = 1ul << clamp_t(int, fls_long(size), PAGE_SHIFT, IOREMAP_MAX_ORDER);...
}
----This patch use
VM_ALLOCto get vm area.Signed-off-by Ganesh Mahendran <[email protected]>--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/android/binder.c +0
-0
drivers/android/binder.c static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · line 2891
Quoted 8 lines
drivers/android/binder.c +1
-1@@ -2885,7 +2885,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) goto err_already_mapped; } - area =get_vm_area (vma->vm_end - vma->vm_start,VM_IOREMAP ); + area =get_vm_area (vma->vm_end - vma->vm_start,VM_ALLOC );if (area ==NULL ) { ret = -ENOMEM ; failure_string ="get_vm_area" ;
What change have you noticed with this patch? Have you tested it? Found that previously reserved iomemory is now free for binder to use where it wasn't? What kind of change does the system now run as because of this?
And are you _sure_ the alignment requirement isn't needed for binder? Have you verified this with the userspace binder library?
This is messy, tricky, stuff, I'm loath to change it without loads of testing having happened...
thanks,
greg k-h
Hi, Greg:
2016-09-02 3:02 GMT+08:00 Greg KH <[email protected]>:
Quoted 33 lines · Ganesh Mahendran
Quoted 32 lines
VM_IOREMAPis used to access hardware through a mechanism called I/O mapped memory. Android binder is a IPC machanism which will not access I/O memory.Also
VM_IOREMAPhas alignment requiement which may not needed in binder.
----__get_vm_area_node()
{
...if (flags & VM_IOREMAP) align = 1ul << clamp_t(int, fls_long(size), PAGE_SHIFT, IOREMAP_MAX_ORDER);...
}
----This patch use
VM_ALLOCto get vm area.Signed-off-by Ganesh Mahendran <[email protected]>--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/android/binder.c +0
-0@@ -2885,7 +2885,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) goto err_already_mapped; }
Quoted 10 lines
drivers/android/binder.c static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · line 2891
Quoted 5 lines
drivers/android/binder.c +1
-1- area =get_vm_area (vma->vm_end - vma->vm_start,VM_IOREMAP ); + area =get_vm_area (vma->vm_end - vma->vm_start,VM_ALLOC );if (area ==NULL ) { ret = -ENOMEM ; failure_string ="get_vm_area" ;What change have you noticed with this patch? Have you tested it? Found that previously reserved iomemory is now free for binder to use where it wasn't? What kind of change does the system now run as because of this?
I did some sanity test in Android system. I will do more test using:
https://android.googlesource.com/platform/frameworks/native/+/master/libs/binder/tests/
Quoted 3 lines
And are you _sure_ the alignment requirement isn't needed for binder? Have you verified this with the userspace binder library?
I will do the binder test.
Thanks.
Quoted 7 lines
This is messy, tricky, stuff, I'm loath to change it without loads of testing having happened...
thanks,
greg k-h
2016-09-02 3:59 GMT+08:00 Arve Hjønnevåg <[email protected]>:
Quoted 55 lines · Greg KH
Quoted 47 lines · Ganesh Mahendran
Quoted 29 lines
VM_IOREMAPis used to access hardware through a mechanism called I/O mapped memory. Android binder is a IPC machanism which will not access I/O memory.Also
VM_IOREMAPhas alignment requiement which may not needed in binder.
----__get_vm_area_node()
{
...if (flags & VM_IOREMAP) align = 1ul << clamp_t(int, fls_long(size), PAGE_SHIFT, IOREMAP_MAX_ORDER);...
}
----This patch use
VM_ALLOCto get vm area.Signed-off-by Ganesh Mahendran <[email protected]>--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/android/binder.c +0
-0drivers/android/binder.c static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · line 2891
Quoted 8 lines
drivers/android/binder.c +1
-1@@ -2885,7 +2885,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) goto err_already_mapped; } - area =get_vm_area (vma->vm_end - vma->vm_start,VM_IOREMAP ); + area =get_vm_area (vma->vm_end - vma->vm_start,VM_ALLOC );if (area ==NULL ) { ret = -ENOMEM ; failure_string ="get_vm_area" ;What change have you noticed with this patch? Have you tested it? Found that previously reserved iomemory is now free for binder to use where it wasn't? What kind of change does the system now run as because of this?
And are you _sure_ the alignment requirement isn't needed for binder? Have you verified this with the userspace binder library?
Quoted 6 lines
This is messy, tricky, stuff, I'm loath to change it without loads of testing having happened...
thanks,
greg k-h
Quoted 7 lines
There is no alignment requirement on this area unless
cache_is_vipt_aliasingreturns true. In that case the area needs to be aligned withvma->vm_startwhich is done manually in the code right after this allocation. If there are no other side effects of changing this flag this change should be safe, but please run all the tests at
https://android.googlesource.com/platform/frameworks/native/+/master/libs/binder/tests/
to test it.
Thanks for your suggestion.
I only did some android app performance test. I will do more binder test.
Thanks.
Quoted 3 lines
--
Arve Hjønnevåg