From: William Palacek <William.Palacek@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: intel-xe@lists.freedesktop.org,
"Matthew Auld" <matthew.auld@intel.com>,
"Arunpravin Paneer Selvam" <Arunpravin.PaneerSelvam@amd.com>,
"Sanjay Yadav" <sanjay.kumar.yadav@intel.com>,
"Joel Fernandes" <joelagnelf@nvidia.com>,
"Christian König" <christian.koenig@amd.com>,
linux-kernel@vger.kernel.org,
"William Palacek" <William.Palacek@amd.com>
Subject: [PATCH v3 2/2] gpu/tests/buddy: add range-biased allocation performance test
Date: Mon, 16 Nov 2026 11:11:02 -0500 [thread overview]
Message-ID: <1cd56b1074ceee96ad4cfb59122d09315a62fa78.1794845083.git.William.Palacek@amd.com> (raw)
In-Reply-To: <cover.1794845083.git.William.Palacek@amd.com>
Fill a 1 GiB range of a 4 GiB manager top-down with 64 KiB range-biased
allocations that request cleared memory, as amdgpu does for KFD VRAM on
NPS4 partitions, check that each one is placed directly below the
previous one, and report the time taken: 1103 ms with the walk, 2 ms
with the free tree lookup.
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Signed-off-by: William Palacek <William.Palacek@amd.com>
---
Notes:
v3:
- times for the new base and lookup (1103 ms, 2 ms)
v2:
- check top-down placement
drivers/gpu/tests/gpu_buddy_test.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/gpu/tests/gpu_buddy_test.c b/drivers/gpu/tests/gpu_buddy_test.c
index 9aaca2fc6a02..e48a99136e68 100644
--- a/drivers/gpu/tests/gpu_buddy_test.c
+++ b/drivers/gpu/tests/gpu_buddy_test.c
@@ -283,6 +283,32 @@ static void gpu_test_buddy_fragmentation_performance(struct kunit *test)
gpu_buddy_fini(&mm);
}
+static void gpu_test_buddy_range_bias_performance(struct kunit *test)
+{
+ struct gpu_buddy_block *block;
+ LIST_HEAD(allocated);
+ struct gpu_buddy mm;
+ ktime_t t0;
+ u64 i;
+
+ /* Fill one NPS4-like quarter top-down with cleared 64 KiB allocations. */
+ KUNIT_ASSERT_FALSE(test, gpu_buddy_init(&mm, SZ_4G, SZ_4K));
+ t0 = ktime_get();
+ for (i = 1; i <= SZ_1G / SZ_64K; i++) {
+ KUNIT_ASSERT_FALSE(test, gpu_buddy_alloc_blocks(&mm, SZ_1G, SZ_2G, SZ_64K,
+ SZ_64K, &allocated,
+ GPU_BUDDY_RANGE_ALLOCATION |
+ GPU_BUDDY_CLEAR_ALLOCATION |
+ GPU_BUDDY_TOPDOWN_ALLOCATION));
+ block = list_last_entry(&allocated, struct gpu_buddy_block, link);
+ KUNIT_ASSERT_EQ(test, gpu_buddy_block_offset(block), SZ_2G - i * SZ_64K);
+ }
+ kunit_info(test, "Range-biased fill took %lld ms\n",
+ ktime_ms_delta(ktime_get(), t0));
+ gpu_buddy_free_list(&mm, &allocated, 0);
+ gpu_buddy_fini(&mm);
+}
+
static void gpu_test_buddy_dirty_tracker_performance(struct kunit *test)
{
struct gpu_buddy_block *block, *tmp;
@@ -1701,6 +1727,7 @@ static struct kunit_case gpu_buddy_tests[] = {
KUNIT_CASE(gpu_test_buddy_alloc_range_clear_guard),
KUNIT_CASE_SLOW(gpu_test_buddy_fragmentation_performance),
KUNIT_CASE_SLOW(gpu_test_buddy_dirty_tracker_performance),
+ KUNIT_CASE_SLOW(gpu_test_buddy_range_bias_performance),
KUNIT_CASE(gpu_test_buddy_alloc_exceeds_max_order),
KUNIT_CASE(gpu_test_buddy_offset_aligned_allocation),
KUNIT_CASE(gpu_test_buddy_subtree_offset_alignment_stress),
--
2.43.0
prev parent reply other threads:[~2026-11-16 16:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:11 [PATCH v3 0/2] gpu/buddy: find range-biased blocks in the free trees William Palacek
2026-11-16 16:11 ` [PATCH v3 1/2] " William Palacek
2026-11-16 16:11 ` William Palacek [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=1cd56b1074ceee96ad4cfb59122d09315a62fa78.1794845083.git.William.Palacek@amd.com \
--to=william.palacek@amd.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.auld@intel.com \
--cc=sanjay.kumar.yadav@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
all inboxes | Powered by JetHome®