From patchwork Thu Jan 9 17:51:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933079 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 A88E3E77197 for ; Thu, 9 Jan 2025 17:52:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 638326B00BC; Thu, 9 Jan 2025 12:51:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E8BE6B00BE; Thu, 9 Jan 2025 12:51:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48A706B00BF; Thu, 9 Jan 2025 12:51:51 -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 CEA526B00BC for ; Thu, 9 Jan 2025 12:51:50 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8F8AA434C1 for ; Thu, 9 Jan 2025 17:51:50 +0000 (UTC) X-FDA: 82988656380.20.D9C2F43 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf26.hostedemail.com (Postfix) with ESMTP id EFB65140005 for ; Thu, 9 Jan 2025 17:51:48 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LYYfWteP; spf=pass (imf26.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=1736445109; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tsnQFEUzcsbshXorE48/5V+1uFEn/6KTjlN9S3klmwM=; b=bykWaCqK28TM1xc+4p5cbmXCyGhpJrdx6C4MYFCv477tp3olDxs4qAnRsCQBQGn8a9A09f SKCMru9YrkZqFyGD6YFW5Ld7FXFPvtYx15fZhtF3P4ujBrA6BfQhe0Qrw7nF65os0dbBGy eaaeR3M30CSI8Hgi7/bl0c+BGlXCmwk= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LYYfWteP; spf=pass (imf26.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=1736445109; a=rsa-sha256; cv=none; b=HGdNiVGJdzSjAjBp8Xlgc6ZpgRYkC2nIEGkaflvG30bBF/cpzMiUrgyCvxFhauifUT2w64 ml7ywn8HcQ84YOY2Xm349/O1q9aic6M9E/vmpNePkodZ+VUfIeh7R4FoESglSr8hmAR1rS /4+HBUxhmi81tl1ljnEODY8X2TORDmo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id C7AF4A42523; Thu, 9 Jan 2025 17:49:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE000C4CED2; Thu, 9 Jan 2025 17:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445108; bh=IPoCvtuIbYdm4duAoYfcI65fUkKJC3T/ANKcwt19fcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYYfWtePMZTuxd4s2GRIBuHgMcxlCm6/g/nwHTX+qzJ7Q6oLzDb2N+B1qx/ANy6JG L1b4uwDm3AKkYPa/sfWJjSAL66RbSTW3nLyZWT9jTaASpJ4cEXQ74jjvoyilcVQY1d PP7mKtMt24H07N0YUyegP4mhDWuLcRUT9CUFr2gTBJQRpEUpGiCB83EIe8lfy2Xhzu oTP6cwo+p9jhLLfM95fIY6vLvK5qkcacQKOoIytnlhKZccWnrLkiW12ZH6my+gSpAs EQd6ed51aVz/lHT/cjkYTLpliY6WIn34vQifkLkZ5cCzCG4V6mPAg0TeF79cD7jOhU yuOlq4RRSgFHw== 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 10/10] Docs/admin-guide/mm/damon/usage: document DAMOS filter 'allow' sysfs file Date: Thu, 9 Jan 2025 09:51:26 -0800 Message-Id: <20250109175126.57878-11-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-Rspamd-Queue-Id: EFB65140005 X-Rspamd-Server: rspam12 X-Stat-Signature: q5n3h4u5ifie164nkw3esqe8ksrtn9dw X-Rspam-User: X-HE-Tag: 1736445108-438279 X-HE-Meta: U2FsdGVkX19Dtw9GXkdoH51mv1tGPXS6zEmbTSvDlgx5vzz7Hq8ees6Ob/FMwZs59g4fRWJxoqFmnbAqF26ZQRvC7pj+Jh5fkU3i0N8qRM9Ct5y6WJsI0il9vdBZDKL6ze3ZN3QdiTqP1OCzczl1sIhSjxLxbU8UqiI0XCNxMDWXUk1lSw4i+X7Es+ItS0Tg2VsnbHXPyucrzO3Eyw42zzfkTHcuyClYehg2ezcuHvXJoyM5i5ov0NRrxXFD9LFdn/wB2JABLHwzbmJBQf/L9RlHu26C4zgP3VHwU8AaV1KHVEbJJ4zuoHRHJK6MRxoTN0dPE8qpUpMp+cv6Mpyg+hT3sV3idiEewYgBTRncz7MoIKN8DCWkATpuWM6ET2JTAjTIXsf4FwS77ZUCNDiQnCIGU9XKudwCGvO3qBPOGVJiy3rxvwPJlreY+pJRGvfXNZpUU9W7W2dySdY6l9bNGbHs4AaN3oSbaUGK7H7hg7rNaviYfX/bkztm5ELso+4H0An2IJYXhC4u4cKNc4dwnacOf5SQhl6/ckY9OVoEf74uByPX1tIpQmTxwtISCM0db6caT3+H6jTpL/BMTNJd4R52UAJL0+JNY2fNT4U34w07CEbW2OveNczdrQSlZI3iKoM6pyw3sOpNjiaQ/cDzr5h6vE50rMyaXke0x3CGwHOyi/B2nfL6qwTJvBt16Wkv0kqH310Gn490bPUtLNEfEENOk3sJLp2hyVno0vY77A/VbGP4PAKL/3EPs2MYBNF++m6sNNij+flAjKGuKwv5I4XahlYEB12vl/J8wQKWTyQOe4fE4LHDYS2a2wR+6yhcr1wBqULIKW+cUS2NaRMbKf8Arqw1ke6gibAFDXjNfoIE+IdKyk/Z8WnOrwhoaF0EvnRJ71n2fSqUq5pAyGGB0G0/EfrvZljVR5jYRq16Cpr1SXVeaICR4ETBCH8zbQIVyLR+Vo4tRKYIyMHU4YF e7BRcDoc wwN9SHx/NGfhxk6yJKKJe9h7VffX/j2QMpv9DG1auqwyqpC+ZYez+0yaTKkm2Qgj9fUMvBxSAu18A5QvTg5QSYhdO1hIS9dBtnUDCb16w9TaCW17UHCEyjHRDHiqJRXROX+GcmeyXwnUFIEXFHdkl0d0blH0Qnm6h3x66DhIDzD/xc8ODZs58gy1GbIaZHMm3J+IWhTKnzCEr8wC3H4geVYw51U0bIrkAakKz8kYdN5WImXjWglTofZrkaiLMpLHidNfebRn+bUJbA4NlOKrzC44uaYCkE66P+i03f+pw4vRlGJ0= 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 DAMON usage document for the newly added 'allow' sysfs file for DAMOS filters. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 8df3357dcfa3..f0d0c20711d6 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -83,7 +83,7 @@ comma (","). │ │ │ │ │ │ │ │ │ 0/target_metric,target_value,current_value │ │ │ │ │ │ │ :ref:`watermarks `/metric,interval_us,high,mid,low │ │ │ │ │ │ │ :ref:`filters `/nr_filters - │ │ │ │ │ │ │ │ 0/type,matching,memcg_id + │ │ │ │ │ │ │ │ 0/type,matching,memcg_id,allow │ │ │ │ │ │ │ :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds │ │ │ │ │ │ │ :ref:`tried_regions `/total_bytes │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age,sz_filter_passed @@ -406,13 +406,14 @@ number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each filter. The filters are evaluated in the numeric order. -Each filter directory contains six files, namely ``type``, ``matcing``, -``memcg_path``, ``addr_start``, ``addr_end``, and ``target_idx``. To ``type`` -file, you can write one of five special keywords: ``anon`` for anonymous pages, -``memcg`` for specific memory cgroup, ``young`` for young pages, ``addr`` for -specific address range (an open-ended interval), or ``target`` for specific -DAMON monitoring target filtering. Meaning of the types are same to the -description on the :ref:`design doc `. +Each filter directory contains seven files, namely ``type``, ``matching``, +``allow``, ``memcg_path``, ``addr_start``, ``addr_end``, and ``target_idx``. +To ``type`` file, you can write one of five special keywords: ``anon`` for +anonymous pages, ``memcg`` for specific memory cgroup, ``young`` for young +pages, ``addr`` for specific address range (an open-ended interval), or +``target`` for specific DAMON monitoring target filtering. Meaning of the +types are same to the description on the :ref:`design doc +`. In case of the memory cgroup filtering, you can specify the memory cgroup of the interest by writing the path of the memory cgroup from the cgroups mount @@ -422,25 +423,29 @@ specify the start and end address of the range to ``addr_start`` and you can specify the index of the target between the list of the DAMON context's monitoring targets list to ``target_idx`` file. -You can write ``Y`` or ``N`` to ``matching`` file to filter out pages that does -or does not match to the type, respectively. Then, the scheme's action will -not be applied to the pages that specified to be filtered out. +You can write ``Y`` or ``N`` to ``matching`` file to specify whether the filter +is for memory that matches the ``type``. You can write ``Y`` or ``N`` to +``allow`` file to specify if applying the action to the memory that satisfies +the ``type`` and ``matching`` should be allowed or not. For example, below restricts a DAMOS action to be applied to only non-anonymous pages of all memory cgroups except ``/having_care_already``.:: # echo 2 > nr_filters - # # filter out anonymous pages + # # disallow anonymous pages echo anon > 0/type echo Y > 0/matching + echo N > 0/allow # # further filter out all cgroups except one at '/having_care_already' echo memcg > 1/type echo /having_care_already > 1/memcg_path echo Y > 1/matching + echo N > 1/allow Refer to the :ref:`DAMOS filters design documentation -` for more details including when each of the -filters are supported and differences on stats. +` for more details including how multiple filters +of different ``allow`` works, when each of the filters are supported, and +differences on stats. .. _sysfs_schemes_stats: