drm/amdgpu: Use drm_calloc_large for VM page_tables array
Subsystems (2)
PATCH 1/1 drm/amdgpu: Use drm_calloc_large for VM page_tables array
From: Michel Dänzer <[email protected]>
It can be big, depending on the VM address space size, which is tunable via the vm_size module parameter.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93721
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -4
@@ -1282,7 +1282,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) {const unsigned align =min (AMDGPU_VM_PTB_ALIGN_SIZE ,AMDGPU_VM_PTE_COUNT *8 ); -unsigned pd_size, pd_entries, pts_size; +unsigned pd_size, pd_entries;int i, r;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {
@@ -1300,8 +1300,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) pd_entries =amdgpu_vm_num_pdes (adev);/* allocate page table array */ - pts_size = pd_entries *sizeof (struct amdgpu_vm_pt ); - vm->page_tables =kzalloc (pts_size,GFP_KERNEL ); + vm->page_tables =drm_calloc_large (pd_entries,sizeof (struct amdgpu_vm_pt ));if (vm->page_tables ==NULL ) {DRM_ERROR ("Cannot allocate memory for page table array\n" );return -ENOMEM ;
@@ -1361,7 +1360,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)for (i =0 ; i <amdgpu_vm_num_pdes (adev); i++)amdgpu_bo_unref (&vm->page_tables[i].entry.robj); -kfree (vm->page_tables); +drm_free_large (vm->page_tables);amdgpu_bo_unref (&vm->page_directory);fence_put (vm->page_directory_fence);
Signature · 6 lines
2.7.0.rc3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 19.01.2016 um 09:59 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
It can be big, depending on the VM address space size, which is tunable via the
vm_sizemodule parameter.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93721
Signed-off-by Michel Dänzer <[email protected]>
I actually wanted to address this by reducing sizeof(struct amdgpu_vm_pt), but once more never got the time to do so.
Patch is Reviewed-by: Christian König <[email protected]>
Quoted 28 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-3@@ -1282,7 +1282,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) {const unsigned align =min (AMDGPU_VM_PTB_ALIGN_SIZE ,AMDGPU_VM_PTE_COUNT *8 ); -unsigned pd_size, pd_entries, pts_size; +unsigned pd_size, pd_entries;int i, r;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {@@ -1300,8 +1300,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) pd_entries =amdgpu_vm_num_pdes (adev);/* allocate page table array */ - pts_size = pd_entries *sizeof (struct amdgpu_vm_pt ); - vm->page_tables =kzalloc (pts_size,GFP_KERNEL ); + vm->page_tables =drm_calloc_large (pd_entries,sizeof (struct amdgpu_vm_pt ));if (vm->page_tables ==NULL ) {DRM_ERROR ("Cannot allocate memory for page table array\n" );return -ENOMEM ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · line 1366
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -1361,7 +1360,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)for (i =0 ; i <amdgpu_vm_num_pdes (adev); i++)amdgpu_bo_unref (&vm->page_tables[i].entry.robj); -kfree (vm->page_tables); +drm_free_large (vm->page_tables);amdgpu_bo_unref (&vm->page_directory);fence_put (vm->page_directory_fence);
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedQuoted 7 lines · Christian König
Am 19.01.2016 um 09:59 schrieb Michel Dänzer:
Quoted 6 lines
From: Michel Dänzer <[email protected]>
It can be big, depending on the VM address space size, which is tunable via the
vm_sizemodule parameter.
Quoted 9 lines
Quoted 2 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93721
Signed-off-by Michel Dänzer <[email protected]>I actually wanted to address this by reducing
sizeof(struct amdgpu_vm_pt), but once more never got the time to do so.Patch is Reviewed-by: Christian König <[email protected]>
Applied. Thanks,
Alex
Quoted 37 lines
Quoted 37 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-3@@ -1282,7 +1282,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) {const unsigned align =min (AMDGPU_VM_PTB_ALIGN_SIZE ,AMDGPU_VM_PTE_COUNT *8 ); -unsigned pd_size, pd_entries, pts_size; +unsigned pd_size, pd_entries;int i, r;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {@@ -1300,8 +1300,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) pd_entries =amdgpu_vm_num_pdes (adev);/* allocate page table array */ - pts_size = pd_entries *sizeof (struct amdgpu_vm_pt ); - vm->page_tables =kzalloc (pts_size,GFP_KERNEL ); + vm->page_tables =drm_calloc_large (pd_entries,sizeof (struct amdgpu_vm_pt ));if (vm->page_tables ==NULL ) { DRM_ERROR("Cannot allocate memory for page tablearray\n"); return -ENOMEM;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -1361,7 +1360,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)for (i =0 ; i <amdgpu_vm_num_pdes (adev); i++)amdgpu_bo_unref (&vm->page_tables[i].entry.robj); -kfree (vm->page_tables); +drm_free_large (vm->page_tables);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · line 1366
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0amdgpu_bo_unref (&vm->page_directory);fence_put (vm->page_directory_fence);_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel