[Intel-gfx] [PATCH 6/8] drm/i915: add free_unused_pages support to i915
Arunpravin
arunpravin.paneerselvam at amd.com
Mon Nov 8 22:04:19 UTC 2021
On 04/11/21 12:48 am, Matthew Auld wrote:
> On 25/10/2021 14:00, Arunpravin wrote:
>> add drm_buddy_free_unused_pages() support on
>> contiguous allocation
>>
>> Signed-off-by: Arunpravin <Arunpravin.PaneerSelvam at amd.com>
>> ---
>> 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.
[Arun] I will lock using mutex
>
>> + }
>> +
>> *res = &bman_res->base;
>> return 0;
>>
>>
More information about the Intel-gfx
mailing list