[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5816677a-705e-4a8f-b598-d74ff6198a02@arm.com>
Date: Tue, 1 Jul 2025 10:53:09 +0530
From: Dev Jain <dev.jain@....com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: siddhartha@...ip.in, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
mgorman@...e.de, Vlastimil Babka <vbabka@...e.cz>
Subject: Re: [PATCH] mm: limit THP alignment – performance gain observed in AI inference workloads
On 30/06/25 4:24 pm, Lorenzo Stoakes wrote:
> +cc Vlastimil, please keep him cc'd on discussions here as the author of this
> fix in the conversation.
>
> On Mon, Jun 30, 2025 at 10:55:52AM +0530, Dev Jain wrote:
>>
>> For this workload, do you enable mTHPs on your system? My plan is to make a
>> similar patch for
>>
>> the mTHP case and I'd be grateful if you can get me some results : )
> I'd urge caution here.
>
> The reason there was a big perf improvement is that, for certain workloads, the
> original patch by Rik caused issues with VMA fragmentation. So rather than
> getting adjacent VMAs that might later be khugepage'd, you'd get a bunch of VMAs
> that were auto-aligned and thus fragmented from one another.
How does getting two different adjacent VMAs allow them to be khugepage'd if
both are less than PMD size? khugepaged operates per vma, I'm missing something.
>
> So while you got speed ups on some workloads, you got really bad perf impact on
> some that were subject to this.
>
> The observed speed up was on a very specific benchmark also. While it's a great
> improvement, it's important to understand the context (see the original patch
> for details [0]).
>
> I do think it's worth considering changing thp_get_unmapped_area_vmflags() for
> mTHP, as it's currently very limited (just PMD alignment) and it'd possibly be
> sensible to change this to checking against allowed THP alignments, but I'd not
> assume this is going to get some crazy speed up as observed here.
>
> Note that any such change would probably require some refactoring in THP first
> to make it not quite so awful.
>
> I also think for Siddharta's usecase mTHP isn't really relevant is it, as intel
> do not support mTHP currently do they?
>
> Regards, Lorenzo
>
> [0]: https://lore.kernel.org/all/20241024151228.101841-2-vbabka@suse.cz/T/#u
Powered by blists - more mailing lists