Files
mac_linuxgpu/patches/linux/gpu-buddy-range-rollback.patch
geramyloveless 953cf0149c mac_linuxgpu: upstream Linux amdgpu on macOS
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple
Silicon Macs inside a DriverKit system extension, for AMD GPUs attached
over Thunderbolt. The Linux sources come from a pinned submodule and are
compiled against linuxu, a userspace implementation of the Linux kernel
APIs they use. Includes the HSA runtime, the host installer app, the
setup and firmware fetch scripts, and the offline test suite.
2026-10-02 18:49:17 -07:00

21 lines
708 B
Diff

gpu/buddy: drop a free block from the free tree before rollback coalescing
When a range allocation fails after splitting, the rollback path coalesces
the block with its buddy. A block that is still marked free remains linked
in its free tree, so the merge frees metadata that the tree still points to.
Remove the block from the tree before merging.
diff --git a/drivers/gpu/buddy.c b/drivers/gpu/buddy.c
--- a/drivers/gpu/buddy.c
+++ b/drivers/gpu/buddy.c
@@ -248,6 +248,9 @@
{
struct gpu_buddy_block *parent;
unsigned int order;
+
+ if (gpu_buddy_block_is_free(block) && !RB_EMPTY_NODE(&block->rb))
+ rbtree_remove(mm, block);
while ((parent = block->parent)) {
struct gpu_buddy_block *buddy;