From patchwork Tue Jan 7 20:17:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929583 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 5280BE77199 for ; Tue, 7 Jan 2025 20:18:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AF5A6B009E; Tue, 7 Jan 2025 15:18:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35ECA6B00A0; Tue, 7 Jan 2025 15:18:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DC1C6B00A1; Tue, 7 Jan 2025 15:18:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F26D26B009E for ; Tue, 7 Jan 2025 15:18:18 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AEC70140C3F for ; Tue, 7 Jan 2025 20:18:18 +0000 (UTC) X-FDA: 82981767876.28.4966307 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf06.hostedemail.com (Postfix) with ESMTP id 2007118000C for ; Tue, 7 Jan 2025 20:18:16 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AkcueAy9; spf=pass (imf06.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=1736281097; 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=Cp6u5mTnPRFU4Vdxe3I7RGWgBiCRKei4/NOOyFt13q8=; b=q4xrDAc+LzgHnQEuy9lOmbWG/cuXuFkElPgok8GsQRXOHb6YKwB9TCNov2Z4vlQ6Lgq2kp tqthZZKXCu61tz9MRzk5lFg/dfz6ujLNsjGH6hjzQLxdfYv/FnSJyi3vTdSQwptyPbOfKX l6VJ/AaoZsp2wz6Mm8hW/OfuTtgZZzU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281097; a=rsa-sha256; cv=none; b=L1UChZE8FH0de7OWZ48MDUgjAo7iwWWpb/zurU0hFsC3Zo/AimM5rdnEDNWkaBCecbBT+T kPEv1fqu+SLGNs2LZTOMddF4efsw/MDY3tjQHP/cfOLVN5FqJL2Jy4nA3wwQABKjDAhIXL bIfB9v5AbYwz/0kcfFQWca1ZJxZjdUk= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AkcueAy9; spf=pass (imf06.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B9890A41D16; Tue, 7 Jan 2025 20:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF4E6C4AF0C; Tue, 7 Jan 2025 20:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281096; bh=HXA5UPYM/GgxhLgL56pBJuUIhF/kTZ/VCy8SKfZbnOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkcueAy99tJZzibzNuROIjVEKSp3HVa0hplQr2dlkw1Gb4ZhWDBNd/cLD/u/ExntH 1S/U5SbspW4U4kLrmfEBFI6cn8HblH6UfAiESFY4H8iIbszBodE56UyX7SMBYU6WXz HVYY7E7ePgU6U6V+HYBMV5VdL1FLM/XgidFBv/I6K+8a6YcRCd/pjavVsIt5/57KGX MwyETpH0e2xqRJOjCZIdiskc7WpdNznQpjK9OKaF+Mhw9Uqry1eCro0XRRfVCB4ozr KIz6kJd4eaY1KZj4C97MNDy1IZwc1WP6gJErNxNCPX6D5NYyYCj7liTu3SrtGNfBKi z0G4cHcLCp99g== 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 07/10] Docs/mm/damon/design: document pass/block filters behaviors Date: Tue, 7 Jan 2025 12:17:36 -0800 Message-Id: <20250107201739.79484-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2007118000C X-Stat-Signature: worie4pq9dadt3irie5ih689wmf1dok7 X-Rspam-User: X-HE-Tag: 1736281096-662532 X-HE-Meta: U2FsdGVkX19QdCdhCe8K6N9DtqZf3S6guEd9XrQE/44JXTzs+KEF9zyGCu1vTpt73QmIi4mxEFqEmmSTDNgzutxDl1GdS0OzvXpBxnwKIRVspUdHTB50yWA1FXKCOt5Ne1ZWNHvUt1+t8zdmzfwRhdo0yAug4UyKJDSEBppD4oSbmeOE8upraxGEOwpstWbezp7gguG1Y939C9oyyxzmGhnDQ+YOuOzoSyasbCMa9piEj7obaMe/EslzoAjMCt94EjLNAMz0agoRRN6FglvuIW4OXr8RAA/O1MDcKfU0W258liqBJJ48dsWwyktDAAWgF0Kq+a5YcmYXj1B68VhuIH7dZVHiJPZwCpmjVR5swuk+T40c5Q5ztgAfTLJwAjahR8pemEbt8vTHFBW0gak7PhlGFVr2WhBrYTn8ZeAIsV5PjmHfS/+dWM6f5yHfXNSDIm6mMODMYJMNDbR4Urfza0Szan7omzNYWyPoVqMgyhTFAUUMGk8ziucLWcEEPx070Xdi7Fel3YyRs412OFwgpUFKqpmwfJSM9FOD2B6kjkw66Xk0CBG3BhDH6O9/j6H477QHQiFTGhSbW4JSYN/3llCGnWFV1Q5Hl8rkU2/aPH+a4GnU60arvQVOw6XO5NNZFkOuBjrLZb9f8Bo7p2abXKmpAORc9L5ACNp0WSOehX6N5s34bXEvjGp7r41oP6VFyji7zukFizzheo1CzteroLXHffFssZP0sEe+sev4VZFSIBYBgiE1AhQ9IzUNsLokEozzslOFJarDHR4pavhInVd593ngfUlPIPvdN8PoYU8dIN1Vi4xQh3Gqet62a4JaIo1UgIfHMezAGUUvSTZ8zu6YKahJEzUSIz5G/0qqGHnZwl10Qb+dAT01g9BMUiZ4h69gB3EXlfQIGY1XGKJaiQUXhZERCvvRuzDwuX1hUbNw4uS6Z32yp+RyHeccIvFGNEMli5hQSWkj/rxh84M 5zFYW4cp HPnb7LWfOq3mbbe5eJaH4zIyddq1Az/7QAUt6YO81sFRT1TNc1ioil7fQGmVhseDIbl4yv9JcAXjbiUstq15ll49cXK13lOONS+fi73YSyHKWHbb9JF+XTFfg4q4ItfA3vracMzTFfCW7paQF78iBMFhJwx2/EB2LoGKfCqe4p0xLG4ZZZf1+H1hiaLb5P4Hj1vNy2LlPn9/vATLcE3KofJdCVjX4WE2GkrD0lPTFfIGfBcE= 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 pass/block behavior of filters. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 449eb33688c2..3682e719b8a6 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -504,9 +504,35 @@ 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 (pass through the filter) or reject (block) applying + the scheme's action to the memory (``pass``). + +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 a part of memory is not matched to any of the filters, the default +behavior is applied. That is, as long as it fulfills other conditions of the +scheme including the access pattern and quotas, the action will be applied to +the part of the memory. + +For example, let's assume 1) a filter for passing anonymous pages and 2) +another filter for blocking 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 filter. If the page is not +anonymous but young, the scheme's action will not be applied, since the second +filter blocks it. If the page is neither anonymous nor young, no filter is +involved, so the action will be applied to the page. + +The fact that the action can be applied to any memory as long as no block +filter explicitly excluded it means that installing pass filters without any +block filter after those is same to not installing the pass filters, in terms +of the ``action`` applying. Statistics for DAMOS filters will still be +accounted, though. It is therefore still useful for monitoring purpose. 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 +542,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.