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 8F4F7C54E4A for ; Fri, 8 Mar 2024 13:45:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F5376B02CE; Fri, 8 Mar 2024 08:45:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A5F16B02D1; Fri, 8 Mar 2024 08:45:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06E4C6B02D4; Fri, 8 Mar 2024 08:45:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EA8116B02CE for ; Fri, 8 Mar 2024 08:45:43 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8613D16066C for ; Fri, 8 Mar 2024 13:45:43 +0000 (UTC) X-FDA: 81873994566.13.FF40A08 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf22.hostedemail.com (Postfix) with ESMTP id 7EE0AC001D for ; Fri, 8 Mar 2024 13:45:41 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709905541; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lgHJ3I5aBmiUxdHDSMa5q0puhk1KSbDKZSwmwX7mxlw=; b=u0UL145hR4QBFm6VPTinuBBe6am58se99/Q5CpqFGoJyIPLbpOQPgQTZjS0a/qwOUu3qOt 3I3ORLw1veqjfqyityKMWvgDV+9eLm0mFaEAz6oWtDHHK8v1B1NCrsyhBZsPbO05XNrBkp CTf1U2LJV3dR0AKTbdikuIyLMsBQMeI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709905541; a=rsa-sha256; cv=none; b=8gfHQxERdsx0oZ0rYSBE6ivBA45OdlZfsmpB0pNXPTwG/aTpkJABKOUEsuOwE6JPTE1a5u vwlCYX1F1brIwDby+RzKZgfVwAE5yxDUOdSWYRxeW/OSBaoKX1dd4e3/lK0YXsMAnam6aT XG8HDF4HQedJelztaGnWNO7+eX8/nYw= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1339DC15; Fri, 8 Mar 2024 05:46:17 -0800 (PST) Received: from [10.57.70.163] (unknown [10.57.70.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 88B433F762; Fri, 8 Mar 2024 05:45:36 -0800 (PST) Message-ID: <252bac83-bf5e-4c40-a696-ac093da41fa3@arm.com> Date: Fri, 8 Mar 2024 13:45:34 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mm: prohibit the last subpage from reusing the entire large folio Content-Language: en-GB To: David Hildenbrand , Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org Cc: minchan@kernel.org, fengwei.yin@intel.com, linux-kernel@vger.kernel.org, mhocko@suse.com, peterx@redhat.com, shy828301@gmail.com, songmuchun@bytedance.com, wangkefeng.wang@huawei.com, xiehuan09@gmail.com, zokeefe@google.com, chrisl@kernel.org, yuzhao@google.com, Barry Song , Lance Yang References: <20240308092721.144735-1-21cnbao@gmail.com> <519fd6a7-072e-43a2-a9a8-2467ee783524@redhat.com> <8e994734-1d3a-4c51-9c0b-4e2ce945f198@redhat.com> From: Ryan Roberts In-Reply-To: <8e994734-1d3a-4c51-9c0b-4e2ce945f198@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7EE0AC001D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: tj833qw4jwmoktfz3xxgcuxmrq5ab7zh X-HE-Tag: 1709905541-650214 X-HE-Meta: U2FsdGVkX196YCXOgiW2aE69jwCLhpH221oq5LMtOVFeS+l2fbcZizyNS2oevZptCB9tfOyBYUZFe1Lkl0i0frOeBCnshLksN+YzdLzkyvp8L/2lnaWlmDNbA6ZCOqa5zEcTmYvtkVnmUaTrincYaFzEjvD9mNqfTyFUHPYNfDtT7WG1gmzTP2zF3xnyaUs2ksQLKZCTD8lKVupDSecRi5xmiZH2Mxc22Bn5yLy/aUEpHrQk5isLpgSuGK9TuPgKGHMwRRO6PHrorQ1/gPxbWjyBaFa1Wz3eSpzmNPo5DvYZ70HOsftM1akqeTu1jgpCAiOhVWMiUiwjnRsn2Di7ODjk2+Wm7DvBrvPRAIE4okQJvoUdCGeEP3+7NRvNTZJt1jM3rjv3DC9HyLGa80pPjHD7FAjG/c6xImj2XYxG+5fWvaUIAN7N6N5ON+LRcCZN9O+28E81VPTRMRUdeEfLP/OE6DUAH5inixRCeOiip4m7iSp0V0eqLmU1KVVa0MS9mKljfMyFGiC2HgFsyFK2VFJfMV6BKNH8qtsYtqW4qgwWdIAGkQEEc/Bs73fslZFPIxpYxgo5/64RknBD1pRXCMyuRjBrZAdvHpKjroRZOjhQvr9bPwFTb5f1YMtC4qkjftELEcbUwdJdcJlRnwjSE8W2SJWKGULbR//nWo8vfZaukVlqx/RmgVU5wYguwVr+PM8/U2GnOXua0QvPSavWIzQmNbDZFL+MgKELztxbUPQT4OVY7VKZNopyGtHNkYoPOyUpbQzxmtnw27Fg+KC0HLiMqyGBnBR2g/RBVMjDdKEEHluxSBzpQeFKiFojYeLSiMgBsYyv3KxhRGpWArPFy9noOBe18PZT 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 08/03/2024 13:24, David Hildenbrand wrote: >>>> This patch migrates the last subpage to a small folio and immediately >>>> returns the large folio to the system. It benefits both memory availability >>>> and anti-fragmentation. >>> >>> It might be controversial optimization, and as Ryan said, there, are likely >>> other cases where we'd want to migrate off-of a thp if possible earlier. >> >> Personally, I think there might also be cases where you want to copy/reuse the >> entire large folio. If you're application is using 16K THPs perhaps it's a >> bigger win to just treat it like a base page? I expect the cost/benefit will >> change as the THP size increases? > > Yes, I think for small folios (i.e., 16KiB) it will be rather easy to make a > decision. The larger the folio, the larger the page fault latency due to > scanning, copying, modifying, which can easily turn undesirable. > > At least when it comes to page reuse, I have some simple backup plans for small > folios if I won't be able to make progress with my other approach. Do you mean "small large folios" here? i.e. order >= 1? If so, great! For larger > folios, it won't really work/be desirable, though. >