[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e54e0b31-1b92-4110-b8ac-4737893fe197@linux.alibaba.com>
Date: Tue, 6 May 2025 11:33:34 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: David Hildenbrand <david@...hat.com>, Daniel Gomez <da.gomez@...nel.org>
Cc: Ville Syrjälä <ville.syrjala@...ux.intel.com>,
akpm@...ux-foundation.org, hughd@...gle.com, willy@...radead.org,
wangkefeng.wang@...wei.com, 21cnbao@...il.com, ryan.roberts@....com,
ioworker0@...il.com, da.gomez@...sung.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, regressions@...ts.linux.dev,
intel-gfx@...ts.freedesktop.org, Eero Tamminen <eero.t.tamminen@...el.com>
Subject: Re: [REGRESSION] Re: [PATCH v3 3/6] mm: shmem: add large folio
support for tmpfs
On 2025/5/2 23:31, David Hildenbrand wrote:
> On 02.05.25 15:10, Daniel Gomez wrote:
>> On Fri, May 02, 2025 at 09:18:41AM +0100, David Hildenbrand wrote:
>>> On 02.05.25 03:02, Baolin Wang wrote:
>>>>
>>>>
>>>> On 2025/4/30 21:24, Daniel Gomez wrote:
>>>>> On Wed, Apr 30, 2025 at 02:20:02PM +0100, Ville Syrjälä wrote:
>>>>>> On Wed, Apr 30, 2025 at 02:32:39PM +0800, Baolin Wang wrote:
>>>>>>> On 2025/4/30 01:44, Ville Syrjälä wrote:
>>>>>>>> On Thu, Nov 28, 2024 at 03:40:41PM +0800, Baolin Wang wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> This causes a huge regression in Intel iGPU texturing performance.
>>>>>>>
>>>>>>> Unfortunately, I don't have such platform to test it.
>>>>>>>
>>>>>>>>
>>>>>>>> I haven't had time to look at this in detail, but presumably the
>>>>>>>> problem is that we're no longer getting huge pages from our
>>>>>>>> private tmpfs mount (done in i915_gemfs_init()).
>>>>>>>
>>>>>>> IIUC, the i915 driver still limits the maximum write size to
>>>>>>> PAGE_SIZE
>>>>>>> in the shmem_pwrite(),
>>>>>>
>>>>>> pwrite is just one random way to write to objects, and probably
>>>>>> not something that's even used by current Mesa.
>>>>>>
>>>>>>> which prevents tmpfs from allocating large
>>>>>>> folios. As mentioned in the comments below, tmpfs like other file
>>>>>>> systems that support large folios, will allow getting a highest
>>>>>>> order
>>>>>>> hint based on the size of the write and fallocate paths, and then
>>>>>>> will
>>>>>>> attempt each allowable huge order.
>>>>>>>
>>>>>>> Therefore, I think the shmem_pwrite() function should be changed to
>>>>>>> remove the limitation that the write size cannot exceed PAGE_SIZE.
>>>>>
>>>>> To enable mTHP on tmpfs, the necessary knobs must first be enabled
>>>>> in sysfs
>>>>> as they are not enabled by default IIRC (only THP, PMD level).
>>>>> Ville, I
>>>>> see i915_gemfs the huge=within_size mount option is passed. Can you
>>>>> confirm
>>>>> if /sys/kernel/mm/transparent_hugepage/hugepages-*/enabled are also
>>>>> marked as
>>>>> 'always' when the regression is found?
>>>>
>>>> The tmpfs mount will not be controlled by
>>>> '/sys/kernel/mm/transparent_hugepage/hugepages-*Kb/enabled' (except for
>>>> the debugging options 'deny' and 'force').
>>>
>>> Right, IIRC as requested by Willy, it should behave like other FSes
>>> where
>>> there is no control over the folio size to be used.
>>
>> Thanks for reminding me. I forgot we finally changed it.
>>
>> Could the performance drop be due to the driver no longer using
>> PMD-level pages?
>
> I suspect that the faulting logic will now go to a smaller order first,
> indeed.
>
> ... trying to digest shmem_allowable_huge_orders() and
> shmem_huge_global_enabled(), having a hard time trying to isolate the
> tmpfs case: especially, if we run here into the vma vs. !vma case.
>
> Without a VMA, I think we should have "mpfs will allow getting a highest
> order hint based on and fallocate paths, then will try each allowable
> order".
>
> With a VMA (no access hint), "we still use PMD-sized order to locate
> huge pages due to lack of a write size hint."
>
> So if we get a fallocate()/write() that is, say, 1 MiB, we'd now
> allocate an 1 MiB folio instead of a 2 MiB one.
Right.
So I asked Ville how the shmem folios are allocated in the i915 driver,
and to see if we can make some improvements.
Powered by blists - more mailing lists