Before the writeback_iter() conversion, __shmem_writeback() walked the object's page indices using its size argument. The conversion retained nr_to_write = SWAP_CLUSTER_MAX, which the old loop did not enforce. writeback_iter() consumes that budget for each folio and stops when it is exhausted in WB_SYNC_NONE mode. Explicit writeback of larger objects can therefore stop after only 32 base pages, leaving later dirty folios unvisited. Mapped folios also consume the budget despite being skipped. Use the supplied object size to set the page budget, restoring the object-sized writeback attempt. Writeback remains best-effort; this does not guarantee that every page is written or freed. Fixes: 776a853a43c9 ("i915: Use writeback_iter()") Link: https://lore.kernel.org/all/20260914111511.648711F000FF@smtp.kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Matthias Goergens --- Thanks to Sashiko for pointing out the writeback-budget issue. This is a separate follow-up to the folio-unlock fix and applies independently. Compile-tested on x86-64 with CONFIG_DRM_I915=m. drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c index e7b18f7f9644..5751bd25c2b2 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c @@ -308,7 +308,7 @@ void __shmem_writeback(size_t size, struct address_space *mapping) { struct writeback_control wbc = { .sync_mode = WB_SYNC_NONE, - .nr_to_write = SWAP_CLUSTER_MAX, + .nr_to_write = size >> PAGE_SHIFT, .range_start = 0, .range_end = LLONG_MAX, }; -- 2.55.0