Re: [PATCH] drm/i915/gem: Skip writeback of shmem folios with extra references

From: Joonas Lahtinen

Date: Wed Nov 25 2026 - 04:45:48 EST


Quoting Christoph Hellwig (2026-11-25 07:36:42)
> On Fri, Nov 20, 2026 at 01:17:31PM +0000, Kiryl Shutsemau (Meta) wrote:
> > > > while ((folio = writeback_iter(mapping, &wbc, folio, &error))) {
> > > > - if (folio_mapped(folio))
> > > > + if (folio_mapped(folio) ||
> > > > + folio_ref_count(folio) != 1 + folio_nr_pages(folio))
> > >
> > > I don't think we need this fix in the current tree. The i915
> > > writeback iterator already skips the shmem folio in the case you
> > > describe, so the new refcount check doesn't change the outcome.
> >
> > Oh. It took me a while to see why.
> >
> > __shmem_writeback() asks writeback_iter() for PAGECACHE_TAG_DIRTY
> > folios, and shmem never sets that tag, its ->dirty_folio is
> > noop_dirty_folio(). So the loop body never runs for any folio, and
> > hasn't since 776a853a43c9 ("i915: Use writeback_iter()").
>
> Heh. I'm surprised no one noticed..

Not so funny to me, you folks are pushing regressions without ever
Cc'ing a single maintainer in the original patches.

I was under impression that Linux development had some rules about
not introducing regressions and also some rules about not pushing
stuff silently to other subsystems. Maybe it's just me not able to
keep up with the vibes of these times.

> > That makes me question the whole writeback thing. What's going on
> > there, and what's the plan?
>
> I (and others) have been asking forever to get drm out of micro-managing
> tmpfs. I guess given that this code path hasn't worked for a year and
> a half is a pretty good indicator that this instance should simply
> go away.

That's not a good indicator in this case.

The writeback for dirty shmem pages took multiple years and multiple
iterations to address the best we could as it's not exactly a race
that shows up frequently.

It's also more likely on the hardware from the era the fix was developed
on, and the owners of those older machines are not exactly jumping to the
latest mainline but rather more likely to run Debian oldstable.

So which one of you will be writing up a revert or fix for the offending
patch or do you expect us to clean up the mess you've created?

Regards, Joonas