From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30BC5C5B543 for ; Tue, 10 Jun 2025 16:26:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C50426B0095; Tue, 10 Jun 2025 12:26:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C01036B0096; Tue, 10 Jun 2025 12:26:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B16CA6B0098; Tue, 10 Jun 2025 12:26:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 940936B0095 for ; Tue, 10 Jun 2025 12:26:40 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3F3ECBFEAD for ; Tue, 10 Jun 2025 16:26:40 +0000 (UTC) X-FDA: 83540019360.23.F80CD1B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 85D6680003 for ; Tue, 10 Jun 2025 16:26:38 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hjqq1Sfu; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749572798; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aZS0PHXMGrZsbS++29v/OH/QUiFXlNb84S4FGKau4VY=; b=8jKBA8cPWd/D9M+AZZ7bMtg0HEHKPsD8NoYVmVDYY7Pv+snHs5PL2sdb5ZDDX4wt1+R7BR 2FDvQQ3mUkpvyJvbOH5Kctu1IVb+OBBLKIZTrgR+stKlP+hL1Sw2KJo1I2pl8pEyBgaEt5 YANNocSlkJaVG4IuHZub+c9WcIfbSxU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749572798; a=rsa-sha256; cv=none; b=F6BaPBnByVQG1EEGHAftBOsAFNCV5c32lsG78wCdF9ty6dneTAWMzMen/s/Sp/78HXU7Yl DRNMZUIL73fwUYRC25NOW7OT2lTAmzRkMw/Q2dEJkPK562+kwSmst4bpHIxMmXIGC0Uo0g BFUJwc5LGdyDud/JDsILzE4LHk/vssI= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hjqq1Sfu; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=aZS0PHXMGrZsbS++29v/OH/QUiFXlNb84S4FGKau4VY=; b=hjqq1SfuKB3WqCGlM2fdFVECKO uew6eTYGRKiuBhCJt4oP8uy0sq5H68Fg88CU0zip740GuXzpJCl+MKpV+qQw2q+ENpByLzn91O4Pu RUMmtAL/TVQJBX/MOo+qVKgac5BR30SJFN0KnnJ7LvSTJWVVrURX6ZYZ8RLJnYekuLOblk9S81GmQ rNnY8Iwu4lLy6VugEIIyUyc8rWhgUzLzw+VPL0bP8sePIBkfUUlGoWpYztP7B9epR+I6IFdGKK/oh TPpR58IqzFzU2a6JW+0AgHIZcNZY9wcnLjaX6F9pkTcFI9dxLqjjWQlvLMthSOKgud7fAX2wQoWRP pmMukF7Q==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1uP1nz-00000009cfG-2gFU; Tue, 10 Jun 2025 16:26:31 +0000 Date: Tue, 10 Jun 2025 17:26:31 +0100 From: Matthew Wilcox To: Usama Arif Cc: Lorenzo Stoakes , David Hildenbrand , Andrew Morton , Shakeel Butt , "Liam R . Howlett" , Vlastimil Babka , Jann Horn , Arnd Bergmann , Christian Brauner , SeongJae Park , Mike Rapoport , Johannes Weiner , 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 Subject: Re: [DISCUSSION] proposed mctl() API Message-ID: References: <85778a76-7dc8-4ea8-8827-acb45f74ee05@lucifer.local> <2fd7f80c-2b13-4478-900a-d65547586db3@gmail.com> <8c762435-f5d8-4366-84de-308c8280ff3d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c762435-f5d8-4366-84de-308c8280ff3d@gmail.com> X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 85D6680003 X-Stat-Signature: 8kx89dtd65s3w9bz3gy7co9z7rfxscix X-Rspam-User: X-HE-Tag: 1749572798-911868 X-HE-Meta: U2FsdGVkX1/1rUjKwsQM751G8KszSJe/XU97SP5sC1uB48uW1yrORoAWqtWWYzn3WiElwm1SvWaN8+oZiTG5t9r/JjQX0/B16idrj01LGjSzZPgCMARsbV7F1NtADqrApH0qKxgV6Q+nF4I0235K3TQj5cwblG9Ff8LkiERcyUqlWYWn4hIlOeJ80/rrBN5ZPNth8VHACcRuSyx1Xj0ARu5YkANuqNnH/NfiVSEbZqifcrHtAIJj9WE+ylB3GunwLy/qXDmiMY053BDjgOCavOiCtoaqYKuLexM6VZMw/1yIyQP850ggRDhBhObG7WczJfiTdMjbeZlfepMSpPpsggEyZCXE9MT8Ss3dlXUWJpx8yDGVs92Q2OaIl26+kfxGNzTYqq/2D0Tk27DGcs8uswC0cdXQYemINpN7huEUQizWcEv9/AGHKO+C4Iy5cQytkFwuj+z+cSKmcAJn7kEOjUZcJX0hWP7wDzYfhfBcCYn6r/IHhHsav/YGU2LyZ/xuvTSt/GN6rk86Ilz4MPRI2a4N9hFjnR6Hc22F4Ej71hhnir9FgtirTOj5cE3+XXcEexe9KLJhcB9Sf+qCkdd/KoQCXnm0OnQGMTdKp8CpuBM1p/fAxdYxGh8PPJkNlOANaa43FSa4jtcJC33ytRXJYgYSxyhXD5u1Quqx5k+RSWM5LDQq2OzuQhCmda+Fz1WxBESw4BGhYfmD5r7odiVt4is94Rx8LtRnLdNYu8A+qn237qpr6d5kng9k1vXBvoe618f6p1o+0WgZKri4/87c+m7J4gFlZ5nsWDfHsWj3Q9/SgU+IU3/kxWlEJNyd9mJfaEMFvegEx+jEStatIxGAfeCAKU+NoVfz8pQIyjLQlfQejn6ChK52vRjkpZL/rv3Xm18kBAfN+LQbViPmeUKGnYfBZ3PY2LFCmYPO2XUvS712a9BwZcrDOi9bBsjJ9mDIJzNnuUuKNlbZg/HOYVW L4kEMFu/ 3ZyvkH55jt9DXYFeY8YhmqfAqZbtzisLtcom1D5ExwqqwLNlEOcFCKC2pRj96K4kB5Nr8/dAXi4NgPxmxhGB2bN01WnboEFCWOQ3zz6JS3k8OoUt7dyJ1AXpegYOUPfy4i9vbS88nL8yPx42DR0KUxUuoCTsxB6IOe7fmVN4bHAgRT9edkhsY5hTIq5ky7zQmMrgXDG+wxrSY/Osm5/VvkDdwrZcfLBEPrkDM09r+d4czv0A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jun 10, 2025 at 05:00:47PM +0100, Usama Arif wrote: > 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. No, they're not. It should be automatic. There are many deficiencies in the kernel; this is one of them. > Ofcourse hugetlbfs has its own drawbacks of reserving pages. Drawback or advantage? It's a feature. You're being very strange about this. First you want to reserve THPs for some workloads only, then when given a way to do that you complain that ... you have to reserve hugetlb pages. You can't possibly mean both of these things sincerely.