[PATCH] mm: shmem: fix the shmem large folio allocation for the i915 driver
Andrew Morton
akpm at linux-foundation.org
Mon Jul 28 21:44:24 UTC 2025
On Mon, 28 Jul 2025 16:03:53 +0800 Baolin Wang <baolin.wang at linux.alibaba.com> wrote:
> After commit acd7ccb284b8 ("mm: shmem: add large folio support for tmpfs"),
> we extend the 'huge=' option to allow any sized large folios for tmpfs,
> which means tmpfs will allow getting a highest order hint based on the size
> of write() and fallocate() paths, and then will try each allowable large order.
>
> However, when the i915 driver allocates shmem memory, it doesn't provide hint
> information about the size of the large folio to be allocated, resulting in
> the inability to allocate PMD-sized shmem, which in turn affects GPU performance.
>
> To fix this issue, add the 'end' information for shmem_read_folio_gfp() to help
> allocate PMD-sized large folios. Additionally, use the maximum allocation chunk
> (via mapping_max_folio_size()) to determine the size of the large folios to
> allocate in the i915 driver.
What is the magnitude of the performance change?
> Fixes: acd7ccb284b8 ("mm: shmem: add large folio support for tmpfs")
> Reported-by: Patryk Kowalczyk <patryk at kowalczyk.ws>
> Reported-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Tested-by: Patryk Kowalczyk <patryk at kowalczyk.ws>
This isn't a regression fix, is it? acd7ccb284b8 adds a new feature
and we have now found a flaw in it.
Still, we could bend the rules a little bit and backport this, depends
on how significant the runtime effect is.
More information about the dri-devel
mailing list