From patchwork Tue Feb 18 22:37:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13980987 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 632E9C021AA for ; Tue, 18 Feb 2025 22:37:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D0502801AC; Tue, 18 Feb 2025 17:37:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 532B02801A7; Tue, 18 Feb 2025 17:37:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35D7C2801AC; Tue, 18 Feb 2025 17:37:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 14C8A2801A7 for ; Tue, 18 Feb 2025 17:37:22 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A01004B95D for ; Tue, 18 Feb 2025 22:37:21 +0000 (UTC) X-FDA: 83134527882.21.9816C7A Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf09.hostedemail.com (Postfix) with ESMTP id 04DBC140005 for ; Tue, 18 Feb 2025 22:37:19 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GFPQXAh9; spf=pass (imf09.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=1739918240; 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=EYPyL3EH7h1fgNW7JSKeeuYdIn9/GfxoINRjg7QARrw=; b=YIV8jRVcJvWh57q8vEx5O0aBRFozRoDGQuAgJN+KD8Cbt6KxQmX5aO2G+ZuZRWylUlMpdC t07EBkh7Sh57HShvJY5v0H00CNiR80XwJPLA+fv9lSmPXYLM3QB7zrVmbHE5B0flNFpg7F qUvbt5Yp+Y73K/KJ+512hn7fxNA2OyE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GFPQXAh9; spf=pass (imf09.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=1739918240; a=rsa-sha256; cv=none; b=ZrsdApDj+oxUplVvo0QENis9vwAkSslXR1X/wBUQ6SdCEr4xBDH1YVH9H1kf3rs0fDyd0V kRfsG5tPITMmw0wfOP2LuPFGdli9Z52zliY9u9mSOQFkK1cONd9PYIzgeoSvB1XoTung8h y2qyT3My997huo37GROfrmOuYXinEj4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 8E9DAA41DD0; Tue, 18 Feb 2025 22:35:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14831C4CEEB; Tue, 18 Feb 2025 22:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739918239; bh=cs8GWYYnDK1JIzMR8vzHgXGMzwJ95MlnMu1w0ifV6mQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GFPQXAh9VN+N/yc8FjF9P74m7RQSFVU5vj7N84H2Hx5TnOc5Q14GoVjY0jtuSRlVS EXbY1/CzBriQvD/ml+QMe7tsrwejA4KolgzANUptgJNMuunGt9kyB7WfAcz+uYJroW Qc+HeqmIZpJtzk/tpZpt9wJkK25AVCWMKOVl1Z+YBL1qTr9dNhB2lZ82cOh6l3uqMk rDqRZJX4JUYA7x2Rnuj0MiMJzGQW6+sK7fEPZjnBJYWKLuIINxYFCuiKWzP9iKc7d5 KZf6X4g1kpvOllzbjLMW0S/oIffkc9Yjg33uXj3NS093kPNgMnHq8OGKLf8Og7OLLY X1pUSNhMRtpzg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/5] Docs/mm/damon/design: clarify handling layer based filters evaluation sequence Date: Tue, 18 Feb 2025 14:37:07 -0800 Message-Id: <20250218223708.53437-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250218223708.53437-1-sj@kernel.org> References: <20250218223708.53437-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 04DBC140005 X-Stat-Signature: gwgamgs8dwgbgekrpazf6bwg3nojd6k8 X-Rspam-User: X-HE-Tag: 1739918239-510982 X-HE-Meta: U2FsdGVkX1/q4dZXaUtN0AYMApNA5roM/NKDkHR+LYHsW76neHKsi7Uu1GUVGrqongvhlKDVpdrbv6npFiCaui3X+WVOYEniWogwseQ3TTk945kbFvrSR5vgIVCFNJNsX6ys8VIAaQZobU8fbEaGjdw19dOoAGY/CgyXt4pLLUiR7EClapSPQOxrVJPigZkjm8Lr+54KvrwKmXwl12D6Atv4p98thfccKF21IhSXRCN77ay5pXFkQdiLOiHwHaUO4LMVaJKjNdxkqDiQRWG3nwNGZhpV3RIplSh60c3P2oYeLN6BEyfVEYdMN9+2dbk/S8YQtVwg9WXVBjEUc8+Q6AU9KtqESRPbtuPatboBcGF/Wos/Lek9MZWEYw9M24goyL59LuIZPN9qeKrZUBejZ4qNzrj9RQj2UNTxoMKN7uXrl7qwbud+goHLrbHQSRaDp09ErGRa2e/ueToLByOwmsTGW4R+rT9a/VonYbqU6JbLoVwrWUXLphi3oeU9CtYQpj2UTkO4bjrOB+6A/M6jEF6iGAbvMyk7CCTULOP3m1XL/5v9U9qGGlcwT3zfno6LkIcRYSRPG9j2HZ7w4Mp8i756QEKOTYo1QwvXOCSgLxaL+Kqm9wbc+mKQJXeSDxmOCYrkvn6TdwYhuUuSJ9/VA3HtKFiJVn3O5gE88v3LPPB2i1JfpEOOS9SxQeEJvS6FrQ6P8PiDfvwajCbNI2sxH7zhtOOFhFrkH/Mh28+pA5NXGszkrqtrYQJdUZmVxrtfl020d6qZZN5k7t0UzHX2JjsCm/J8+NhWE5CYRkEjQWs1EZTP82ZRC5sR8s4E6Re5TvCHpFhJGOplwU03m4xk9IgoI2JVWgbof797OXIzQOC06QGEIU1SU14975bbphdFbQhKwu20Y94f+cli98bd14Jjf9/N9J8js9uCyfkIo9Wl6D4GSJweg0lpX4t6Bp57PJBWBbnozVOGNUOpEK6 AnGgZPuk jHvpznhjvMq1i6uLefpkPwm9XHIgi5hE9/ugrH8qNkG618HT4unq0JIFeNxO8dad51h3HwtZc3x1xjwYKafKPiAw6plsSRM8AjP9wux0ncxeTf0xJCDIhj63puzda2lGVi7aWU0f3MFE2iaz3/JrhL2/kfBloa4yRKVCYq6rqJ50lwZ2os8eMxOPCCVy80VouZlWvnBhWa30/V2FTrSRR2eQHOGfALr4USSnzPdyxA6txbRM= 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: If an element of memory matches a DAMOS filter, filters that installed after that get no chance to make any effect to the element. Hence in what order DAMOS filters are handled is important, if both allow filters and reject filters are used together. The ordering is affected by both the installation order and which layter the filters are handled. The design document is not clearly documenting the latter part. Clarify it on the design doc. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 7360e5ac0d06..8b9727d91434 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -569,11 +569,21 @@ number of filters for each scheme. Each filter specifies - 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 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, +hence, support of the filter types depends on the DAMON operations set. In +case of the core layer-handled filters, the memory regions that excluded by the +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. + +When multiple filters are installed, the group of filters that handled by the +core layer are evaluated first. After that, the group of filters that handled +by the operations layer are evaluated. Filters in each of the groups are +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 @@ -590,14 +600,6 @@ 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, -hence, support of the filter types depends on the DAMON operations set. In -case of the core layer-handled filters, the memory regions that excluded by the -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 ``type`` of filters are currently supported. - anon