On 11/3/2026 7:39 PM, Matthew Auld wrote:
On 03/11/2026 13:23, Arunpravin Paneer Selvam wrote:
Hi Matthew,
On 10/21/2026 6:19 PM, Matthew Auld wrote:
On 21/10/2026 13:18, Arunpravin Paneer Selvam wrote:
From: Arunpravin Paneer Selvam <[email protected]>
Range-restricted allocations (the visible-VRAM aperture) skip
dirty_steer_window() and reach __alloc_range_bias() with no
clear/dirty
eligibility guard, so a dirty allocation freely splits clear
extents (and
vice versa), interleaving the two classes until no large same-class
run
survives and a 4K scanout pin fails with -ENOSPC. Use a two-pass range
search instead: block_incompatible() rejects opposite-class blocks
in the
strict pass and relaxes only when the strict pass returns -ENOSPC,
so a
request still succeeds when only opposite-class space remains. A KUnit
regression test covers the interleaving pattern and fails without the
guard.
v2: the strict pass can split a block and then reject both
children, so
a split no longer implies a compatible block exists. Sashiko
reported
the resulting leaked splits; fix as suggested by Matthew:
- Push the parent back on the DFS stack after each split and
merge it
back with unsplit_block() if both children are still free.
- Make block_incompatible() judge free blocks only (split nodes
keep a
stale clear bit) and take the requested order, so mixed blocks
that
can hold a compatible block are descended instead of skipped.
- Extend the KUnit test with a coalesced mixed block and a check
that
a rejected split is merged back.
Fixes: 1ad5e807f716 ("gpu/buddy: replace dual-tree/force_merge with
decoupled dirty tracker")
Assisted-by: LLM
Cc: Matthew Auld <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Arunpravin Paneer Selvam
<[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
This version brought back a DAL CI failure. when the range allocator
wanted a clear (or dirty) block, it would split a mixed block to look
for a pure one, throw away the mixed halves, and then use
unsplit_block to join them again.
Doing this on every allocation was costly: even though the merge
cascades back up through all levels, repeating this split-and-unsplit
on every allocation added enough overhead on the display hot path
that a large scanout buffer
eventually failed with -ENOSPC
(igt@kms_plane@plane-panning-bottom-right on Radeon RX 9070 XT).
This change relaxes the rule for range allocations only: we just take
a mixed block as it is (the caller clears it if needed), so the first
pass never splits and never has to undo a split. Large same-class
blocks stay whole,
so contiguous space is preserved and fragmentation goes down. The
behaviour is still correct, unsplit_block is no longer needed, and a
KUnit test reproduces the problem (it fails without the fix and
passes with it).
Could you please just review v3 of this patch?. It is a bit urgent as
we need it to land the base dirty-tracker patch on our internal branch.
I think sashiko is now complaining about the same thing from before?
Yes - this is the same stranded-split leak Sashiko flagged back before
and in v4 I have addressed the comment Sashiko raised on v3.
In v3 I dropped unsplit_block() , assuming "accept a mixed block as-is"
covered it, but that only handles a mixed block that's already at the
requested order and fully inside the range. A higher-order mixed block
straddling the range edge is still split, and when its in-range half is
the opposite class (the matching half falling out of range) the split is
left with both children free - that is the leak.
v4 fixes it a different way: instead of splitting that block and then
cleaning up, the strict pass simply never splits a block that only
partially overlaps the range — so the stray split is never created in
the first place. The fallback pass still handles that block and actually
consumes the child it splits down to, so nothing is left stranded.
unsplit_block() stays unnecessary, and the leak can't occur.
Regards,
Arun.
Thanks,
Arun.
Are you just going to push this one by itself?