[PATCH] drm/ttm: check if free mem space is under the lower limit

2018-02-23 Thread Roger He
_mem_limit as 0 to keep original behavior Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memory.c | 92 drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 ++ drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 ++ include/drm/

[PATCH] drm/ttm: check if free mem space is under the lower limit

2018-02-22 Thread Roger He
, allow TTM allocation. v2: merge two memory limit(swap and system) into one v3: keep original behavior except ttm_opt_ctx->flags with TTM_OPT_FLAG_FORCE_ALLOC v4: always set force_alloc as tx->flags & TTM_OPT_FLAG_FORCE_ALLOC v5: add an attribute for lower_mem_limit Signed-off-by

[PATCH 3/3] drm/ttm: check if free mem space is under the lower limit

2018-02-09 Thread Roger He
, allow TTM allocation. v2: merge two memory limit(swap and system) into one v3: keep original behavior except ttm_opt_ctx->flags with TTM_OPT_FLAG_FORCE_ALLOC v4: always set force_alloc as tx->flags & TTM_OPT_FLAG_FORCE_ALLOC Signed-off-by: Roger He <hongbo...@amd.com> ---

[PATCH 2/3] drm/ttm: set TTM_OPT_FLAG_FORCE_ALLOC in ttm_bo_force_list_clean

2018-02-09 Thread Roger He
Because ttm_bo_force_list_clean() is only called on two occasions: 1. By ttm_bo_evict_mm() during suspend. 2. By ttm_bo_clean_mm() when the driver unloads. On both cases we absolutely don't want any memory allocation failure. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/d

[PATCH 1/3] drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC

2018-02-09 Thread Roger He
, it will trigger OOM killer. will be used later. v2: set the FORCE_ALLOC always v3: minor refine Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 +++- include/drm/ttm/ttm_bo_api.h| 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/g

[PATCH 3/3] drm/ttm: check if free mem space is under the lower limit

2018-02-08 Thread Roger He
, allow TTM allocation. v2: merge two memory limit(swap and system) into one v3: keep original behavior except ttm_opt_ctx->flags with TTM_OPT_FLAG_FORCE_ALLOC v4: always set force_alloc as ttm_opt_ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC Signed-off-by: Roger He <hongbo...@amd.com&

[PATCH 2/3] drm/ttm: add input parameter force_alloc for ttm_bo_force_list_clean

2018-02-08 Thread Roger He
if it is true, allocate TTM pages regardless of zone global memory account limit. For example suspend, We should avoid TTM memory allocate failure to lead to whole process fail. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 13 - 1 file chan

[PATCH 1/3] drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC

2018-02-08 Thread Roger He
, it will trigger OOM killer. v2: keep original behavior except ttm bo with flag no_retry v3: forward the ttm_operation_ctx to ttm_mem_global_reserve Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm_memory.c

[PATCH 2/4] drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC

2018-02-08 Thread Roger He
, it will trigger OOM killer. the subsequent patche will use this. v2: keep original behavior except ttm bo with flag no_retry Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 1 - include/drm/ttm/ttm_bo

[PATCH 3/4] drm/ttm: add input parameter force_alloc for ttm_bo_evict_mm

2018-02-08 Thread Roger He
if true, allocate TTM pages regardless of zone global memory account limit. For suspend, We should avoid TTM memory allocate failure then result in suspend failure. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/gpu/drm/amd/

[PATCH 4/4] drm/ttm: check if the mem free space is under lower limit

2018-02-08 Thread Roger He
allocation. v2: merge two memory limit(swap and system) into one v3: keep original behavior except with ttm->page_flags TTM_PAGE_FLAG_NO_RETRY Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memory.c | 34 drivers/gp

[PATCH 1/4] drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx

2018-02-08 Thread Roger He
for saving memory and more bit flag can be used in future Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++-- drivers/gpu/drm/ttm/ttm_bo.c | 3 ++- include/drm/ttm/ttm_bo

[PATCH 5/5] drm/ttm: add input parameter allow_allo_anyway for ttm_bo_evict_mm

2018-02-06 Thread Roger He
if true for it, allocate TTM pages regardless of zone global memory account limit. that is for another special case: suspend. doesn't care the zone global memory account limit for this case. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.

[PATCH 4/5] drm/ttm: add bit flag TTM_OPT_FLAG_ALLOW_ALLOC_ANYWAY

2018-02-06 Thread Roger He
, it will trigger OOM killer. v2: keep original behavior except ttm bo with flag no_retry Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm_memory.c | 25 + drivers/gpu/d

[PATCH 3/5] drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx

2018-02-06 Thread Roger He
for saving memory and more bit flag can be used in future Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++-- drivers/gpu/drm/ttm/ttm_bo.c | 3 ++- include/drm/ttm/ttm_bo

[PATCH 2/5] drm/ttm: keep original behavior except with flag no_retry

2018-02-06 Thread Roger He
set the no_retry flag in struct ttm_mem_global and init it after ttm_mem_global_init Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +--- drivers/gpu/drm/ttm/ttm_memory.c| 3 +++ include/drm/ttm/ttm_memory.h| 3 +++ 3

[PATCH 1/5] drm/ttm: check if the free swap space is under limit 256MB

2018-02-06 Thread Roger He
> 256MB and at that time free swap space is under 256MB but available system mem > its lower limit, allow TTM allocation; b. if total swap space < 256 or no swap disk at all, check the available system mem, if it is bigger than its threshold, allow TTM allocation. Signed-off-by:

[PATCH 0/5] prevent OOM triggered by TTM

2018-02-06 Thread Roger He
(by defaut), keep the original behavior no any change. Roger He (5): drm/ttm: check if the free swap space is under limit 256MB drm/ttm: keep original behavior except with flag no_retry drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx drm/ttm: add bit flag

[PATCH 5/5] drm/ttm: keep original behavior except bo device with flag no_retry

2018-02-01 Thread Roger He
Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memory.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index 875e5b8..25e1ce0 100644 --- a/drivers/gpu/drm/ttm/ttm_me

[PATCH 4/5] drm/ttm: if need_dma32 is not set, actually no need dma32 zone at all.

2018-02-01 Thread Roger He
because this zone has only 4GB, it is easy to became bottleneck for huge normal zone. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++ drivers/gpu/drm/ttm/ttm_memory.c| 10 -- include/drm/ttm/ttm_memory.h| 1 + 3

[PATCH 3/5] drm/ttm: add ttm page_flags TTM_PAGE_FLAG_PAGEFAULT

2018-02-01 Thread Roger He
OOM killer. v2: fix minor typo v3: keep original behavior except ttm page with flag NO_RETRY Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 +- drivers/gpu/drm/ttm/ttm_memory.c | 27 +++ drivers/gpu/d

[PATCH 2/5] drm/ttm: add swap_glob_mem in ttm_mem_global

2018-02-01 Thread Roger He
ory which can't be flushed into swap space. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memory.c | 12 drivers/gpu/drm/ttm/ttm_tt.c | 13 +++-- include/drm/ttm/ttm_memory.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-) d

[PATCH 1/5] drm/ttm: add max_swap_mem in ttm_mem_global

2018-02-01 Thread Roger He
set its initial value as 1/2 * free swap cache size when module initial. and adjust this value when allocate TTM memory Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memory.c | 10 -- include/drm/ttm/ttm_memory.h | 2 ++ 2 files changed, 10 insertions

[PATCH 2/2] drm/ttm: add ttm page_flags TTM_PAGE_FLAG_PAGEFAULT

2018-01-29 Thread Roger He
, it will trigger OOM killer. v2: add new page flag TTM_PAGE_FLAG_PAGEFAULT rather than using struct ttm_operation_ctx Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm_memory.c | 27 +++ drivers/g

[PATCH 1/2] drm/ttm: add swap_glob_mem in ttm_mem_global

2018-01-29 Thread Roger He
ory which can't be flushed into disk/file. At this time, any memory request will trigger OOM killer. v2: always get total system swap size rather than getting it once at module init time Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memo

[PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread Roger He
ttm module needs it to determine its internal parameter setting. Signed-off-by: Roger He <hongbo...@amd.com> --- include/linux/swap.h | 6 ++ mm/swapfile.c| 15 +++ 2 files changed, 21 insertions(+) diff --git a/include/linux/swap.h b/include/linux/swap.h index c

[PATCH] drm/ttm: add the missed global memory count update

2018-01-19 Thread Roger He
when ttm_mem_global_alloc_page fails, we should call ttm_mem_global_free_page to update memory count for the ttm pages which already run ttm_mem_global_alloc_page successfully Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.

[PATCH] drm/ttm: fix missing parameter change for ttm_bo_cleanup_refs

2018-01-18 Thread Roger He
Missed in the patche: dc94777 drm/ttm: enable swapout for reserved BOs during allocation. don't unreserve the BO if it is not reserved by itself. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] drm/ttm: add VADDR_FLAG_UPDATED_COUNT to correctly update dma_page global count

2018-01-17 Thread Roger He
age is not right v3: use lower bits of dma_page vaddr Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 55 +--- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gp

[PATCH] drm/ttm: add updated_glob_count in dma_page

2018-01-16 Thread Roger He
add this for correctly updating global mem count in ttm_mem_zone. before that when ttm_mem_global_alloc_page fails, we would update all dma_page's global mem count in ttm_dma->pages_list. but actually here we should not update for the last dma_page. Signed-off-by: Roger He <hongbo...@a

[PATCH 2/2] drm/ttm: only free pages rather than update global memory count together

2018-01-11 Thread Roger He
if ttm_get_pages or ttm_mem_global_alloc_page fail, should not update global memory count. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_allo

[PATCH 1/2] drm/ttm: don't update global memory count for some special cases

2018-01-11 Thread Roger He
add input parameter for ttm_dma_unpopulate. when ttm_dma_pool_get_pages or ttm_mem_global_alloc_page fail, don't call ttm_mem_global_free_page to update global memory count. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/n

[PATCH] drm/ttm: check the return value of register_shrinker

2018-01-10 Thread Roger He
This fixes the build warning: "ignoring return value of 'register_shrinker', declared with attribute warn_unused_result [-Wunused-result]" Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 21 - drivers/gpu/drm/ttm/ttm_

[PATCH] staging: vboxvideo adapt to new TTM interface

2017-12-27 Thread Roger He
Fixes interface change done in the following commit: eb86c98 drm/ttm: use an operation ctx for ttm_tt_populate in ttm_bo_driver i missed this driver because it is in staging dir. Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/staging/vboxvideo/vbox_ttm.c | 5 +++-- 1 file chan

[PATCH 3/3] drm/ttm: enable swapout for reserved BOs during allocation

2017-12-24 Thread Roger He
if the bo shares same reservation object then not lock it again at swapout time to make it possible to swap out. v2: refine the commmit message Change-Id: I1e87954564f38ad298bf6e4ff88c9f26f291a62d Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c

[PATCH 2/3] drm/ttm: add new function to check if bo is allowable to evict or swapout

2017-12-24 Thread Roger He
extract a function as ttm_bo_evict_swapout_allowable since eviction and swapout can share same logic. v2: modify commit message and add description in the code Change-Id: I80a475a93fceed8d66d74a1832c815a0756341ac Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.

[PATCH 1/3] drm/ttm: use an operation ctx for ttm_tt_bind

2017-12-24 Thread Roger He
forward the operation context to ttm_tt_bind as well, and the ultimate goal is swapout enablement for reserved BOs. v2: use common term rather than amd specific Change-Id: I42a7df8c50e1ce3b527ee9cb78809f8e58136f07 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/

[PATCH 1/5] drm/ttm: use an operation ctx for ttm_mem_global_alloc_page

2017-12-21 Thread Roger He
forward the operation context to ttm_mem_global_alloc_page as well, and the ultimate goal is swapout enablement for per vm BOs. Per vm BOs refer to all BOs which share same reservation object. Change-Id: I4104a12e09a374b6477a0dd5a8fce26dce27a746 Signed-off-by: Roger He <hongbo...@amd.

[PATCH 4/5] drm/ttm: add new function to check if bo is allowable to evict or swapout

2017-12-21 Thread Roger He
extract a function as ttm_bo_evict_swapout_allowable since eviction and swapout can share same logic Change-Id: I80a475a93fceed8d66d74a1832c815a0756341ac Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 29 +++-- 1 file changed, 19 inse

[PATCH 2/5] drm/ttm: use an operation ctx for ttm_tt_populate in ttm_bo_driver

2017-12-21 Thread Roger He
forward the operation context to ttm_tt_populate as well, and the ultimate goal is swapout enablement for per vm BOs. Change-Id: If8dfa0f500429d1420e0da67eb6901f0bfbca57b Reviewed-by: Christian König <christian.koe...@amd.com> Signed-off-by: Roger He <hongbo...@amd.com> --- drivers

[PATCH 6/7] drm/ttm: add ttm_bo_evict_swapout_allowable to check bo is allowable to evict or swapout

2017-12-20 Thread Roger He
extract this function since eviction and swapout share same logic Change-Id: I80a475a93fceed8d66d74a1832c815a0756341ac Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff

[PATCH 7/7] drm/ttm: enable swapout of per VM BOs during allocation and allows reaping of deleted BOs

2017-12-20 Thread Roger He
Change-Id: I1e87954564f38ad298bf6e4ff88c9f26f291a62d Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 15 +++ drivers/gpu/drm/ttm/ttm_memory.c | 12 include/drm/ttm/ttm_bo_api.h | 3 ++- 3 files changed, 21 insertions(+), 9 del

[PATCH 5/7] drm/ttm: use an operation ctx for ttm_tt_bind

2017-12-20 Thread Roger He
Change-Id: I42a7df8c50e1ce3b527ee9cb78809f8e58136f07 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_bo.c| 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c

[PATCH 4/7] drm/ttm: use an operation ctx for ttm_tt_populate in ttm_bo_driver

2017-12-20 Thread Roger He
Change-Id: I803ea52d11e5c06add0dffab836c3aecc00b56dd Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- drivers/gpu/drm/ast/ast_ttm.c| 5 +++-- drivers/gpu/drm/cirrus/cirrus_ttm.c | 5 +++-- drivers/gpu/drm/n

[PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc

2017-12-20 Thread Roger He
Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c| 2 +- drivers/gpu/drm/ttm/ttm_memory.c| 15 +-- drivers/gpu/drm/ttm/ttm_object.c

[PATCH 3/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc_page

2017-12-20 Thread Roger He
Change-Id: I4104a12e09a374b6477a0dd5a8fce26dce27a746 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_memory.c | 15 --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 +- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++-- include/d

[PATCH 1/7] drm/ttm: call ttm_bo_swapout directly when ttm shrink

2017-12-20 Thread Roger He
then remove superfluous functions Change-Id: Iea020f0e30a239e0265e7a1500168c7d7f819bd9 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 21 +++- drivers/gpu/drm/ttm/ttm_memory.c | 12 ++- include/drm/ttm/ttm_bo_api.h | 1 + include/d

[PATCH] drm/ttm: enable eviction for Per-VM-BO

2017-12-14 Thread Roger He
Change-Id: I0c6ece0decd18d30ccc94e5c7ca106d351941c62 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 098b22e..b

[PATCH] drm/ttm: init locked again to prevent incorrect unlock

2017-12-13 Thread Roger He
Change-Id: Icc8b5112570429f24e90d52484df2728c546f85b Signed-off-by: Roger He <hongbo...@amd.com> Reviewed-by: Christian König <christian.koe...@amd.com> Cc: sta...@vger.kernel.org --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tt

[PATCH 2/3] drm/amd/amdgpu: init allow_reserved_eviction and resv when create a new bo

2017-12-12 Thread Roger He
Change-Id: I0c6571c2a64e6c5bdad80ccbcccb40eba1c20b4e Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/

[PATCH 6/6] drm/ttm: remove parameter reservation since it is moved into ttm context

2017-12-12 Thread Roger He
Change-Id: I83ac6a77f24e14698aa386a497a262e24c5bbdb6 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 22b6ca5..f138e95

[PATCH 5/6] drm/ttm: enable eviction for Per-VM-BO

2017-12-12 Thread Roger He
Change-Id: I491d4ceb8c98bb3d8e6e0ddef2330284ce2fe5f6 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index eb8c568..22b6ca5

[PATCH 4/6] drm/ttm: init locked again to prevent incorrect unlock

2017-12-12 Thread Roger He
Change-Id: I8db51d843955f5db14bb4bbff892eaedbd9f0abe Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 17fe8be..eb8c568 100644 --- a/drivers/gpu/d

[PATCH 3/6] drm/ttm: use an ttm operation ctx for ttm_bo_move_xxx

2017-12-12 Thread Roger He
include ttm_bo_move_memcpy and ttm_bo_move_ttm Change-Id: I160b2fe1da3200405810d0215c4521b5f0d3615a Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 +++ drivers/gpu/drm/nouveau/nouveau_bo.c| 7 +++ drivers/gpu/drm/qxl/qxl

[PATCH 2/6] drm/ttm: when create a new ttm bo init on_alloc_stage and resv for ttm_operation_ctx

2017-12-12 Thread Roger He
Change-Id: I0c6571c2a64e6c5bdad80ccbcccb40eba1c20b4e Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/

[PATCH 1/6] drm/ttm: add on_alloc_stage and reservation into ttm_operation_ctx

2017-12-12 Thread Roger He
on_alloc_stage: is this operation on allocation stage resv: reservation bo used of this operation Change-Id: I01ea482e8c7470014196eb218e2ff8913306eef0 Signed-off-by: Roger He <hongbo...@amd.com> --- include/drm/ttm/ttm_bo_api.h | 4 1 file changed, 4 insertions(+) diff --git a/inclu

[PATCH 1/3] drm/ttm: add set_pages_wb for handling page order more than zero

2017-11-22 Thread Roger He
Change-Id: Idf5ccb579d264b343199d8b8344bddeec2c0019f Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index a

[PATCH 2/3] drm/ttm: add page order support in ttm_pages_put

2017-11-22 Thread Roger He
Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/d

[PATCH 3/3] drm/ttm: roundup the shrink request to prevent skip huge pool

2017-11-22 Thread Roger He
e.g. shrink reqeust is less than 512, the logic will skip huge pool Change-Id: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/d

[PATCH 3/5] drm/ttm: add page order support in ttm_pages_put

2017-11-22 Thread Roger He
Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/d

[PATCH 5/5] drm/ttm: delete set_pages_array_wb since no one use it anymore

2017-11-22 Thread Roger He
Change-Id: I9fa45af447c3c78d0b7b2b8958081e584c560120 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index a

[PATCH 4/5] drm/ttm: roundup the shrink request to prevent skip huge pool

2017-11-22 Thread Roger He
e.g. shrink reqeust is less than 512, the logic will skip huge pool Change-Id: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/d

[PATCH 2/5] drm/ttm: add set_pages_wb for handling page order more than zero

2017-11-22 Thread Roger He
Change-Id: Idf5ccb579d264b343199d8b8344bddeec2c0019f Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index a

[PATCH 1/5] drm/ttm: add page order in page pool

2017-11-22 Thread Roger He
to indicate page order for each element in the pool Change-Id: Ic609925ca5d2a5d4ad49d6becf505388ce3624cf Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 38 +--- 1 file changed, 27 insertions(+), 11 deletions(-) diff

[PATCH 5/5] drm/ttm: delete set_pages_array_wb since no one use it anymore

2017-11-22 Thread Roger He
Change-Id: I9fa45af447c3c78d0b7b2b8958081e584c560120 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 8

[PATCH 4/5] drm/ttm: free one in huge pool even shrink request less than one element

2017-11-22 Thread Roger He
Change-Id: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c

[PATCH 2/5] drm/ttm: add set_pages_wb for handling page order more than zero

2017-11-22 Thread Roger He
Change-Id: Idf5ccb579d264b343199d8b8344bddeec2c0019f Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 2

[PATCH 3/5] drm/ttm: add page order support in ttm_pages_put

2017-11-22 Thread Roger He
Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/d

[PATCH 1/5] drm/ttm: add page order in page pool

2017-11-22 Thread Roger He
to indicate page order for each element in the pool Change-Id: Ic609925ca5d2a5d4ad49d6becf505388ce3624cf Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 42 ++-- 1 file changed, 31 insertions(+), 11 deletions(-) diff

[PATCH 4/4] drm/ttm: free one in huge pool even shrink request less than one element

2017-11-21 Thread Roger He
Change-Id: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c

[PATCH 1/4] drm/ttm: add page order in page pool

2017-11-21 Thread Roger He
to indicate page order for each element in the pool Change-Id: Ic609925ca5d2a5d4ad49d6becf505388ce3624cf Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 42 ++-- 1 file changed, 31 insertions(+), 11 deletions(-) diff

[PATCH 3/4] drm/ttm: add static buffer for ttm_pages_put to support pool shrink

2017-11-21 Thread Roger He
Change-Id: Ic20c016eb3043d7cfedc2e3648790a017168da6c Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 28 +++- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/d

[PATCH 2/4] drm/ttm: add page order support in ttm_pages_put

2017-11-21 Thread Roger He
Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 42 +--- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drive

[PATCH 4/4] drm/ttm: free one in huge pool even shrink request less than one element

2017-11-21 Thread Roger He
Change-Id: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c

[PATCH 3/4] drm/ttm: add page order support in ttm_pages_put

2017-11-21 Thread Roger He
Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 42 +--- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drive

[PATCH 2/4] drm/ttm: use NUM_PAGES_TO_ALLOC always

2017-11-21 Thread Roger He
Change-Id: Ide96a1ccad9bb44b0bb0d80e123c2d810ba618ed Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c

[PATCH 1/4] drm/ttm: add page order in page pool

2017-11-21 Thread Roger He
to indicate page order for each element in the pool Change-Id: Ic609925ca5d2a5d4ad49d6becf505388ce3624cf Signed-off-by: Roger He <hongbo...@amd.com> --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 33 ++--- 1 file changed, 22 insertions(+), 11 deletions(-) diff

[PATCH 0/4] *** fix memory leak for HUGE PAGE ***

2017-11-21 Thread Roger He
1. add page order into pool to support gtt huge page 2. add page order support when ttm pages put 3. update memory shrinker with order handling Roger He (4): drm/ttm: add page order in page pool drm/ttm: use NUM_PAGES_TO_ALLOC always drm/ttm: add page order support in ttm_pages_put drm