From patchwork Thu Jan 9 17:51:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933075 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 D705CE77197 for ; Thu, 9 Jan 2025 17:51:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D64946B00B8; Thu, 9 Jan 2025 12:51:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEFBF6B00BA; Thu, 9 Jan 2025 12:51:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B177C6B00BB; Thu, 9 Jan 2025 12:51:47 -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 916476B00B8 for ; Thu, 9 Jan 2025 12:51:47 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5490E14030C for ; Thu, 9 Jan 2025 17:51:47 +0000 (UTC) X-FDA: 82988656254.14.5E02C32 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id A4187A000D for ; Thu, 9 Jan 2025 17:51:45 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IMh+T2KB; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736445105; 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=HoTk9nk6W/ifF98vVvdxLOKzuthUlirGZ+ZWTKhGMtY=; b=8VV34ExiB4dZvPlfFujiBNJktZNq23qpGH9eFzBIIE7isr/n/8E6hzPzWd+m+KogCyipof BNLwDuHt8Sji9A/RqJiUHvAakqLp3ihIUIRC78iInxGQJAwlXsM0G1D1QoQzg2GgEzzje5 cWaHBtyT/9HMKYfqo1LiRX7Ey6fSpOw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736445105; a=rsa-sha256; cv=none; b=fGDDbepiHEmblA1gUCclmq/TQ6jAkOG/BvIdqo+z2YhG/ZDNx2+kz+dVPNPoqQk/zGBPOA oScj+BBFN7y/63m2cVU3EdiB7nwWgRnHaSTGELGDKtbMiW5BYFKmb6xgHdJZXui1h2RN+c 8WrKqU5ImjIkdC6wGs6dxeFpAuQf0Us= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IMh+T2KB; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CE0AB5C5CDC; Thu, 9 Jan 2025 17:51:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AC9CC4CEE5; Thu, 9 Jan 2025 17:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445104; bh=D5K8J1LD/PiUXT0vcupBmI3FxsSeWohef6Oiv0g+Rfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMh+T2KBV7HCpVmbGHyYNBHIs5nafW8flfKwJ8siqr6+f87zJ2q+W0QPIMWaUAbF4 YUX11l/s0wpwVZZCj35/WeG8fRW5kuu0xGMp/W+raK3N66kk15nIZV4GG1q95qEa6x 0Aap+9qtd1SV8m5hKzSkFVSb6aAvOITaRlZtGEPmP5ZpwJdt3FauH1BzvrhlfeHOs2 kqAfpB5VAQS/KTqHBt8Opp/kKhqMxjogmWkBQK94vpWZ4UtxtHhv+4uXpDlLwcyGM2 YNkAZZ6SV/v1KJ1Lt0AxMiQgUSzp8CjKKFqN6Ahe7DaKsayGVTcHBdSEA6ZtB9w4bC WSVHI8j/7bvSQ== 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 v2 07/10] Docs/mm/damon/design: document allow/reject DAMOS filter behaviors Date: Thu, 9 Jan 2025 09:51:23 -0800 Message-Id: <20250109175126.57878-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: ciso65onyr9pih6ij7e97uhuk48q9phr X-Rspamd-Queue-Id: A4187A000D X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736445105-997192 X-HE-Meta: U2FsdGVkX1/sH+psGNqOI/40yxT1Frfh8oxpWipSwe1ofGFv0IVUaZ5ugB6BhW0KXFIH7Y/vrdMIvQRSGTSbdUpf63ikkYQmgGrKfpi0B49D3Jj1mEOLi210sjdlObEUldW69nJe7+cOrL8odHwDTWqkFMqP/ewutkzAkG0rc6YU6HUKxIXK2szdoC5nkP5EijkJ2JptcZKo5520jNgyTRsRUqmEadyqsroRr9eB8+rNoktSycptDNx7BPIioNRyk6WNLoSEaCab7CVGNZ2J7gI+LdzsoXSGrWjesJATRnP9tMiYcYDhdlTKzBlbz72KP7JImUoWV/GEy/mirCFBodaRB5RQUIHYFp5nUOeUnTBJpB+XxNvc4TGodtvlK3h1pmUqUaOpMGQAmlkkKs1YCS5UfRVWgWgepf9SfnQ540KV4Y4HceM4fWjGjZLhCicGq0ChvyO6nKMDNieabvD2xDaLRe1mxRg872B7wDQOtUR0seUrrTI0FZVal9V8o7p6iT/5CqrUaMr8Eu0jY3jCNPOWpQlgrFoSm4lPji6jgEe3/SQ9sgi9WBFboooScKcfEDmKsPhHPW14Tr1r+pl+McR10NNnUh1vLCJOwxBvCBssskuz+BxSQliDL+cYnn0bXNe8MvchG3LsAkbHmpgbFOG5zC4qJG4SBIemsa0dvV4mxQHwdNaJ23N4TdaGz7P9p+Zv3sDpT1oydsGzpr0gMfYa7JIg6OPQ8ZXoOoMbcAPaQAnnkC12OCJTmVDR96ct4xW2PpdXp0cAUuX0VKCIVealagNGaRzyysh21VjP8VE3lMI3LySCMwuPqf5iGWkBxIVKGjkIB5YSBN/OGTjteao43FIqxY1M5x2A/era8omnns+RBW/qkpy6TDTGfgJ2fKCpa98Q6hW3zdkbz+7GXozfpouJT38ok3vsi4yK9WjUhJUz+8NP0gdBFQXBdwAVUSEs4Gv7LcWbNzi8CuF HJEkZxvg dHbrJPdQI7sjMMGuiFSITqV2QAdVb6SJSN+MwdgWIkUif1sCSg4+HKUIvUU7X0KASqDEY4T6PbCOm4W9TPcX/bF2WCKJoyYxzfaC6ziBlGcEeLq9A8g70v0/B9s/z0vqmjg8SS4ug4EqpZ5wn3hvC6bfzo1gZYy4PYWCrfTe98Cy2rAHlt2f9tbojWclf121b/AaISSOf31NlO2mu9B9ZkBVdpyzaeNi6oZhb1wN8Pm+un+E= 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: Update DAMOS filters design document to describe the allow/reject behavior of filters. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 33 +++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 449eb33688c2..667775bab86c 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -504,9 +504,34 @@ have a list of latency-critical processes. To let users optimize DAMOS schemes with such special knowledge, DAMOS provides a feature called DAMOS filters. The feature allows users to set an arbitrary -number of filters for each scheme. Each filter specifies the type of target -memory, and whether it should exclude the memory of the type (filter-out), or -all except the memory of the type (filter-in). +number of filters for each scheme. Each filter specifies + +- a type of memory (``type``), +- whether it is for the memory of the type or all except the type + (``matching``), and +- whether it is to allow (include) or reject (exclude) applying + the scheme's action to the memory (``allow``). + +When multiple filters are installed, each filter is evaluated in the installed +order. If a part of memory is matched to one of the filter, next filters are +ignored. If the memory passes through the filters evaluation stage because it +is not matched to any of the filters, applying the scheme's action to it is +allowed, same to the behavior when no filter exists. + +For example, let's assume 1) a filter for allowing anonymous pages and 2) +another filter for rejecting young pages are installed in the order. If a page +of a region that eligible to apply the scheme's action is an anonymous page, +the scheme's action will be applied to the page regardless of whether it is +young or not, since it matches with the first allow-filter. If the page is +not anonymous but young, the scheme's action will not be applied, since the +second reject-filter blocks it. If the page is neither anonymous nor young, +the page will pass through the filters evaluation stage since there is no +matching filter, and the action will be applied to the page. + +Note that the action can equally be applied to memory that either explicitly +filter-allowed or filters evaluation stage passed. It means that installing +allow-filters at the end of the list makes no practical change but only +filters-checking overhead. For efficient handling of filters, some types of filters are handled by the core layer, while others are handled by operations set. In the latter case, @@ -516,7 +541,7 @@ filter are not counted as the scheme has tried to the region. In contrast, if a memory regions is filtered by an operations set layer-handled filter, it is counted as the scheme has tried. This difference affects the statistics. -Below types of filters are currently supported. +Below ``type`` of filters are currently supported. - anonymous page - Applied to pages that containing data that not stored in files.