From: "Yadav, Sanjay Kumar" <sanjay.kumar.yadav@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.auld@intel.com>
Subject: Re: [PATCH] drm/xe: Use DRM_BUDDY_CONTIGUOUS_ALLOCATION for contiguous allocations
Date: Tue, 9 Dec 2025 10:07:49 +0530 [thread overview]
Message-ID: <0d2d762e-79c1-4e05-8f13-0700cbf0fcb2@intel.com> (raw)
In-Reply-To: <aTMGEVO1mRJXSXrB@lstrano-desk.jf.intel.com>
On 05-12-2025 21:49, Matthew Brost wrote:
> On Fri, Dec 05, 2025 at 08:41:13AM +0530, Sanjay Yadav wrote:
>> The VRAM/stolen memory managers do not currently set
>> DRM_BUDDY_CONTIGUOUS_ALLOCATION for contiguous allocations. Enabling
>> this flag activates the buddy allocator's try_harder path, which helps
>> handle fragmented memory scenarios.
>>
>> This enables the __alloc_contig_try_harder fallback in the buddy
>> allocator, allowing contiguous allocation requests to succeed even when
>> memory is fragmented by combining allocations from both(RHS and LHS)
>> sides of a large free block.
>>
>> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6713
>> Suggested-by: Matthew Auld <matthew.auld@intel.com>
>> Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
>> index 9f70802fce92..ef6cfb8af0ac 100644
>> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
>> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
>> @@ -82,6 +82,9 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man,
>> if (place->flags & TTM_PL_FLAG_TOPDOWN)
>> vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION;
>>
>> + if (place->flags & TTM_PL_FLAG_CONTIGUOUS)
>> + vres->flags |= DRM_BUDDY_CONTIGUOUS_ALLOCATION;
> If we set this flag can we remove the logic which rounds the allocation
> size to a pow2 and trims if TTM_PL_FLAG_CONTIGUOUS is set? From a quick
> look it looks we can as drm_buddy has roundup / trim logic if
> DRM_BUDDY_CONTIGUOUS_ALLOCATION is set.
>
> Matt
Thanks for pointing that out! I will incorporate this suggestion in v2
of the patch.
Sanjay
>
>> +
>> if (place->fpfn || lpfn != man->size >> PAGE_SHIFT)
>> vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
>>
>> --
>> 2.52.0
>>
prev parent reply other threads:[~2025-12-09 4:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 3:11 [PATCH] drm/xe: Use DRM_BUDDY_CONTIGUOUS_ALLOCATION for contiguous allocations Sanjay Yadav
2025-12-05 3:20 ` ✓ CI.KUnit: success for " Patchwork
2025-12-05 4:21 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-05 5:08 ` ✓ Xe.CI.Full: " Patchwork
2025-12-05 16:19 ` [PATCH] " Matthew Brost
2025-12-09 4:37 ` Yadav, Sanjay Kumar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d2d762e-79c1-4e05-8f13-0700cbf0fcb2@intel.com \
--to=sanjay.kumar.yadav@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox