Re: [PATCH 6/8] drm/i915: add free_unused_pages support to i915

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/10/2021 14:00, Arunpravin wrote:
add drm_buddy_free_unused_pages() support on
contiguous allocation

Signed-off-by: Arunpravin <Arunpravin.PaneerSelvam@xxxxxxx>
---
  drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
index 963468228392..162947af8e04 100644
--- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
+++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
@@ -98,6 +98,14 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
  	if (unlikely(err))
  		goto err_free_blocks;
+ if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
+		err = drm_buddy_free_unused_pages(mm, (uint64_t)n_pages << PAGE_SHIFT,
+						       &bman_res->blocks);
+
+		if (unlikely(err))
+			goto err_free_blocks;

That needs some locking, mark_free/mark_split are all globally visible. Some concurrent user might steal the block, or worse.

+	}
+
  	*res = &bman_res->base;
  	return 0;



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux