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 03917D6D23D for ; Wed, 27 Nov 2024 21:18:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 660C46B0082; Wed, 27 Nov 2024 16:18:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 610846B0083; Wed, 27 Nov 2024 16:18:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF176B0085; Wed, 27 Nov 2024 16:18:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 32C536B0082 for ; Wed, 27 Nov 2024 16:18:10 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C3FA314193F for ; Wed, 27 Nov 2024 21:18:09 +0000 (UTC) X-FDA: 82833137478.17.490F789 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf24.hostedemail.com (Postfix) with ESMTP id 7F8AC180016 for ; Wed, 27 Nov 2024 21:18:07 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DZ7NpMJU; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732742282; a=rsa-sha256; cv=none; b=g2AHbPw/4UP+b5erNSQwgwclMXf06bYV+Aahg1vUySv49QGQo4GIgrs2x7jcIsO3k2KOMt ilsD6DuFL2mOYFiZfQ1Ly4wDfz33Nu81zP46ET3wEKC9mu0+OCY5ZYboFzSlsmVeJ1aXZB +QERKvLGpACC4jyLqQp9Ztm0+7kpt64= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DZ7NpMJU; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732742282; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=puz1NvuerFNcdSunmtXk1S7+MQ+9ZCCB/MIKL0Tp3IE=; b=s+kqy6+bzLVqRxMcmALQWtbisBibi5Q3IUaRXTdrv0XBOqOJNJqWIyLps7mW2DSkgjtgRO MUFsuA3AipWwpU+4iQtOLT+3Q40vcjtsQ0nhB51+oiacJli9aKaYSVjghoMsLezrwRzOtp xwVYbzimh3pxCWZ7d+OcAo22hdtGTbc= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A48A8A43A00; Wed, 27 Nov 2024 21:16:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F06FDC4CECC; Wed, 27 Nov 2024 21:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732742287; bh=yDl5oczllgAYa8WZPNgP0zyrPYISCmrYIjhILQe6iyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZ7NpMJU2B3xyBjveFVz+LibQwAp1tdS8imzjObUeLB/2sad4GJNvO0C5v/I6O3m+ VYCj+QeEO2E9MW3wSSx3XfKTmQyWwgfeJt7WOm4W1aLqzV4AsW2rv93pbED6RpiBN7 ROVx7qlP3g5EUOjLK15qqiMYL/46kG+ycbGTVuMDfxwtON/VMbgYEXihe8YbAh5jQf gtbq1BPOsnieIM8pt+bi0GpxxIYi2N7vDdkAiRsOO+gxqfLt8Gv1aowZktuUy9Cf47 iip1Xkk1HFFsNBAzW7Y2Xpybe2cb87RB6vww477qQJOL+JQdqwqDcBHPN3YatkIEBi t0JtOYvDhVCbw== From: SeongJae Park To: Gregory Price Cc: SeongJae Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org, nehagholkar@meta.com, abhishekd@meta.com, kernel-team@meta.com, david@redhat.com, ying.huang@intel.com, nphamcs@gmail.com, akpm@linux-foundation.org, hannes@cmpxchg.org, feng.tang@intel.com, kbusch@meta.com, damon@lists.linux.dev Subject: Re: [RFC PATCH 0/4] Promotion of Unmapped Page Cache Folios. Date: Wed, 27 Nov 2024 13:18:03 -0800 Message-Id: <20241127211803.87124-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241127082201.1276-1-gourry@gourry.net> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7F8AC180016 X-Stat-Signature: x9uwioiqx68h6z34hgp9pn55hor5qe8w X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1732742287-99240 X-HE-Meta: U2FsdGVkX1/caKYkjwmOqJg3+OQIIFh2zOcxe7SfbIcCZBGVBPf1j+kGevpDTSDRBITtoEz4oC8qnqK7z8U76oL0N1qrXog6IdQyx383s48NLXsVkgC+/k1VGN1OHuzxKKFBCRC06POoTpezWAjRJ11r8r2LsyFVM2mQLaj8UmsMT02fAgbrpIv//5YfKx3MYK7w++/J/wPH9qmoNgB3u8AfpRfUDBMI2eg177/WBjlgFb3eWjcgmdv6/Gklsd/QZafxVHWNDG2f3/OeJK4EUGMC44rPCXn/WSafdsXBJaO1C43q7Wa03vu9TpKaqKcqh8PLmB67SdMssHffhn7V5eX4vYwkLpZmPecyxMRSs0ehoH3WaXqumkIzDbQORpKbzmu3A9t6uP9W8FyJhbgZaC19VrMGz3xJrCO4FNqkca5+cL3ncjEJlkiSSpOYDviEv7m1SC04EnN7N/GMh88b/lXGOxtYZzeVNk6FTqNO0W2FSo+18ak0/8QTr9Qw6ZfSFsW98YxhJhfGDZlFKAmoeLLv/I1cO3btGQ0OfW1YmpXjj7L5mCVVPRr1NeiMk5YTwVt7Lnx8yqyXK5BlMQ3miWgGx2FuQIVy3w9s+zlfC5icwztfmLBB3596xWgIf+BlTXtAQDCnTA7k+t4R4xlHIVTkroEIkp+hnUtmR8jjr24CIjHSgSsWpfT4fZeWaXMKupC9ne1sUBkNeQkkVacQPLbGcC3diYIF3IYNeqcys+hJd0HCytxCg9eoVMDF+6Y6wnuHOuHQZPhAgdcv8oQRh5vhx84xbWE/HWvPlKHRJBKvtaA3kysyNgEJI2TXPh3P3Q3hZIF+iy4A6+Tvb/Qsj78ZtAJ4MLbn23VFGTzWcNsWffgjvdBavXqm97ON74cFN1XL7OqMiC41NS+SFRnqxPMIOcVcAqC6FHeLUMwLnoVyj/nEperDO2n7r1PMoonnBblS0CyNSbpldMZzrzH q0yZu7wk SN1E7tlqO4gE3deRj8Yx/W2aBPZ1uniJ8QKwxKnuY4ILOFvyT9QtW1/UDZujRJnEe9U6XS6kchD/tpAkk2xI912wdhuPTAUFMcWshEvQmlTKwgQxwJ+nCn22PEc8kpl2PzW3RSZEOaoi0+2rPSeK8S7P9udJntl+SUR4OvZZZiDr6oCVfutQxbFuEE90F64e9qmubzpR1iPVqmPbs0P/N86nahnJwtwHArlHXHN3zBhrMzQTj6mzqljTulwccWe9RUEihxr0fWzeoRZ29oMoCw0hEi/hpsRPl1pXike99lhmhv1iJADqgvJvPc2/7GiRGs2UU 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: Hello, On Wed, 27 Nov 2024 03:21:57 -0500 Gregory Price wrote: > Unmapped page cache pages can be demoted to low-tier memory, but > they can presently only be promoted in two conditions: > 1) The page is fully swapped out and re-faulted > 2) The page becomes mapped (and exposed to NUMA hint faults) > > This RFC proposes promoting unmapped page cache pages by using > folio_mark_accessed as a hotness hint for unmapped pages. Adding my thoughts that humble and biased as a DAMON maintainer. The thoughts are about the general problem, not about this patchset. So please think below as a sort of my "thinking loud" or "btw I use DAMON", and ignore those when discussing about this specific patch series. DAMON's access check mechanisms use PG_idle which is updated by folio_mark_accessed(), and hence DAMON can monitor access to unmapped pages. DAMON also supports migrating pages of specific access pattern to an arbitrary NUMA node. So, promoting unmapped page cache folios using DAMON might be another way. More specifically, users could use only DAMON for both promoting and demoting of every page like HMSDK[1] does, or for only unmapped pages promotion. I think the former idea might work given previous test results, and I proposed an idea[2] to make it more general (>2 tiers) and easy to tune using DAMOS quota auto-tuning feature before. All features for the proposed idea[2] are available starting v6.11. For the latter idea, though, I'm not sure how beneficial it would be, and whether it makes sense at all. For people who might be interested in it, or just how DAMON can be used for such weird idea, I posted an RFC patch[3] for making DAMON be able to be used for the use case. For easy testing from anyone who interested, I also pushed DAMON user-space tool's support of the new filter to a temporal branch[4]. The temporal branch[4] might be erased later. Note that I haven't test any of the two changes for the unmapped pages only promotion idea, and have no ETA for any test. Those are only for concept level idea sharing. [...] > During development, we explored the following proposals: [...] > 4) Adding a separate kthread - suggested by many > > This is - to an extent - a more general version of the LRU proposal. > We still have to track the folios - which likely requires the > addition of a page flag. Additionally, this method would actually > contend pretty heavily with LRU behavior - i.e. we'd want to > throttle addition to the promotion candidate list in some scenarios. DAMON runs on a separate kthread, so DAMON-based approach maybe categorized into this one. [1] https://github.com/skhynix/hmsdk/wiki/Capacity-Expansion [2] https://lore.kernel.org/damon/20231112195602.61525-1-sj@kernel.org/ [3] https://lore.kernel.org/20241127205624.86986-1-sj@kernel.org [4] https://github.com/damonitor/damo/commit/32186d710355ef0dec55e3c6bd398fadeb9d136f Thanks, SJ [...]