From patchwork Tue Jan 7 20:17:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929576 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 7AA5CE77197 for ; Tue, 7 Jan 2025 20:18:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02BC16B0092; Tue, 7 Jan 2025 15:18:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F1D7C6B0093; Tue, 7 Jan 2025 15:18:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0C0D6B0095; Tue, 7 Jan 2025 15:18:11 -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 C52206B0092 for ; Tue, 7 Jan 2025 15:18:11 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7B591AFF82 for ; Tue, 7 Jan 2025 20:18:11 +0000 (UTC) X-FDA: 82981767582.20.201CB0B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id C6C11160022 for ; Tue, 7 Jan 2025 20:18:09 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XlUvFqc5; spf=pass (imf08.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 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=1736281089; 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:references:dkim-signature; bh=+bMusnJoMQ+cJNEQNTylH665j6wXrJxFczLFTBWfjuw=; b=d0fGsD4Zhd6LPP7tGf8kev+wzwzJM2Q/wRtmqJFZ69kBZWsbmTCgDUhndgcNGO8tSXKJcP 2p5yqDoglfMPNpI4M49GLGNOqcLx8qS2x0jbbDULDgChl3Sk+7o08eizgo/ivOpamNNv5l obGGQC17+EF953mchz3FGVqJ4TuzvZM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XlUvFqc5; spf=pass (imf08.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 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=1736281089; a=rsa-sha256; cv=none; b=A8OTY4KwPpf3r1l2guKHl6Q8cwBOiuZlNMc7bNaR+Csa96K6vjwE+6laz60xVtRWoZVMn2 rgrS5rVo/3INgCPf+e0qIoAS0avo6e9Uv+RxGIataq45sENOPl9724f32iy1xE1oXX0gk1 e5lurWqzjZajr8bd0tt2x5lqBzTRBuA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7E3A35C070B; Tue, 7 Jan 2025 20:17:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25536C4CED6; Tue, 7 Jan 2025 20:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281088; bh=tFMvsVxldJqs/FhiBDYeI89MsENyQmeQg8HlKr0w7OU=; h=From:To:Cc:Subject:Date:From; b=XlUvFqc5pBW0+QEdTp4QRp+e9wwaKSpsKK3cj1agLG8vnBJyzfanmEebanVmAPU63 Zb39hcdPVBcYIDOcOsYjD68MIdfrKG5KzblJzknBVQeCjHVdrbejzfwqIV1ETpym1o aHTPLLySkLoknQmYjY90REY24mpTUZhbdFgueDwHJHVnx7AhvPXNwKZFQIoi/S4xfr Rcs6piQCczInJlnlVbzLm83MQf/NzJOArd6PmUZKu8lDN9SrRDqWGaOr9wQnkl0Aao i2o5WK0cWo6fQU5fl7USY7LUutFOsNQeLFS9GNFSOci/92QCsAy232plARIVNlN8Tf Z5txm0NCDZQ3g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 00/10] mm/damon: extend DAMOS filters for inclusion Date: Tue, 7 Jan 2025 12:17:29 -0800 Message-Id: <20250107201739.79484-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C6C11160022 X-Rspam-User: X-Stat-Signature: 9fc18rwy4cu6qtre7w6t3xn9t75po688 X-HE-Tag: 1736281089-939605 X-HE-Meta: U2FsdGVkX1+2nVd0og+ypziemdPxkEuiTnTKibQ869MbpRBAFTwnaQSbedoqceUS0Kc3iDGBuF+D1OuB+jnpPZpyaAPCIWHUGMrsngPr2BND/6elF45e5qBITzsyqXEuQ7WG2Ljs97C2nqM8VOTyhcVhi39f1/Y5f9Vdon/n2ZiaboloH8ExCy7S0e+Ao7Xa0iXYFV09DVzHXE4/cmulK0UbOKNVGbVIBtMD4QRYbYX4ZA3/Eb5D55tPhAlaguq2oBq2HGT1vV2xHdnIg8wKAij1J5H/+4Y4RpbZfyrkFNEURdPUhnVJYFJNc7ZTwxHq9CGDtQcMulEJFIDhHg5WNuu1SPG8GOXb3F2EztH2XE3GaxC8wuCkh+RKTmAXPGeNfjoPq68F+v3c7VCgXXPo9FL6FDyJv4tBVoWniJnXczqLeWPIGOZmMlgE8LnjoAvtMm+dB9W+NnfUuJXhWbCHkdUKlh+3UkhbF3pUWtcQeJ1aXbv10OjRmg9HZlEDXM2IflRQfNHjvg92Ijgn9SeiF6NnJ/IAhWg+ppNAh6oXRKmT4UAKSTjkGJGFFWrIUCUncX0XQi6jjwM/cZ9HMQWXrY4rDpivzI75EqO4yNZbnt0Sz8ZhlWz4/Ph3L3zt4GcwiMXOsV4wMI3slowqF0phf90RFOFPUNf2ExmPovWSaG7b2CrRlNQ7XxCymSTZ1tyxIA0sTYCli0rCnr9AP6o+eWaEbbgPwkUsiNwanfemdjTApxjjRCLyNWFBJhBrTHUv418EyYOiktQR9jVw41iLDi1p7RLY4MAagHwALDsJb65frjQf7+Y12SFZFeWc8A9en6eSpO0kJo7rCD/D/42L+loONeD+Pj0yZfywel8aJKs5XWetIn+KyFFN9RHG9evE49U3/uEo07V1zrg/Mf9V3fCy78rRSuM1nOeQPLKoF24zuXGyZ66OVQ7xeEIvn9r00nReAOH3ccczNvu3lBA F3KcT1qm R2rKY0Ve46P5iOWA25SHiyZzH97qRx9WcXx4KmVmLX1wmTaiXT+jS8c2/7l2L7GP2+L8WY8ot6ExAwyRF7IQq2bXhDTUo6w/Wx7bSUA7Y7TJL+n5It2DRlP68DX0cXhLYZbedUeEDMImRHVNhPIIkeTl9/i4lAK0z8Sa8yOWNpUHBXjYcpetG+4O59ryhyCuUl6bbR2SJyZ1R+nquSFT3hN2U4oKVIw8ndLgC1lrML2mqX7s= 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: DAMOS fitlers are exclusive filters. It only excludes memory of given criterias from the DAMOS action targets. This has below limitations. First, the name is not explicitly explaining the behavior. This actually resulted in users' confusions[1]. Secondly, combined uses of multiple filters provide restriced coverages. For example, building a DAMOS scheme that applies the action to memory that belongs to cgroup A "or" cgroup B is impossible. A workaround would be using two schemes that fitlers out memory that not belong to cgroup A and cgroup B, respectively. It is cumbersome, and difficult to control quota-like per-scheme features in orchastration. Monitoring of filter-passed memory statistic will also be complicated. Extend DAMOS filters to support not only exclusion (blocking), but also inclusion (pass-through) behavior. For this, add a new damos_filter struct field called 'pass' for DAMON kernel API users. The filter works as an inclusion filter or an exclusion filter when it is set or unset, respectively. For DAMON user-space ABI users, add a DAMON sysfs file of same name under DAMOS filter sysfs directory. To prevent exposing a behavioral change to old users, set the blocking as the default behavior. Note that pass filters work for only inclusion, not exclusion of memory that not satisfying the criteria. And the default behavior of DAMOS for memory that no filter has involved is that the action can be applied to those. This means that installing pass filters without block filters after them is not useful for some usecases. Read the design document update part of this patch series for more details. [1] https://lore.kernel.org/20240320165619.71478-1-sj@kernel.org Changes from RFC v2 (https://lore.kernel.org/20241227210819.63776-1-sj@kernel.org) - Wordsmith messages - Wordsmith design documentation about monitoring-purpose usage - Rebase on latest mm-unstable Changes from RFC v1 (https://lore.kernel.org/20241226221445.78433-1-sj@kernel.org) - Fix encoding issue on the last patch SeongJae Park (10): mm/damon: fixup damos_filter kernel-doc mm/damon/core: add damos_filter->pass field mm/damon/core: support damos_filter->pass mm/damon/paddr: support damos_filter->pass mm/damon: add pass argument to damos_new_filter() mm/damon/sysfs-schemes: add a file for setting damos_filter->pass Docs/mm/damon/design: document pass/block filters behaviors Docs/ABI/damon: document DAMOS filter pass sysfs file Docs/admin-guide/mm/damon/usage: omit DAMOS filter details in favor of design doc Docs/admin-guide/mm/damon/usage: document DAMOS filter 'pass' sysfs file .../ABI/testing/sysfs-kernel-mm-damon | 14 +++-- Documentation/admin-guide/mm/damon/usage.rst | 55 ++++++++++--------- Documentation/mm/damon/design.rst | 34 ++++++++++-- include/linux/damon.h | 15 +++-- mm/damon/core.c | 12 ++-- mm/damon/paddr.c | 9 +-- mm/damon/reclaim.c | 2 +- mm/damon/sysfs-schemes.c | 32 ++++++++++- mm/damon/tests/core-kunit.h | 14 ++--- 9 files changed, 130 insertions(+), 57 deletions(-)