From: Usama Arif <usamaarif642@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
Arnd Bergmann <arnd@arndb.de>,
Christian Brauner <brauner@kernel.org>,
SeongJae Park <sj@kernel.org>, Mike Rapoport <rppt@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Barry Song <21cnbao@gmail.com>,
linux-mm@kvack.org, linux-arch@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Pedro Falcato <pfalcato@suse.de>
Subject: Re: [DISCUSSION] proposed mctl() API
Date: Tue, 10 Jun 2025 17:00:47 +0100 [thread overview]
Message-ID: <8c762435-f5d8-4366-84de-308c8280ff3d@gmail.com> (raw)
In-Reply-To: <aEhTYkzsTsaBua40@casper.infradead.org>
On 10/06/2025 16:46, Matthew Wilcox wrote:
> On Tue, Jun 10, 2025 at 04:30:43PM +0100, Usama Arif wrote:
>> If we have 2 workloads on the same server, For e.g. one is database where THPs
>> just dont do well, but the other one is AI where THPs do really well. How
>> will the kernel monitor that the database workload is performing worse
>> and the AI one isnt?
>
> It can monitor the allocation/access patterns and see who's getting
> the benefit. The two workloads are in competition for memory, and
> we can tell which pages are hot and which cold.
>
> And I don't believe it's a binary anyway. I bet there are some
> allocations where the database benefits from having THPs (I mean, I know
> a database which invented the entire hugetlbfs subsystem so it could
> use PMD entries and avoid one layer of TLB misses!)
>
Sure, but this is just an example. Workload owners are not going to spend time
trying to see how each allocation works and if its hot, they put it in hugetlbfs.
Ofcourse hugetlbfs has its own drawbacks of reserving pages.
This is one of the reasons that we have THPs.
But they will try THPs. i.e. if they see performance benefits from just turning
a knob, they will take it otherwise leave it.
>> I added THP shrinker to hopefully try and do this automatically, and it does
>> really help. But unfortunately it is not a complete solution.
>> There are severely memory bound workloads where even a tiny increase
>> in memory will lead to an OOM. And if you colocate the container thats running
>> that workload with one in which we will benefit with THPs, we unfortunately
>> can't just rely on the system doing the right thing.
>
> Then maybe THP aren't for you. If your workloads are this sensitive,
> perhaps you should be using a mechanism which gives you complete control
> like hugetlbfs.
Yes, completely agree, THPs aren't for the workloads that are this sensitive.
But that's why we need this, to disable it for them if the global policy is always,
or enable it on other services that are not sensitive and benefit from THPs
if the global policy is madvise. We have to keep in mind that these workloads
will be colocated on the same server.
and hugetlbfs isnt transparent enough.. :)
next prev parent reply other threads:[~2025-06-10 16:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 14:43 [DISCUSSION] proposed mctl() API Lorenzo Stoakes
2025-05-29 15:28 ` Matthew Wilcox
2025-05-29 17:54 ` Shakeel Butt
2025-05-29 18:13 ` Matthew Wilcox
2025-05-29 18:32 ` Usama Arif
2025-05-29 21:14 ` Johannes Weiner
2025-05-29 21:24 ` Liam R. Howlett
2025-05-29 23:14 ` Johannes Weiner
2025-05-30 7:52 ` Barry Song
2025-06-04 12:00 ` Johannes Weiner
2025-06-04 12:05 ` David Hildenbrand
2025-05-30 10:31 ` Vlastimil Babka
2025-06-04 12:19 ` Johannes Weiner
2025-06-05 12:31 ` Johannes Weiner
2025-06-09 17:03 ` Tejun Heo
2025-06-02 18:01 ` Matthew Wilcox
2025-06-04 13:21 ` Johannes Weiner
2025-06-04 12:28 ` Lorenzo Stoakes
2025-05-29 17:21 ` Usama Arif
2025-05-30 13:10 ` Lorenzo Stoakes
2025-06-10 15:03 ` Usama Arif
2025-06-10 15:17 ` Lorenzo Stoakes
2025-06-10 15:30 ` Usama Arif
2025-06-10 15:46 ` Matthew Wilcox
2025-06-10 16:00 ` Usama Arif [this message]
2025-06-10 16:26 ` Matthew Wilcox
2025-06-10 17:02 ` Usama Arif
2025-06-10 16:02 ` Lorenzo Stoakes
2025-07-02 14:15 ` Usama Arif
2025-07-02 17:38 ` SeongJae Park
2025-07-04 10:34 ` David Hildenbrand
2025-05-29 18:50 ` Andy Lutomirski
2025-05-29 21:31 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c762435-f5d8-4366-84de-308c8280ff3d@gmail.com \
--to=usamaarif642@gmail.com \
--cc=21cnbao@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=brauner@kernel.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=jannh@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=sj@kernel.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).