From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EAF32110; Tue, 10 Jun 2025 15:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749570415; cv=none; b=AaAw1llbi7zYrw6SXeFkayc2FjSwpUi1Tv5WK+T6CmkcRBtgWHOSeT1nJa+vTMF6OJEEK9nVl6a9bLguamyx1oyEx7nis/SmbYGfh8nDAgKTRHfR5oSi0W4UWouK8VAAtR72ZuKu2HWXxLxzeN9AIHprxSKyx2KdgZlLVCmfpxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749570415; c=relaxed/simple; bh=j6dWJdalBSxeMo1IRxMIKeyURK4dTY/ml1b5oscbp9M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tI+RVp6Rgkygzlu+JXkVF+gxEGj0nj+L/lHLh7ixtfxb8U5Fk2nAev9kLSP2qkckBaAP4uL/ujSbXE3zGQSL+Be7dbS/Gmd3DmjbWUlxYLv2UeStoBlMkk/di/8uzEwusaFDfQyqefmQwtsWd1ivO/Jf6Cz6/z17wqlw9KAFUIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=OC9KFQXX; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OC9KFQXX" 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=+joD00bwCj+l+Oro6kgeolprgnWfx+uVOp6jPA1PH9M=; b=OC9KFQXXhGP3G9vcpHTSWUEnJN xvJ9rPmBlTUaX2pv1VBNgqiGAQC/s8olrOeWhhKTniu6hFxrcqiBqwR6/i0r5+99q6dRCcjvssmRb E7jwbz1o5cRZ8CmbLGipZ9aSupvXrooUtfnS3Z3/994hU8Au6pjQMM2emjU8nR0u5rh1oNGnzhw4i ZyfmWxByYt9/M2dQSim/j+o/zvwvbRY2/xsJeY+t25sJJzDI4hHmP9P9GUzN1NxWZClaO0CqpGOIk WORdUjnnw5G10WPJmgo+9LqoGQm6ZphxuYDiOCK8L1eg2c6/d13jSjY57iT49jeifhKer+f4xnFw8 zsM5PF0Q==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1uP1BS-00000009ZrU-2Akh; Tue, 10 Jun 2025 15:46:42 +0000 Date: Tue, 10 Jun 2025 16:46:42 +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> Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2fd7f80c-2b13-4478-900a-d65547586db3@gmail.com> 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!) > 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.