From patchwork Thu Nov 24 21:21:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 25712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3619136wrr; Thu, 24 Nov 2022 13:33:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Vz1MN36WnwsjWa4mbanqM84Uzo9e7PrZNoxI/nHMlu8k/zTAg6FyFrQgHbrPnAG482CvN X-Received: by 2002:a17:906:3a41:b0:78d:9caa:31b7 with SMTP id a1-20020a1709063a4100b0078d9caa31b7mr14751701ejf.263.1669325583588; Thu, 24 Nov 2022 13:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669325583; cv=none; d=google.com; s=arc-20160816; b=XoyZC+lBlCUz6aq/okX4GR6U5nJkmwElQJU22Hun1R8rBXE1M+KaObK9cHVlwsihRM IeVxkof+eNn/CGQEqDU+2pn9QZZ8T/81jHxJCLDAqqWWDBQH2wru1G3Vd4nKJ2j1Eoiy Bou0SCbnGjLgO1npr2w7qyH3MudXAc9CERjD03QT546+gIbT9n9ruCJ3SONKX0Zh7hYL ki/a/iorzis6yNU+jg7pA0eB6+OhSpiE4fJFWtuc64r9knLYNBW8uI/5jOgJiLRQojhe gg3+w/POclZjdS5O9mf/dnAoMZCSvymRFaPfMBQL37w0BqHmW3fiUQec5Ga1m/EWnv5+ tcEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gpmeBORiZpRF2beWDn7dZTCiE/JqtbjFsMCpo3MlrhI=; b=hMZfvt7TwYaXBfs9CqbK1bd8l2XD6ykUEGu1i2bS5ruSJPmGrtDiLGGuU+U+wiIveB lXzEIKJ01bvfj52DjNDuyxlBopO4+XjEzQLtSoWne7YrLoPCXyODRJAolf6RASGFG1R5 TbzIp0I3fjRnAHaCfteUTF8l2DOJyK2iPtE/GCIFOANiuHychL9begAuNs94cQZO16UL o31MkIxGBTO2DpEfeYb2zVMUWv0RZFLLKguDTEb8sdw2MFagPHxrsWu3tVDXwVkMdNkf kq2W/it1MBn/rILQF5R+xvk7pyimFs9vXIUjVxJGolWT9aqmD0kPcLAmIz84E+1V/Tkg jSWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qUjgEscQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170906974900b0078223ff2756si1926137ejy.244.2022.11.24.13.32.37; Thu, 24 Nov 2022 13:33:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qUjgEscQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229756AbiKXVVy (ORCPT + 99 others); Thu, 24 Nov 2022 16:21:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbiKXVV3 (ORCPT ); Thu, 24 Nov 2022 16:21:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B300950E3; Thu, 24 Nov 2022 13:21:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB52CB828DB; Thu, 24 Nov 2022 21:21:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39D8FC4347C; Thu, 24 Nov 2022 21:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669324885; bh=r1rD9KyNMBqJg8aGe8o3Z8JXG+myDQ882BtgLSHPqNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUjgEscQClwo6WemlMmyVkQcyAdOazaD4oNfXaCdV2/UsJsDcRJsDeEGq2OaUHB0Q dZXgZFk9mMS2qVQZEBPnOPMqkJ6eeMeU5XxquL3Mh/lR/iwksqM9Mj2iofHucZwPDQ DhzkcbCF8tsK98kfcM+3CxgJudUlWk4s+59VPkmyRvSbTKFTuQ928ckHt/00s8bCXF Qcb7yPnReQEQNzhEyT0OPXVlsHqal9sqMXP/y5pzAJjcshjaMSy5dBVKU9GTx3+U+3 kameP1nAqmJIXnsz3XobD1ANGRnEHhNf7wOw/vMo5uekrxo2lu9HKwvI0lwgQD8otk mFPTE1n1JQD9A== From: SeongJae Park To: Andrew Morton Cc: Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [RFC PATCH 10/11] Docs/admin-guide/mm/damon/usage: document DAMOS filters of sysfs Date: Thu, 24 Nov 2022 21:21:13 +0000 Message-Id: <20221124212114.136863-11-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124212114.136863-1-sj@kernel.org> References: <20221124212114.136863-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750414743317718048?= X-GMAIL-MSGID: =?utf-8?q?1750414743317718048?= Document about the newly added files for DAMOS filters on the DAMON usage document. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 48 +++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 1a5b6b71efa1..3d82ca6a17ff 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -87,6 +87,8 @@ comma (","). :: │ │ │ │ │ │ │ quotas/ms,bytes,reset_interval_ms │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil │ │ │ │ │ │ │ watermarks/metric,interval_us,high,mid,low + │ │ │ │ │ │ │ filters/nr_filters + │ │ │ │ │ │ │ │ 0/type,matching,memcg_id │ │ │ │ │ │ │ stats/nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds │ │ │ │ │ │ │ tried_regions/ │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age @@ -151,6 +153,8 @@ number (``N``) to the file creates the number of child directories named as moment, only one context per kdamond is supported, so only ``0`` or ``1`` can be written to the file. +.. _sysfs_contexts: + contexts// ------------- @@ -268,8 +272,8 @@ schemes// ------------ In each scheme directory, five directories (``access_pattern``, ``quotas``, -``watermarks``, ``stats``, and ``tried_regions``) and one file (``action``) -exist. +``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file +(``action``) exist. The ``action`` file is for setting and getting what action you want to apply to memory regions having specific access pattern of the interest. The keywords @@ -347,6 +351,46 @@ as below. The ``interval`` should written in microseconds unit. +schemes//filters/ +-------------------- + +Users could know something more than the kernel for specific types of memory. +In the case, users could do their own management for the memory and hence +doesn't want DAMOS bothers that. Users could limit DAMOS by setting the access +pattern of the scheme and/or the monitoring regions for the purpose, but that +can be inefficient in some cases. In such cases, users could set non-access +pattern driven filters using files in this directory. + +In the beginning, this directory has only one file, ``nr_filters``. Writing a +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 three files, namely ``type``, ``matcing``, and +``memcg_path``. You can write one of two special keywords, ``anon`` for +anonymous pages, or ``memcg`` for specific memory cgroup filtering. 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 point to +``memcg_path`` 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. + +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 + echo anon > 0/type + echo Y > 0/matching + # # further filter out all cgroups except one at '/having_care_already' + echo memcg > 1/type + echo /having_care_already > 1/memcg_path + echo N > 1/matching + +Note that filters could be ignored depend on the running DAMON operations set +`implementation `. + .. _sysfs_schemes_stats: schemes//stats/