From patchwork Fri Jul 28 20:34:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332648 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 D7E38C001DF for ; Fri, 28 Jul 2023 20:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4F228D0003; Fri, 28 Jul 2023 16:34:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CFE986B0074; Fri, 28 Jul 2023 16:34:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC1638D0003; Fri, 28 Jul 2023 16:34:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8457A6B0074 for ; Fri, 28 Jul 2023 16:34:52 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4CB89A05AC for ; Fri, 28 Jul 2023 20:34:52 +0000 (UTC) X-FDA: 81062174424.05.2A810F7 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 9DA8880009 for ; Fri, 28 Jul 2023 20:34:50 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=p2r8hu9C; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690576490; 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=f1+kUO/1jvUs16oQPMZPa4+TQlRIDLtHo6KkeqNkj7g=; b=KkKsB/S2cmikq1t6KhNasiY6oKtywGrh1jd/8kX3NCMKY42Z1RviX26do1sTnpmpPSdJ9L F2LQVI63NTCWul+9tWN2bCDwxDwzmq/iqWbQMfUamFEWWib9nCmQQI1C1ZleJz0liPsM/1 Zv1sMX+A2rNXz8uKQuFRSpLXITmLDyA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576490; a=rsa-sha256; cv=none; b=JfcG1GVfWoUdFNthuX48HNgCJ2dcJM5fB02CwSkN5bO+9hmgPq8UAbeG+e0xZnyQ91vWX3 Ysd1eNbSxFis2HkwyeFe8pVzVInEC2If3qNvIQEPHS7lugH6DXBTdYFD07YO2to6bfgtUq 3cgJOy4zoUNbHLlGn+SbAfmumlNyrlo= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=p2r8hu9C; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAE5A62205; Fri, 28 Jul 2023 20:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B668BC433C9; Fri, 28 Jul 2023 20:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576489; bh=RNhaUHFt4yEDSg34n1AIbUDtUgo0To5YvQtFN1055is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p2r8hu9CmFI364JLZUBG5moYhkILhGzb8EUF5UUqi4zpjISMyATubHTf8iaRu+Y3e B7Mb9YlocLRyG+jrKWyvPFKDQJHIHMnMaPTd9txEMbGeYRaSJwgaAbCHqkHQg9K0fW VibqHFWGC5EnpYUnVK2qUxRfeduyXd72rk2CDLfw2EbHQyq+wZyKy/1sqT5yCbjDgj /aoJsj5yLhShWP70po7j3u8d9kh4bpVU6glpe2lFV8+KPa5zSjLDjgg/5R/XkpKt2P EevGd1FGvMBFcAwR88pJIotq/h/bcab83pCI7HEFhB+wwMDetEl+nhyJtU+EfdmRb8 2FkRJskRSLGqA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 01/13] mm/damon/core: introduce address range type damos filter Date: Fri, 28 Jul 2023 20:34:32 +0000 Message-Id: <20230728203444.70703-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9DA8880009 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: argo7bxube3odhqmcjyojpg7yofthb7c X-HE-Tag: 1690576490-884610 X-HE-Meta: U2FsdGVkX1/4Bq2m6i1+Q7FiMckNSy5qS2tx/ApHYR1/ptEqfTahPRqt6XzckYsPjlpS6i1DQ2g1xpXYzUswSNA9pFMM/KpqrVAsfZFmI2EYfUaKxbc54Je8qD+jou4yibvOVfsqTKvHhc5V2++m53B48gbbrHt+AoIiRWoBg9F1PBJvT4J6ROYX3i/4NJvh1zJvF/SGRxeIVYZtvoGtHSiAMipw602rHNMXpJ8eB/uq4s0QMwFqW1ZP27PcL20BFrhHe2AIV2iayOnmo/Ztzi7yiXtUNiPcbOy8aDROgV5UYWqxlqFaCFC5DaXrTacEFE8X01Ap50WaXWUPcMPF6LgXTgfOjlBy298V26uIXyUR78USlTfKiwymc5yZ8Q0xQ+7mweDy8RwTIRDXmbbjMRkj+SmxT8gxDanf3JVXS10WMefcyitNccuekPqSCF0XnLNKnedd5Tb5JHDRpgyJY4aP3R/8k4ZCK4CYaURfxRS3u6wqE2qNjamT2Nc3m8xHgdw8dfhe+l0ygjg/0PdxB8NdjjCzyeksrEs41vdE4ERW9N18E723fH28pzEH2Vcpl5njtWOtj+WrTajujFMQDyd76y7i26u9yK5sUWPv1hxTw9EN1npwbMuC8pmTbKPl3yTExG+B+PUaKqhgKzh5xSgm/Kp9B9e0cmK5TW6aVYDyDZIKSOoVMZGcb2i/f4wM10623rGPuNznVHH8cW89pTRZaBVtv5PEw8r/XTnXmqLVyrTsNpeb8S8db0654b6sYhTMnpKAZcINCs0OkcOoMFdibEuPbwzX2fkyd+EP52qJ30Pf+g/JN7ESvhMWtU4Ij0euOKPOLfqtdvzAp768BaNbmuh1uBNWfgxUwagIoK6CYpkQXyj4PZWCUHe+WLl6RaP5ia+y4mZLrNYf48kwC1NYe/EPtscfYmmWABk3j4GT5JYWpExQtFZT4KIP+beUPFGbiJk7PNTDQABTbgX gyzlyaMN AuI1VOz6f6CRhPKmRUmbQZgKL12FYFeeQBXbTjZA26vbFr3gvK+RTZcUqKmfCwHN9pn+szFljAi0spubLqhb5fztD54I6+SnZB6Pgpl1u52Y1qfBetLodxJOgnG2jtTu2sWk0/xlD6J6UBt6blXogSlQj/I2lfiI4sMHjxCrDs2UgKoafpRUS8d1P4ElV1VPotC6Lvnli9Dj5wj3b8rJDSBzyWag2kmPnUxSoae6hpv4JbFSSqah1mcSPahzv4soRrHT0gDFMk254fy8r3ih3pdiabaAaOXKvkfl2HTidFj2JEal7M0BbWskhb69zYm23zn5c44W45FuiwNQCIdqm8wUt5Q== 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: Users can know special characteristic of specific address ranges. NUMA nodes or special objects or buffers in virtual address space could be such examples. For such cases, DAMOS schemes could required to be applied to only specific address ranges. Implement yet another type of DAMOS filter for the purpose. Note that the existing filter types, namely anon pages and memcg DAMOS filters needed page level type check. Because such check can be done efficiently in the opertions set layer, those filters are handled in operations set layer. Specifically, only paddr operations set implementation supports these filters. Also, because statistics counting is done in the DAMON core layer, the regions that filtered out by these filters are counted as tried but failed to the statistics. Unlike those, address range based filters can efficiently handled in the core layer. Hence, do the handling in the layer, and count the regions that filtered out by those as the scheme has not tried for the region. This difference should clearly documented. Signed-off-by: SeongJae Park --- include/linux/damon.h | 22 +++++++++++++----- mm/damon/core.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index d5d4d19928e0..476f37a883a4 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -226,16 +226,24 @@ struct damos_stat { * enum damos_filter_type - Type of memory for &struct damos_filter * @DAMOS_FILTER_TYPE_ANON: Anonymous pages. * @DAMOS_FILTER_TYPE_MEMCG: Specific memcg's pages. + * @DAMOS_FILTER_TYPE_ADDR: Address range. * @NR_DAMOS_FILTER_TYPES: Number of filter types. * - * The support of each filter type is up to running &struct damon_operations. - * &enum DAMON_OPS_PADDR is supporting all filter types, while - * &enum DAMON_OPS_VADDR and &enum DAMON_OPS_FVADDR are not supporting any - * filter types. + * The anon pages type and memcg type filters are handled by underlying + * &struct damon_operations as a part of scheme action trying, and therefore + * accounted as 'tried'. In contrast, other types are handled by core layer + * before trying of the action and therefore not accounted as 'tried'. + * + * The support of the filters that handled by &struct damon_operations depend + * on the running &struct damon_operations. + * &enum DAMON_OPS_PADDR supports both anon pages type and memcg type filters, + * while &enum DAMON_OPS_VADDR and &enum DAMON_OPS_FVADDR don't support any of + * the two types. */ enum damos_filter_type { DAMOS_FILTER_TYPE_ANON, DAMOS_FILTER_TYPE_MEMCG, + DAMOS_FILTER_TYPE_ADDR, NR_DAMOS_FILTER_TYPES, }; @@ -244,18 +252,20 @@ enum damos_filter_type { * @type: Type of the page. * @matching: If the matching page should filtered out or in. * @memcg_id: Memcg id of the question if @type is DAMOS_FILTER_MEMCG. + * @addr_range: Address range if @type is DAMOS_FILTER_TYPE_ADDR. * @list: List head for siblings. * * Before applying the &damos->action to a memory region, DAMOS checks if each * page of the region matches to this and avoid applying the action if so. - * Note that the check support is up to &struct damon_operations - * implementation. + * Support of each filter type depends on the running &struct damon_operations + * and the type. Refer to &enum damos_filter_type for more detai. */ struct damos_filter { enum damos_filter_type type; bool matching; union { unsigned short memcg_id; + struct damon_addr_range addr_range; }; struct list_head list; }; diff --git a/mm/damon/core.c b/mm/damon/core.c index cbe5a1cc27c4..c061d289c832 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -906,6 +906,56 @@ static void damos_update_stat(struct damos *s, s->stat.sz_applied += sz_applied; } +static bool __damos_filter_out(struct damon_target *t, struct damon_region *r, + struct damos_filter *filter) +{ + bool matched = false; + unsigned long start, end; + + switch (filter->type) { + case DAMOS_FILTER_TYPE_ADDR: + start = ALIGN_DOWN(filter->addr_range.start, DAMON_MIN_REGION); + end = ALIGN_DOWN(filter->addr_range.end, DAMON_MIN_REGION); + + /* inside the range */ + if (start <= r->ar.start && r->ar.end <= end) { + matched = true; + break; + } + /* outside of the range */ + if (r->ar.end <= start || end <= r->ar.start) { + matched = false; + break; + } + /* start before the range and overlap */ + if (r->ar.start < start) { + damon_split_region_at(t, r, start - r->ar.start); + matched = false; + break; + } + /* start inside the range */ + damon_split_region_at(t, r, end - r->ar.start); + matched = true; + break; + default: + break; + } + + return matched == filter->matching; +} + +static bool damos_filter_out(struct damon_target *t, struct damon_region *r, + struct damos *s) +{ + struct damos_filter *filter; + + damos_for_each_filter(filter, s) { + if (__damos_filter_out(t, r, filter)) + return true; + } + return false; +} + static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct damon_region *r, struct damos *s) { @@ -932,6 +982,8 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, } damon_split_region_at(t, r, sz); } + if (damos_filter_out(t, r, s)) + return; ktime_get_coarse_ts64(&begin); if (c->callback.before_damos_apply) err = c->callback.before_damos_apply(c, t, r, s); From patchwork Fri Jul 28 20:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332649 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 74E6DC001DE for ; Fri, 28 Jul 2023 20:34:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 734A78D0005; Fri, 28 Jul 2023 16:34:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E6036B0074; Fri, 28 Jul 2023 16:34:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3146B8D0005; Fri, 28 Jul 2023 16:34:53 -0400 (EDT) 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 1FBBF6B0071 for ; Fri, 28 Jul 2023 16:34:53 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C59F91207C8 for ; Fri, 28 Jul 2023 20:34:52 +0000 (UTC) X-FDA: 81062174424.28.E419E1E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 1CF7940013 for ; Fri, 28 Jul 2023 20:34:50 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qEqsPnDT; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.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=1690576491; 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=zxVpN4g06DUCb7PKXyAD338noc2KODnd6S5Q4w7jTog=; b=a6IMXxdW1nMvdudkZwhJlOU2Im/Lc8vUzxQpdvQiAghTx8PyhhVDyG3bXJa134O3Kz74ID m60WJ224HXlw5a1u/QYG1gbhCNdKZLF0rZHH+bSqDsHGUBI/Y8ebMDW5aeh4I5FNTcjokH fEPKNfMpFCxu/S0Nv9ine5JETxNZg2E= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qEqsPnDT; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576491; a=rsa-sha256; cv=none; b=6LR5aTGfxwJsNSTvZB7FPbNvxG3oP5aXyaEZaZ2UNSxC57JzFnIAcZBVxN7S9M/dUKfm+V uNgZEscQwkuH82Zh+YzOn/TsiQFtfLla+P1WzEttBP5fdsNotxbZXMOpDoT9rxTOeygGnC yNrce/mNkK+naK824aWe+hLrpv4C4Iw= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5DBC962206; Fri, 28 Jul 2023 20:34:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DF4BC433CA; Fri, 28 Jul 2023 20:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576489; bh=JP7uB7/G+cUBWmCMFTcCRqLSa2LcbVSrJBh+8gJznBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qEqsPnDTJzgFVqfu9V8EzsZlJlOVBtwCUd28gFsY/AzjTQsZhZQksDgaSHRkRvXm6 l3JmnJRVO+FpqhUHnEBOWdcaXQfMAG9/39tTQYzHzN1prb1O/bPdPv1kPt8Auwz/5D jjYGnpBfoMfmgM4oSg5UDHunwAmxiVSwcyEzQTP/oXG5pTb73/hEKtZ0XgBxx2q6s8 ZyGQTXlE3Ps1FA+5JnDoErKrZO8u8BKTzajZt0R1+WIrtbuOJHsuLZx/b3rVLGIgME FZMqUi57nVG89VRujJdxFHqvDZ1vymbdZLhk8ZLlSPzkG/ZxwgmTLxXbJBw5HTGc2e zSvAEuArFDBfA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 02/13] mm/damon/sysfs-schemes: support address range type DAMOS filter Date: Fri, 28 Jul 2023 20:34:33 +0000 Message-Id: <20230728203444.70703-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: rqzhkjb3dj3uokhfozffqsxjwn59x4zu X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1CF7940013 X-HE-Tag: 1690576490-197927 X-HE-Meta: U2FsdGVkX1/3JOMT570NiXPBjefYBMDfAF8dF7m/6F4+P7IZBHI36KOj+KMzHV3nUZFyLKQfAo0DjE+e5W+ewu6cAho3Qwa4UOvdIpeldXMpk4VV+jYS+GuAZVW2LsAFExhMD47AoNUubbgqnBqk0lrtvUE/rsNaa9p8epQUYbUUmy33J5bWi4SpPHFNrXTJubvvaZNgAkZq/Q17onhNL8XFn0lnq9Oou8ElpMFKnvSfj5KOpFTxVe1tBNAuo+cawRunJ64gnrjtnRCFlv44uT0dY4YRZZgH3B5s6EAHdqMqoDnqkkWp/cyuqvYIsfW8Bc8oE406J88c5UGYTp6UnM+42F5wFC1LL9pZtQ3pgnmQkyshQENh6jEmEdWQK9kwKp1UqVxvH6z+s3Vy/LvoCisu0Crj4PyDM+4dHlhoxwOIJP7FRrshDRd5P7+11M0ebUtDqdfLyVinZJKBWpReqQvLC5FvLJo0eqJq4RAi6popMkjjB/XVN5o9l/SkSoirT0227BKLjQa4v/dUpgtS9j8ME10/DU7VJ4eNStExg/uUHC5IRMnMB2/gbqmG03j3Dy+exCSn3Lq5sDGshod33l2mSy3aUyhl5laLMRT9dLQIdturFQekV8dphjpSJRgbI4CBdIWwuQpkfruF5wcaeBNVi297Y4Z+m4UHX6/Qf6me7IMsrSCIapusraDAN8DuJbwhvVXx0gxB835MjNKNicJ8h826f262EzzpDdKkG60DsH0FP7Gz75J1xSSVbTXM+EzeeLHBoU7mn1VyN/+two6YFzwb232HGQ7TDtooM3mKT84upX4wabT5yl40oLefDOMZnNlQNv3U3uHxcfRwjzcsjzFNYWE4tW/dxshKUGWDr+AAd1PduYuNCq7AJh3wR6nED9KIdVBfWt2jaPgTFLLbGneSQU8p+dPeHH4eUeD5quuP6T4n12kG88pt9uRi+ZNetXDN8Ka2U4Rn/C3 L4Y5PcdU aRV87TwvNrbk2GZGk/CrlOLcSpBMcJjEBtGAQNrFVi/vzSj/oMJT3e8JQWJXMFdTeQeqqHPf9GNi3WfrE6/vBQzdHacvnyeK6jBi8Wb+bMJHOVi1NO6ZjRiur7LSAGGamq2t/cm/0eEKwzAaQ9JyO99LnnuaYFDq/dKU2wUqYyB2KjucjrQo0ZC/VH7uTbZfO7/yAV8Wf9MNACem6hYzjf/XgeYr6w28VLkyPfhsJAwVpxojIJCwIlEp37066jNNRD6Zo9+8t1auygcE1uFTXZzEMmi9cNI5GDS+CHcf24gWrD0X3c2mbIRyQ3bo9/L8ph8cQA/BDwQ1Ucn4s8VqgOKm0cA== 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: Extend DAMON sysfs interface to support address range based DAMOS filters, by adding a special keyword for the filter//type file, namely 'addr', and two files under filter// for specifying the start and the end addresses of the range, namely 'addr_start' and 'addr_end'. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 9a015079f3a4..03ddba3e216d 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -282,6 +282,7 @@ struct damon_sysfs_scheme_filter { enum damos_filter_type type; bool matching; char *memcg_path; + struct damon_addr_range addr_range; }; static struct damon_sysfs_scheme_filter *damon_sysfs_scheme_filter_alloc(void) @@ -293,6 +294,7 @@ static struct damon_sysfs_scheme_filter *damon_sysfs_scheme_filter_alloc(void) static const char * const damon_sysfs_scheme_filter_type_strs[] = { "anon", "memcg", + "addr", }; static ssize_t type_show(struct kobject *kobj, @@ -373,6 +375,44 @@ static ssize_t memcg_path_store(struct kobject *kobj, return count; } +static ssize_t addr_start_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + + return sysfs_emit(buf, "%lu\n", filter->addr_range.start); +} + +static ssize_t addr_start_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + int err = kstrtoul(buf, 0, &filter->addr_range.start); + + return err ? err : count; +} + +static ssize_t addr_end_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + + return sysfs_emit(buf, "%lu\n", filter->addr_range.end); +} + +static ssize_t addr_end_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + int err = kstrtoul(buf, 0, &filter->addr_range.end); + + return err ? err : count; +} + static void damon_sysfs_scheme_filter_release(struct kobject *kobj) { struct damon_sysfs_scheme_filter *filter = container_of(kobj, @@ -391,10 +431,18 @@ static struct kobj_attribute damon_sysfs_scheme_filter_matching_attr = static struct kobj_attribute damon_sysfs_scheme_filter_memcg_path_attr = __ATTR_RW_MODE(memcg_path, 0600); +static struct kobj_attribute damon_sysfs_scheme_filter_addr_start_attr = + __ATTR_RW_MODE(addr_start, 0600); + +static struct kobj_attribute damon_sysfs_scheme_filter_addr_end_attr = + __ATTR_RW_MODE(addr_end, 0600); + static struct attribute *damon_sysfs_scheme_filter_attrs[] = { &damon_sysfs_scheme_filter_type_attr.attr, &damon_sysfs_scheme_filter_matching_attr.attr, &damon_sysfs_scheme_filter_memcg_path_attr.attr, + &damon_sysfs_scheme_filter_addr_start_attr.attr, + &damon_sysfs_scheme_filter_addr_end_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_scheme_filter); @@ -1484,7 +1532,15 @@ static int damon_sysfs_set_scheme_filters(struct damos *scheme, damos_destroy_filter(filter); return err; } + } else if (filter->type == DAMOS_FILTER_TYPE_ADDR) { + if (sysfs_filter->addr_range.end < + sysfs_filter->addr_range.start) { + damos_destroy_filter(filter); + return -EINVAL; + } + filter->addr_range = sysfs_filter->addr_range; } + damos_add_filter(scheme, filter); } return 0; From patchwork Fri Jul 28 20:34:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332651 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 425CEC00528 for ; Fri, 28 Jul 2023 20:34:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFD648D0006; Fri, 28 Jul 2023 16:34:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E88DF6B0075; Fri, 28 Jul 2023 16:34:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C636E8D0006; Fri, 28 Jul 2023 16:34:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9B6236B0074 for ; Fri, 28 Jul 2023 16:34:54 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 62CCFB1F22 for ; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) X-FDA: 81062174508.10.755C8AB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id BAC2F1A0008 for ; Fri, 28 Jul 2023 20:34:52 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kZVzJF7D; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.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=1690576492; 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=RQJieNk/pr3XHQEgPwJ68VYP9y4g7GJ/7AtQ8sbJiBc=; b=qRZED9C3OlPmBxnLi16SpEJePNZxxLa+sugxfq5RsqeJdf4IlA555Ib1vxfhlyFxCPoKqC J/1hoJEDG5tmlOtEYRpS94iWMVoEo/hGqKfLJ7JH8TE/m+gJqumjhWIp83GTqcL5vZBQBL fxKHroOpldjfCARwZ06lP5yI+8wf1Qs= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kZVzJF7D; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576492; a=rsa-sha256; cv=none; b=8WcWfoM+mIT9tpu3XGBUpTtVfASkn5cFIesaOHR/Xc0Tv/lPqKwgPpba67hzeQuxa/qWwq 5hbrq8Xb7qfjR1JkzfW13qq0Q+0x3DKAMG2JkgGI3yhdqJh7zjuXmI6ovDRJnIfnU4/hiZ CLeFmbMsI26yEfap/+qvc7/OrTDgUr0= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB4C06220A; Fri, 28 Jul 2023 20:34:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C68D0C433C8; Fri, 28 Jul 2023 20:34:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576491; bh=cjc8ooSUQ83tCK1u+lTmvslo5pngriB995qOBl2lfEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kZVzJF7D3covRVxGV8qlNVSYryTJADsCE2nkG3JlMM6KW9d11TNHzemNIWTQimTJK ffO0M4jAfUNnDSYV4c9DRRIB0VliGAVfq2/WXiijhELaaucip42BKwqrIHBcjqIaJD bVnh67z2b8iM5uSNPfJCZ1KxJ5yeEkYjeM8YTtQ4idTBJQzHSnwyViTad4T/Ago0h4 h1HmW4PEjGdHDzBE+c0WSscxqojOd5yWq1PEFp9djhuFqImKaV0iUCkHaYqWM+1D5U LEC5LNT0heATO0ErxPQA1r1Qhcp8va2vn+6A5rWmwm3Muli5fwkwIJopgiP201Ruvx 5GI/wU1T9CLGg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 04/13] selftests/damon/sysfs: test address range damos filter Date: Fri, 28 Jul 2023 20:34:35 +0000 Message-Id: <20230728203444.70703-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: BAC2F1A0008 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 3peed8zqpsompq41wtwebwh4xdihpkk9 X-HE-Tag: 1690576492-307982 X-HE-Meta: U2FsdGVkX1/IhJ834gJvuG2VCW4w17K8rKU505ddNTJbXRlVXuunGbd6E4gpTJFvHZNPsOTLfn0MmkhGM7499U6uRID4ZrdxV095P01Gt0jXqImll6pjQs0afdDX0lNspL9xwVVntlg191441Ne4bTKuTwaAPsMN3XKxRhqMU1OcDmUdo8xwHutvHXpZzmzq/WbU/7wcPnzReH0yLmP/ZeCAPwc1l3MGde02Fl2l5Fj/FyyI8d9jtLFmTupHjnY1v5enC/ZMzZXp/K6Ft7ESusmKcoo0Il+LCzuX56rrAgeWCZC9OZQN2KuvYT78BKIgX8ZpBdxFLiEE+3lHCqj0Y3S9Fp/zpCsdQB/7/BANeBF4mM+Cn8uYtZ8V8eQYTIEE+5VWNZ/UpbB7sMaZyhcUy+Nv/p8Qq9F3fvOHnSU9Vc1m8585g+hWXdB9ay0ZxhRhYht3ib9UeXqollv4Ow9MoYzpqF9gx+du0IYjWMWW6CbznCT6xF5fsOc/AoCHyK+pcYuDVEkyTeTirbx4Oxrl2zzjVI/1wtDq3xNRvGXX8cJTkK5TWfDLoxvy59DbYSRZ1s7e6PwPgtO6A3N7BQxlSNX7YyyiyjrbKWCPKbowX2qoldDWdTKQ+3EAOGSrx1BXUlS8monpdbrtraFrz86w4JwN4cZ4PZNx08+sRz89Qi8a8z3JddoPW+pF8iLTL/JlyDVChJgCPBsJjEvc5hTns0AvMvOEGktG1pOLVGcb8MOQwxpDk6GGIyeTwtfd9N06FQw8K6OBYsKnbG4hnMzRleRJycn/lKIH9JveGsqKkEM0tLyyPp35LXhRwYDPsg9Q9tTpNOS8HoaqlIDDa98mXKnvtEXO7EBFtJIWYGTFgqSoMSW4zsHKRUB5DyqwIuoC/rNzgJgwdGlG7nJ9oNWIYBLCMT9z3OWT342LAOO7iU1OtKiM3T1Bqeu/1y7WChokTbabQBknuERrvmVNhM+ AemGcj5V Lf/1us+4zzVGrFXUdkjjhC3M2S5wpFi0flig2MncZAV93udrzAM0uy5ePKyJ1eZNzzsOPcyCA0cBXd3e1U2pTQLdHKfVwM5fYSlbRiNH0VdfXz33YPfUAJ+ykf57JpDDVssG86iZjG9JWqAjgkjYXG9zywmTbHj8b5r8bf4QBeNSUF0v4BL5U9lcTFxvWs7jqGYksw5k0u1zlyUY5EPF7rzZG5LViwTQXJ0YD1TX2OPVe9FEG3lKjhKsLQgdrp5LUeEwDlHtUMTnt5VoW1QFjZB+PFTo1MtEH4gC9YeEXUv3xcqhiRKBYAwR3MELowCcWA3sAsV6BX51BJqVk8+Ztoe9pxQ== 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: Add a selftest for checking existence of addr_{start,end} files under DAMOS filter directory, and 'addr' damos filter type input of DAMON sysfs interface. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index 967e27267549..5677cfd342fc 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -103,9 +103,12 @@ test_filter() ensure_file "$filter_dir/type" "exist" "600" ensure_write_succ "$filter_dir/type" "anon" "valid input" ensure_write_succ "$filter_dir/type" "memcg" "valid input" + ensure_write_succ "$filter_dir/type" "addr" "valid input" ensure_write_fail "$filter_dir/type" "foo" "invalid input" ensure_file "$filter_dir/matching" "exist" "600" ensure_file "$filter_dir/memcg_path" "exist" "600" + ensure_file "$filter_dir/addr_start" "exist" "600" + ensure_file "$filter_dir/addr_end" "exist" "600" } test_filters() From patchwork Fri Jul 28 20:34:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332652 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 BC0E4EB64DD for ; Fri, 28 Jul 2023 20:35:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FE358D0007; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 563AB6B0075; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B0898D0007; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 26B9A6B0074 for ; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EA332A0397 for ; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) X-FDA: 81062174508.09.743D2E8 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 4D83980017 for ; Fri, 28 Jul 2023 20:34:53 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=heq5ttnp; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576493; a=rsa-sha256; cv=none; b=k+OiRbuBi8QZ1HtQRn7Vjgj0sr98JWZ0A1t1goEMzylpJKYlwSxrgORqc3B0K/wweuYb4e y5kzhaWYwqEWr2h5gl1sxGXhW7Yp1LzYikqLYtEupn9m2qiDxyMTB9TC+GQYoWEjQWTyyZ zhvkYu3D57TAS1ZrZfz8GyPRkiEulCo= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=heq5ttnp; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690576493; 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=N2Dh371ZmBlYpauiue0Vw10+cKdgFzpWgDU1O6AHC1g=; b=dBnTt3Wf0EikpQ/9d4pHRObysbVvX25zcJKjIq643EmCYIkS5tosbw+BrvsEmMRFSmQEl2 n4d0HwCekjy+yjzOnz/gGESE+Trub+WUx+P1PeCvxvpKNaUFbbMHt29/VqIMJ0WZIN8mWL JNakg8tKiADvDpxSUD3ypLQBWHLcEPU= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91D5962208; Fri, 28 Jul 2023 20:34:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81061C433C9; Fri, 28 Jul 2023 20:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576492; bh=OCzjAXySbo2P2W2ofPo/GLfYFykKqV/gINis3/IWY+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=heq5ttnp+0povkEP2NQq2cKCGH6lIIYkoMJQgmhO9vQAax7BDzcr7DdU1Q787/Wq6 Q9YeJVWmEHUFLd5qRENHxmVH7CqsLYHLU+C9jYL0lY2f9fTzGd89JOSSEKcugjH5qV +4OBdFvsT2CsHNrjMfFwwft/J4k+Sn3di3qmQeI8yWpwnFfHQadtT9Nhb/Sh+YCC+o 13cM5XYudDgbte9YduCx4h3FLlpSG0BPdG2nb3Nhzv20aF3IqPZIVxzyK5nrHmLY1z cePPG89HaxuFAEeiheYUlMAMH8JDYucg43I689mqC6DQhyBbg3QctN4ksFohaXYEeh kBPKIAB9Al3EA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 05/13] Docs/mm/damon/design: update for address range filters Date: Fri, 28 Jul 2023 20:34:36 +0000 Message-Id: <20230728203444.70703-6-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4D83980017 X-Stat-Signature: bhiq49x7paesxsa83zhqujatg64dnrfn X-Rspam-User: X-HE-Tag: 1690576493-476401 X-HE-Meta: U2FsdGVkX1+COk3pk5VI2ENCNBTL4Bwiby++I4o7vFXM/+puR0+DlQ/zkY2d+xJwNrAO4CUDqE+Kbjf2fMCokK+h27xbMwWLpaHgWrcitME2xdj9HTl2Kynr1RK3I76g7GwPmF6ntk7+jnu0KIhaBVJqCPaPInPEwJbLvH3SIhSXFmRj7AuJ4ClFsRzMUu7IJ4BDBaKSg4npOh8ek3hwoExEmL4/zY5k9YyJKiJ2Lw/yzSEA2Rf/RL8IBpoh1kNCGtpLdzIYXPViJchGs6XU1gYCoD+Xlc/inAyC+uYt5zCir25eCWosDfpeJ8mxml+ojW9+Gr5knvJJcfaTRDkhvjb5Gz4okjZF9AbfVlZSzecQXyvjKWiZ61M/UWIHVauBniQWMnQz0xcs9H+DwhY50TPc6u0P4D5oBsHRRW9RwSuYHvmp9t7FnNLK1juk1MTt0Uw5cW+cE30RZ5L3xvGZWMTSIOJAjsK12PWZof0oVheMdhHfprjburw1FZeR0jXY3RpJN1WT+n3AtESgBWIzmUYIteadwWAc7A923m164vzxYyp0yx/726nIjaMMilnfyRE+N9yr86I2L6otJuaWOvJJw+YCthCgBRN08mnDmdkUp4xjZxPF95zptSrb84Lmc4hw+A47se15Nf00ZxcSIshAgvmZbnQZQ4x1OGNgJvUWeWbkpc87k+cmmdkb+8KmwEw95fqP4IDVtB7i52r+8ZRQwHpne7eSiwMiwdZX9TKiqu2nXps+fuHUDsBiXi2fdf6/yPvD7EXypTMz/KJR9bIkVsXEsy1uCQFB6HnpTnRE5rsVx2/FZw1DblfKfHUPWAlLxQG7floD/qtznuTWvVzb5TrFjCpBcTdwCVFsdzFhgaRuuiTHdw7IAyrqB0V03KnulSZ6IPT47rnnIGP/c6nGzhk4nlvCa5TUVt2TGWnd5hqWtO0QJzscBfWdIFHaHBoZvajgTRUHDWCKynR ixLHVr+a 9aPE4sF4BNUB35oV/VN55xF1QlxITlYjlpQiPt1EwsDU0Dp+O+SmoJsmKZnwl5SJl71f+onJP0V43kK82mUK2HjB9eIfw55skU2GLMUA3DhWX+4JLqeQLJ9prdX9n6iVRiaxkP/EthzzADLQsryOei/3eqKwKwpFDPjwQqPOe2MpNxTQxOKRYL3WfaCYwq9kFkcx/h0jcYvDVgFhp2ht/yBmZvlQbVLXi/g34/T3HR4ahGqK4RP3Nwj0Z0MIuwuS3PF0xkhsV4ZHe8rEChEJrrPQJrRT7XELh0npppzV9XpnoGVEZ5duF0S1DYNDt95Ad5TRZCvqA6j5/ACyqu7/wnu2Mhw== 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: Update DAMON design document's DAMOS filters section for address range DAMOS filters. Because address range filters are handled by the core layer and it makes difference in schemes tried regions and schemes statistics, clearly describe it. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 4bfdf1d30c4a..134912166f5a 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -380,12 +380,21 @@ 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). -As of this writing, anonymous page type and memory cgroup type are supported by -the feature. Some filter target types can require additional arguments. For -example, the memory cgroup filter type asks users to specify the file path of -the memory cgroup for the filter. Hence, users can apply specific schemes to -only anonymous pages, non-anonymous pages, pages of specific cgroups, all pages -excluding those of specific cgroups, and any combination of those. +Currently, anonymous page, memory cgroup, and address range type filters are +supported by the feature. Some filter target types can require additional +arguments. For example, the memory cgroup filter type asks users to specify +the file path of the memory cgroup for the filter, while the address range type +asks the start and end addresses of the range. Hence, users can apply specific +schemes to only anonymous pages, non-anonymous pages, pages of specific +cgroups, all pages excluding those of specific cgroups, pages in specific +address range, and any combination of those. + +To handle filters efficiently, the address range type filter is handled by the +core layer, while others are handled by operations set. If a memory region is +filtered by the core layer-handled filter, it is 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. +The difference in accounting leads to changes in the statistics. Application Programming Interface From patchwork Fri Jul 28 20:34:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332653 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 D8FFCC001DF for ; Fri, 28 Jul 2023 20:35:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB8676B0074; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A19616B0075; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 822668D0009; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) 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 6F1708D0008 for ; Fri, 28 Jul 2023 16:34:55 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 348A11A0530 for ; Fri, 28 Jul 2023 20:34:55 +0000 (UTC) X-FDA: 81062174550.08.5F0683C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 86D7240019 for ; Fri, 28 Jul 2023 20:34:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="SrxOU/dN"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1690576493; 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=LR7oqG+00nkekBNt3o+wrtZoDLPaShEuwa/PeYioeco=; b=CpVbtPVCjTrvxbpysdUi6xEZ5/HJ1hVOzRXPDipskymykeRQ8N8S2iKuWxCh3uUZX1SFJm hQqWauZvD6BXPg1n9X4ZAvD3E/1cMqxpxHu2AYZA+wc1VwdhvcUGpyQsGlig8wkNTm9iT/ /4ekdEW5HlGLhJKCdZ66RJ62PIozfwM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="SrxOU/dN"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576493; a=rsa-sha256; cv=none; b=MDHZOLV40amxzHmqyP25I8QduT03KkfQDqsST+p1bMe4GrZK0kVAtP7Brn3U3h6Q8BGtoZ gStzQUBastFQoB74Iiy7apniMuqWrVYPNdDN4SDvSrDkvm4s24lGuHB87EtulC3woN43I5 QVZQ2gekUZIlFI8LqgUMRiuu1/aiGVo= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A3D462205; Fri, 28 Jul 2023 20:34:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BC43C433CB; Fri, 28 Jul 2023 20:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576492; bh=0npm47qE7mM3V04g26fYupZB0KuQfvcIrbkch6jch58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SrxOU/dNh7jCfSKEdcp2NaJS0/E9e7SwsZdBuNxy5RQsHjiWpl6nQFNDHC1cgMXoN YZMJtZg+OwctxSsEr9MpVt052ifmf3dVP/0yjPdxdwc5CjViezW6aLvDbyZTnruc4t pZCSvfk5WEVpX2pvYQY4gf5yFA62IQ1ppZpYH2hQENmnJNk6w4B2rvQwCY96KJ3FLN 1FhQFQBA8qhXEIJgCbaRbZtd5GJW54biKuy3jEc0aTf32BaIPXauFRF1vvYxwPrOeh qcTZTdaCusboMSVeL/RRJ8U2FRA3+UCrNT4Ad55sFhFPYEIwEbToVXf+cQeQI6bqLe C2sMA5joPS5qg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 06/13] Docs/ABI/damon: update for address range DAMOS filter Date: Fri, 28 Jul 2023 20:34:37 +0000 Message-Id: <20230728203444.70703-7-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 86D7240019 X-Stat-Signature: xzpqqkm5ucf9tauk1ha7jqa4smqefzdi X-Rspam-User: X-HE-Tag: 1690576493-656572 X-HE-Meta: U2FsdGVkX19pnsqdr36Oqa3OZJIijTLI8RIJZu6W8jcJ/ZjkfCh4NJLbVfnPFsHG8d+1NJCw8tB5XpdqAMQ1O95RJmbPrfX/arOiga17+A1VjLkLRA5p/vNutaSPwhnrKeTjOqJQTh5serqEvavUh+CMLnw7CVSdSaAWa8RQOCgc9KMZeshhXwlrc7hY8mUHx8GRx57doiH1MVGZjVt0UeMn8QcTrMjBIPnFA1KHYQ17YPXaj1mAnOm7TZ/oxNUid4ih6xXulkVO4hvQb3hQ919eXWi4n1cNAMyh/KMqN3yTnwd+AH609yJw/szpP+LphAi5rB+BM0UBibWhSNoxoYj/Ffa4GiIPGKstS5ZpajLmwdpt6W7ZIGwXkUAVaeIaE6Jo3Ef9AoSEEu9Mb1fI5zaX/paioVGkF3tA5h4V2NqYoDlm+cbF5e6C4zznTXzr3OPvy/kdsEeHiDdSATEcIGhw3IpR7cbNxc+RU8dwOz19YvqPEUURK0kRQ1BumbPuAqZO1kN7RFUhzXDHq+dnABN4RZGwuEBVnEDUNOi7228NIuz8zQrLz78MjCoBd1o2m4qbfYmTQl65BpdFbTJQb6dl/dFDTm1ovn2LmSmMq1HIQq2aWi46stdmY2yFaBJ1Ogr23J/CCgSiXOngx+YwPFmhLLc7Ta0Tqt3wFykx9qO9MfBaxCgb44XjA9+Q4PmNAZuEws0Kt+u1S6S8NCfpDzE3MmqR6Yegv2dJaN4UWKIsw3R7B+VRsiNvGZEQ8cba+MIhHW2hIedrWzoRRrY4vzQY0RIuLbNCzFlbRB9eDkWKmpc9wiXMpdoVCf7K+Gunl89MbJnpr+Xjapw0tcR6b8SPkOptyt1r8v1lNaxz65ImYqPVg0AYm2vaJUtnb71qv7HNqpjiZ+kVUIUdVR1w+FsC7T+H7fMwCafXv9zTikrSX4t398F6TQ0DpLw93WaACtZ/2dwY2xFypug94hZ +nLmowgG ZJv/DABktuz06K+EU22xOIFhrxdLtKyU1dOaVrSfIvHySYYafTCHZVmmu4jiy+X/3QRmRKi/tA2jwc5cH2FlVVDY2AXSlfb3A4qEXa5EK89zfGyW2b//hRQq6StaG5/TuLNcqwJV9zQzWRqQ8VSbTHDvwA+CkypRew2xUuiUNG9AkuTyuLMJMWWlzEQzwApG9/cpPIosqtwQU5lFTj9y3egbx1NadflaC58WQeI6CWg4KVM8ZV+iEvzqKWA2DNinKd3yKEAtT1/RKav2X/4idp5Q1rJwy3lzctBalhsy3TtlEo2uNk6GZa9IhXdHliyR69WpoNsAeB2J59+KKFtn4xD7GlUmMET5+G/X+Hgxa2JMQqzWqJykJ0o3k4FGk1oS3yPJDbg/Dd/KCNW73NV95CCxh9w== 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: Update DAMON ABI document for address ranges type DAMOS filter files. Signed-off-by: SeongJae Park --- .../ABI/testing/sysfs-kernel-mm-damon | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 3d9aaa1cafa9..0bc074d4618c 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -271,8 +271,9 @@ What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters/ Date: Dec 2022 Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the type of - the memory of the interest. 'anon' for anonymous pages, or - 'memcg' for specific memory cgroup can be written and read. + the memory of the interest. 'anon' for anonymous pages, + 'memcg' for specific memory cgroup, or 'addr' for address range + (an open-ended interval) can be written and read. What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//memcg_path Date: Dec 2022 @@ -281,6 +282,21 @@ Description: If 'memcg' is written to the 'type' file, writing to and reading from this file sets and gets the path to the memory cgroup of the interest. +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//addr_start +Date: Jul 2023 +Contact: SeongJae Park +Description: If 'addr' is written to the 'type' file, writing to or reading + from this file sets or gets the start address of the address + range for the filter. + +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//addr_end +Date: Jul 2023 +Contact: SeongJae Park +Description: If 'addr' is written to the 'type' file, writing to or reading + from this file sets or gets the end address of the address + range for the filter. + + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//matching Date: Dec 2022 Contact: SeongJae Park From patchwork Fri Jul 28 20:34:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332654 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 8DACBEB64DD for ; Fri, 28 Jul 2023 20:35:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16EFF8D000A; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F2AC8D0009; Fri, 28 Jul 2023 16:34:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D286E8D000A; Fri, 28 Jul 2023 16:34:56 -0400 (EDT) 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 AEFA58D0008 for ; Fri, 28 Jul 2023 16:34:56 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7BF25140279 for ; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) X-FDA: 81062174592.26.55F10F1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id B972CC000F for ; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CiBEtbKQ; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690576494; 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=DEONY+l/f78gQJGa931FtpQgT8QXzC08LkXhFbdcU0A=; b=Pk8CQIrneCjuiwGYfn4vCT7O8ZtxB7NigH6XoGVcQuf5D8VLzSRvTo6zV3hiOWPGL1wIr2 nUh/cg46T7RyuFtcvx7l4CuokMtQtKQwALDOQ4ONLghhI8tYNt9Wlj89qHN43L7z9k0k96 3s6uKuaE3FJ5jegx1yC0JVdF9TBEV60= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576494; a=rsa-sha256; cv=none; b=UuT1KZHaNkDku7AAxTPYBh9JzqWSckq6bbK64NaMmavbme2CQYmnRSM9rWLhmh4ckwwWmp 49Wk7iBPnGUqubEMbBHOwb58+h5S5hn+9Ql8I/dGgWd3gaHPOYBUHqAEICK+cEFokH2UEs HVFZfeWHW/jBitPkbDCQwa2McIrKlks= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CiBEtbKQ; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0876C62201; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAF58C433CA; Fri, 28 Jul 2023 20:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576493; bh=mWNsxedk/0WTpVC5xcDAG+vRRRu0kRA2F/h2AlUSJkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CiBEtbKQkxm2uJu76Q7F8N2yDxl7U5CsSNj+H9GfJqYbtTv7BZogItSj796IfRVIR reirwqk2lf3SQmPHseotaQPiwRXIv4DFNdE+HCeISoYCebyK8fyGjqQ8W7W40YSkt+ ekvACadx5lNO4AbeT1UpcZwlZRfaFTUeki1AZoqq1pn+TiQpFMqT70qy6wOK2IWr4/ T6zFjbNqKY91/5trFT+gdfYXLSUjglkvFNyyagx8TzGMljLf09PSPnMSUZ/EkJ9rqm ZQGqEVzV7Mf6CflFGRu02KLrdkoWza77p9pW4Qrx72dMFkuZ9Ets1DZNdBAL1IhH8z ykHmI5hTachgQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 07/13] Docs/admin-guide/mm/damon/usage: update for address range type DAMOS filter Date: Fri, 28 Jul 2023 20:34:38 +0000 Message-Id: <20230728203444.70703-8-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 4hr9ga8yitcso3fn65ust3q3t4ue4fn3 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B972CC000F X-Rspam-User: X-HE-Tag: 1690576494-532501 X-HE-Meta: U2FsdGVkX18U2S/Vlt5mfRZTfcAo9Yv40eB7LREZgyZp8mEppLRaLymCXF/BM1Od61ZtxTD+a4FqIZXVGneOp7S/hFzdBgRFjZVEsMc9gzWv2tEwA0FjzbAj3lWZNWn2cCeB1KluJq2XW3djUxZl3Z0EH7fvqKveuk8O1opgjbk1Hl8qhCcUfzp2V2Gl/bbdifw+l6JejzWoUU5lN3+HAl4/ht8+QNx96WapDO025NVWP0Skuhqxb3fsg5L+GcJPMZm7Mj+MGuX3r3KgreoZu1Ka7m0dKiAyg4YN3SJs9fft5MTjojPqnZ/IExkLgVvwGrkvYpthjblrDheBdDALfDJM5sCRfVUUx2KdyrXEwyYBpgIOJh5r2n8LkfmHONpUmb+ihFM/hLxRQ4gaCx42ioAFBUKjfWsLwyMBYgaqKyuft58Yd0VeAJePuy/Q35eQXKrCuTXr2BS+vwI/6FpN97md10SWI/xxsPDp2dmyJg0upuTKd+khyfgp50l0lq3CBb1qDJHD9cpnHhz4NeD4DaLTTgjgzMDVwf7gYL2DRsk9XxT7r2S0EzLTCLVKbQTeawWTzoupl63ivsrhZLIFxVoBrorIoNXvJgDkcy+UjdllHjCyCIEfkU86neXrdIa2+LM2WFIYJz6Qu80qAuTNXu57RnzVZhQ5rQFWzmaLw8e3AH3xK+FULb6GCCiY0QmtyuxtlkmlJsWinN9or8SLdZjKPBijbQaqu+ycphOVb3bwDvGwkTMkqov3hlirMVPUzrnjlE+OB+eHzP2XJYlGIpK0LRzfKx0VhHF+fDeTbp5bwo6F248Ewgh5pJU05GB8fQf7D/eYVmPdC4EPnuUt7pVgmcUHn6T8j5VWqS1UQJ4L/PjZQ/uiB90THPirWPCJ6BNoMBaoxDyNJRdIieZV+ZoWCLkCz/uKwqvrxSxk329HmnRbgaNb+lwAS4BOcruIS/4ju1vQU0ESryBRYzJ lz+/CbGQ I8nDbUalC59HDdyGewV3Ox+4KuP9dmm0TX7Myrs0t+NWJcShY0JQz2vNArP6adX8k3pNYgMnVcg+TJV42XbuepHa4eCjtXprPa5GG1laanSzysmI/hC3rjV7oXlldQXIoYfsRpwojCg21H+b2V9u+cbaoWFGxrWK0ciQ8dQgF6AkoiYPM2GQCtLw46GswskPhJQwCOSgwXQb7UOt5ehnj5HOqu2uuVcJo55LAx/bTXDPVDN2eR24PIyAbPHgqBSka4hPCGmJnlRmGLl//bZJcB4+9fWB6PYOsFDI+XnHCb7w70pMKrv+qQ3WuXZ4hYTwJmfFQeYDuzzieGv1XiTIqUE1Xj1bTpPEFk5rRzaUKeDI6c/4lmhoflGWx7Q== 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: Update DAMON usage document for the newly added address range type DAMOS filter. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 31 +++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 1859dd6c3834..a9cb9949b796 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -363,15 +363,18 @@ 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. +Each filter directory contains five files, namely ``type``, ``matcing``, +``memcg_path``, ``addr_start``, and ``addr_end``. To ``type`` file, you can +write one of three special keywords: ``anon`` for anonymous pages, ``memcg`` +for specific memory cgroup, or ``addr`` for specific address range (an +open-ended interval) 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. In case of the +address range filtering, you can specify the start and end address of the range +to ``addr_start`` and ``addr_end`` files, respectively. 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``.:: @@ -385,8 +388,14 @@ pages of all memory cgroups except ``/having_care_already``.:: echo /having_care_already > 1/memcg_path echo N > 1/matching -Note that filters are currently supported only when ``paddr`` -`implementation ` is being used. +Note that ``anon`` and ``memcg`` filters are currently supported only when +``paddr`` `implementation ` is being used. + +Also, memory regions that are filtered out by ``addr`` filters are not counted +as the scheme has tried to those, while regions that filtered out by other type +filters are counted as the scheme has tried to. The difference is applied to +:ref:`stats ` and :ref:`tried regions +`. .. _sysfs_schemes_stats: From patchwork Fri Jul 28 20:34:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332655 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 C9AD9C001DE for ; Fri, 28 Jul 2023 20:35:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F00C8D0008; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 393778D000B; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02EF18D0008; Fri, 28 Jul 2023 16:34:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D27C18D0009 for ; Fri, 28 Jul 2023 16:34:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A580980771 for ; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) X-FDA: 81062174592.23.4D656B3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id DD6DE1A0015 for ; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YrOFSGFN; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.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=1690576495; 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=hHpclYYfcFMIQd/3SqHzyTRgnAlb9aEAxJFCK7Cjch4=; b=mGfAujv6GDePWyj2q657IuozgwA4V42L/R3f+manOZwOA0VTVAy+lh3T6sb1/FnkJ7SlXx IdNwgmIBlbUa94zQv1DJkDGdFND0xrm2LVuVk077bIUEbDZAhg79IQSq2qtIuFW/zcjQFQ MBNBQ4bHWPPH9MahJ/XsI4IIjAjHuHY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YrOFSGFN; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576495; a=rsa-sha256; cv=none; b=nMCp3N7TsflGKEzoQVOAt3FagNigSeVCuDHyTYcojgF/FC1CTD+65G/t3ODbUt8KrUb2oH wFeLhryNZaN8n9F4EOGlsuVzn7tuMbk+5NannHiksAVmvk5dzuTodMg2LZZmlf0OorKz+K hl/j+hfPrfcE/bFRcF+0ppuMM9mHoUE= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C3106220A; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A610AC433C9; Fri, 28 Jul 2023 20:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576494; bh=lBNvXKzEBU9SpXm5U6wWrF6OxTFy+UZXhLu/dKriIQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrOFSGFNnrBc5Reg0+yJCBH7k9bWeWBT5Gq+TF4ipLVskyigsxce3viD7Y6iwy+S/ whBMJQI/svZuVbpeKEWFPGGOlDIiJ1yfXFd9TBr57ujIvjkA9LgLV0wAppx2r9Xt0K 3BdjuxLZa+l5OQTbe2UyHjBtMo0AYThLHmfBix6+VAbWj3e05tx9OkPH5QN0LcENxS 8msdjvmyMmwUNx//uRUz0LW6+dyERhdC6rb4ilktALtVGfP7mVHc1IcgSkbHlxDai0 zrFGFjGmYl8Nx8x2urnvKcX+I5dNy/iSIC/E6qe8SBndPORNPboomgqV2t0rO/e9Jn blzDGsBDvqg9w== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 08/13] mm/damon/core: implement target type damos filter Date: Fri, 28 Jul 2023 20:34:39 +0000 Message-Id: <20230728203444.70703-9-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: DD6DE1A0015 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: j8udx44q19sio9gr5z85hwhrf9e4gfrz X-HE-Tag: 1690576494-173339 X-HE-Meta: U2FsdGVkX19cV3t33Lhasbto/7EmGwZNMoSUaxVswgF+Y1RZpqxiGgFvtbbn35zIadrTnGT98ZA2uEDqJKvAprhPAwgbySps/NWN7cVWMLyP0t8aE3V1CA6DtZg26Y6c90Z5H78sFXTI8R8H3PbxjpPX+EADIP6ZlXvLAvHd/UqFf4LkrwjYM2mBbSVxJjMNWZwSgKMYk89N3dUwIx96wSHkALzUlNI36fiCB7GhrtYrJUqEEdg3fL6VjAbiRNASMAHJp5G1uwHY43waGqpQqwqpi15Uy8haPf+EIhJvZNuvoi0KSTIYPMnW9doj7d1lyqQ3qKQIrVnkRak1rCwgB7Ih64ZgQqBX7AE+xATlAiCrVhAH0zQHFJDzIj08ZV827bGJaymbM3fte0h78BH9MF80RD7uxo0bnJ0EKfrUKoVYW+iF0uGRWE9eckCjjiRKH3HfnavBzC6EY4Fv2C4F7+HInfa3vbdQlF/dyZFD5n4qKlQvkBdzmxvDOTSL949GClFshsrYK5+Drgc/2cQWQb5oz5lkw4dAYSjEasYgekqBFYAFm+A+OM/2FX4WkgDu/D35LeEXeODGsbra8fxiJYynAtR8OuvyE5aYoTpKlaJdGZOgoMBAYo4pRch/g8iIm0KhXzm7yJ6L0k89uo5nGGn1dsF9JzcRAaYJfr9V00DurE9DCtw4vi1U+jyQ4kKwee+0/RWNwe3zwYmnaoK4IpsPAMCQNUApFmfUAqK5VRoeZ1H3YTRBDdbxEexJWXW5W+tF3ZheMVDDnEtI9k9OJn0aJeLwyf45qEhfcwo61G4I49Ho3j/TSnFz3HJnJElF2vL0rfSt2k25FDg7O/K01SPUUNjI7GdZ1RFVLjZ2H+2vE3rGe64bd2UPps2iIoITB36eqwtacmgg9SCXBkUqM5q5P/Uvy9NzDUWidaJcgf3WmIUPdvWE52C98PmksuUrmw8xcORAKCIqwN7ebB5 fFuC/c0v EPOk1qW5F4/lPqMFQDpvpc+8QfxeesPCR9qhKqc2pLGUQgXsAPLzZIiT/tiW1kFE5jWhisQAFQpwBR0l7e6HrEoa9+mfDCVSvNL96NmiTGK1Xtu3b5uGhQUZgr85R0WkfbsHV3o18XEtGE0lIEowtWL/1yoY6h1ezPjh7w6Ho6R9sH4hBLEMq3tEN7lJTiYS/EXLrhXKC8QtFH1gqrDZ3bqQwkCBqrx9ZR8WLDcM+6Jyea54T8d2QwbmQZqyTA5X0k3FbB7u2RXOj91xp54szIgRmx66/M//Fu3W5U91+y6wLHT3i6sC/ZOcTKMV78/VNaSuHb3S7EyAnNfoxeLkzRki5Uw== 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: One DAMON context can have multiple monitoring targets, and DAMOS schemes are applied to all targets. In some cases, users need to apply different scheme to different targets. Retrieving monitoring results via DAMON sysfs interface' 'tried_regions' directory could be one good example. Also, there could be cases that cgroup DAMOS filter is not enough. All such use cases can be worked around by having multiple DAMON contexts having only single target, but it is inefficient in terms of resource usage, thogh the overhead is not estimated to be huge. Implement DAMON monitoring target based DAMOS filter for the case. Like address range target DAMOS filter, handle these filters in the DAMON core layer, since it is more efficient than doing in operations set layer. This also means that regions that filtered out by monitoring target type DAMOS filters are counted as not tried by the scheme. Hence, target granularity monitoring results retrieval via DAMON sysfs interface becomes available. Signed-off-by: SeongJae Park --- include/linux/damon.h | 6 ++++++ mm/damon/core.c | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 476f37a883a4..ae2664d1d5f1 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -227,6 +227,7 @@ struct damos_stat { * @DAMOS_FILTER_TYPE_ANON: Anonymous pages. * @DAMOS_FILTER_TYPE_MEMCG: Specific memcg's pages. * @DAMOS_FILTER_TYPE_ADDR: Address range. + * @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target. * @NR_DAMOS_FILTER_TYPES: Number of filter types. * * The anon pages type and memcg type filters are handled by underlying @@ -244,6 +245,7 @@ enum damos_filter_type { DAMOS_FILTER_TYPE_ANON, DAMOS_FILTER_TYPE_MEMCG, DAMOS_FILTER_TYPE_ADDR, + DAMOS_FILTER_TYPE_TARGET, NR_DAMOS_FILTER_TYPES, }; @@ -253,6 +255,9 @@ enum damos_filter_type { * @matching: If the matching page should filtered out or in. * @memcg_id: Memcg id of the question if @type is DAMOS_FILTER_MEMCG. * @addr_range: Address range if @type is DAMOS_FILTER_TYPE_ADDR. + * @target_idx: Index of the &struct damon_target of + * &damon_ctx->adaptive_targets if @type is + * DAMOS_FILTER_TYPE_TARGET. * @list: List head for siblings. * * Before applying the &damos->action to a memory region, DAMOS checks if each @@ -266,6 +271,7 @@ struct damos_filter { union { unsigned short memcg_id; struct damon_addr_range addr_range; + int target_idx; }; struct list_head list; }; diff --git a/mm/damon/core.c b/mm/damon/core.c index c061d289c832..334bc5823d83 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -906,13 +906,23 @@ static void damos_update_stat(struct damos *s, s->stat.sz_applied += sz_applied; } -static bool __damos_filter_out(struct damon_target *t, struct damon_region *r, - struct damos_filter *filter) +static bool __damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, + struct damon_region *r, struct damos_filter *filter) { bool matched = false; + struct damon_target *ti; + int target_idx = 0; unsigned long start, end; switch (filter->type) { + case DAMOS_FILTER_TYPE_TARGET: + damon_for_each_target(ti, ctx) { + if (ti == t) + break; + target_idx++; + } + matched = target_idx == filter->target_idx; + break; case DAMOS_FILTER_TYPE_ADDR: start = ALIGN_DOWN(filter->addr_range.start, DAMON_MIN_REGION); end = ALIGN_DOWN(filter->addr_range.end, DAMON_MIN_REGION); @@ -944,13 +954,13 @@ static bool __damos_filter_out(struct damon_target *t, struct damon_region *r, return matched == filter->matching; } -static bool damos_filter_out(struct damon_target *t, struct damon_region *r, - struct damos *s) +static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, + struct damon_region *r, struct damos *s) { struct damos_filter *filter; damos_for_each_filter(filter, s) { - if (__damos_filter_out(t, r, filter)) + if (__damos_filter_out(ctx, t, r, filter)) return true; } return false; @@ -982,7 +992,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, } damon_split_region_at(t, r, sz); } - if (damos_filter_out(t, r, s)) + if (damos_filter_out(c, t, r, s)) return; ktime_get_coarse_ts64(&begin); if (c->callback.before_damos_apply) From patchwork Fri Jul 28 20:34:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332656 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 097A3C00528 for ; Fri, 28 Jul 2023 20:35:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BDF38D000B; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 847AA8D0009; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D4C08D000C; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 483C78D0009 for ; Fri, 28 Jul 2023 16:34:57 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 27D70B1F22 for ; Fri, 28 Jul 2023 20:34:57 +0000 (UTC) X-FDA: 81062174634.18.0A30645 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 7788580009 for ; Fri, 28 Jul 2023 20:34:55 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=T8PVYgKS; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576495; a=rsa-sha256; cv=none; b=s/YHQ3hPbuA2bbfZ0tsDTWM3alTERXRTUWu87cvvpObotOGn0kcxSWkeuAwo0P+QlkQONl JSShkpXLpu0TfpyEgQ/VIpwoDIxuNG7z/8KDZqAklucOi9k3o7IEleA+yd1b007brZYYqN 8su4VfSbpAbF88Y5/PlKYbRuoOpVlOY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=T8PVYgKS; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690576495; 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=/kPvdyaF0vEK5qYkstLmLzJYcBFMKcv9CmUtYtZboIA=; b=ywsvJFz2BeVMdxBpaFgxQEej0XHWlDfbq+m2v36DA6LqYW+j7fFtVWY2fgz98Zm0XXZBO6 PDpVDJGk3Y8MNEoTPHjhJvgwa8SqsO4RMD3tjWG+w9fyPxgC0UcfZk3RHvt3Zq316sWdyK Frh0lzm1oOs8n+va+v+ONrRtrwSevtk= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 39C2C621DE; Fri, 28 Jul 2023 20:34:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44EADC433C8; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576494; bh=Z5TufRLeeFt1IBETpXgGonzkgtF37kqef1//j1myid4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8PVYgKS6PhpVB48g8KXiKO4k/4GohZSRliIWj6R8O15K5G2kmG3fnkO0dbOgFkhl /UIHcmpSyJadZWQStltOcf4TGAZaLSowi0asMBRi5Z25HoZhta724/fvsHSQ8I11dY m0D2LjqwzdyKx4hl4XteU2v1tlgB8ElHctrSEsXcU7G5B6pCvO3pYtQe09rd02zLfr x5+D+Qc8R/BZ+Kms/T9KuXAgCUV1tqJo1KVQDt+oxGtbopKr6djuCFIfNOdrhkt9m3 oCcs97pGo1x5w4rXqcln4QseMgiqsejzcN5BQNS9bsf387Cz+oFRuJyfs37iSJb33t eF9hu+cVBOMxw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 09/13] mm/damon/sysfs-schemes: support target damos filter Date: Fri, 28 Jul 2023 20:34:40 +0000 Message-Id: <20230728203444.70703-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7788580009 X-Stat-Signature: katb8nba4sgp54tjnctxz6t1i91nu9d9 X-Rspam-User: X-HE-Tag: 1690576495-587621 X-HE-Meta: U2FsdGVkX184HTasBG7rPmL9rXXBsGwEAEZ40m4UGIb08Xx6bW19NlGb1ffKp9hjhxFvm5Bj3w+8UIggWHn7d6c6NCw1oUOpJmZcRcvAL2KF8b3u+8to+Bk3sKcXfw7az0o9ODecPYBRW/buS0gklpMx7y0+lfUkndXmuwI+QcHIQdce8k+AFOZjkhd0foxdqv8+YQAogcRRHk/fya9tKYEftbrHJjEogDNDKUiOqrIkLUYxKk8qZexBeuMlYl5khoZTlZSlBPl+4yEwxmmG/hWE5I8k6LgfjxILbNrvz+xxsD9dkwfpd9ZpWm3iV86KPR3DiplC5aafA5khwNxy/mOeosNNEOggOuc09WS9ZPDokTan4cabbbwMZQsN5xundZeuMhk86q6IZOTiRHQx0GUtz7/LHhCiZPdmZhGuKxa3OYRJQIoO6cXYSqwVW2ha7RuluE87d5pdewtVfYzJpDKuzu+PRQNYP1N1Y8XvHp6txUaEMEpr6fSkQ+a3YwLtLc7B1t9/SzfIjmxycLrdC2D2tQX11VQKcXCCuNN9IV9wY767MIOvo13pt8dI+LK3ryMWD7AARhMZ1ouZxq5GWKon7+SKJr3uCXDcVRLEDHwhvXYupIw0kVnOAvsaGUCNCfuJhvvSVLvOFSI2YdtMRJqJToiEhU5jlz8/aTzwOcybE65NGMtkTO6vfnC076e49TZnsGWbPGMi4mDYh9LkX9+gUHnGJbau88C6jAVM4VN3L4osgHgFDQpa3w5pm+EI/3MDAV36QRAYNX/Upt2pu9MoBgbeM712SZv9ML0S+KjW7FUlixxve23mSYuwg/6UGp8eKGevPQ+SyoBLMDiVRtLxxR2AFvLW32NTdp+gGP9IFyRa5kebRBriW31gVzDEp8T+2rzF78P77S1ulESNR27PsmRrlvx5qA7ODJ8yDXsC6RRMo3qkOMKRgWyjGqmN4wYcfxxKOqa6tVzX5lC 0Klx2Fxh JmFuFiD2bMp/KqO2nngutiIko5B1aH4T0+zZ1mEDUODOKajZYRcy8iEj0zqm5mSoiehfd2EriTyJBFIkmmzfkPLHcffZwRPtnbXKUEPwhcrPuBHjyW5EYK/SQ9aLlIAkzXI+W23s5A8wTiDVHrgNxsk9GHNLhk9gfV40bXvuh71Z1ocn4XtFNV6Y9m4kSZ6xfgxxTADEAfCXYh4QieCWvbwKld7wAxXXQhxqGe7MF3vz72sCetj5RObyUpGSJ8ACh8z6YapnqxocZdfcUpUckULEUtfJ+jPImht1glhj1f+K+q6g4mhcOXoSSwG4gBgBxcJ94hoLSAOCWv7efkuzb1Aj8XA== 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: Extend DAMON sysfs interface to support the DAMON monitoring target based DAMOS filter. Users can use it via writing 'target' to the filter's 'type' file and specifying the index of the target from the corresponding DAMON context's monitoring targets list to 'target_idx' sysfs file. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 03ddba3e216d..527e7d17eb3b 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -283,6 +283,7 @@ struct damon_sysfs_scheme_filter { bool matching; char *memcg_path; struct damon_addr_range addr_range; + int target_idx; }; static struct damon_sysfs_scheme_filter *damon_sysfs_scheme_filter_alloc(void) @@ -295,6 +296,7 @@ static const char * const damon_sysfs_scheme_filter_type_strs[] = { "anon", "memcg", "addr", + "target", }; static ssize_t type_show(struct kobject *kobj, @@ -413,6 +415,25 @@ static ssize_t addr_end_store(struct kobject *kobj, return err ? err : count; } +static ssize_t damon_target_idx_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + + return sysfs_emit(buf, "%d\n", filter->target_idx); +} + +static ssize_t damon_target_idx_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + int err = kstrtoint(buf, 0, &filter->target_idx); + + return err ? err : count; +} + static void damon_sysfs_scheme_filter_release(struct kobject *kobj) { struct damon_sysfs_scheme_filter *filter = container_of(kobj, @@ -437,12 +458,16 @@ static struct kobj_attribute damon_sysfs_scheme_filter_addr_start_attr = static struct kobj_attribute damon_sysfs_scheme_filter_addr_end_attr = __ATTR_RW_MODE(addr_end, 0600); +static struct kobj_attribute damon_sysfs_scheme_filter_damon_target_idx_attr = + __ATTR_RW_MODE(damon_target_idx, 0600); + static struct attribute *damon_sysfs_scheme_filter_attrs[] = { &damon_sysfs_scheme_filter_type_attr.attr, &damon_sysfs_scheme_filter_matching_attr.attr, &damon_sysfs_scheme_filter_memcg_path_attr.attr, &damon_sysfs_scheme_filter_addr_start_attr.attr, &damon_sysfs_scheme_filter_addr_end_attr.attr, + &damon_sysfs_scheme_filter_damon_target_idx_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_scheme_filter); @@ -1539,6 +1564,8 @@ static int damon_sysfs_set_scheme_filters(struct damos *scheme, return -EINVAL; } filter->addr_range = sysfs_filter->addr_range; + } else if (filter->type == DAMOS_FILTER_TYPE_TARGET) { + filter->target_idx = sysfs_filter->target_idx; } damos_add_filter(scheme, filter); From patchwork Fri Jul 28 20:34:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332657 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 1F2F0EB64DD for ; Fri, 28 Jul 2023 20:35:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DC338D000C; Fri, 28 Jul 2023 16:34:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3159B8D0009; Fri, 28 Jul 2023 16:34:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B6168D000C; Fri, 28 Jul 2023 16:34:58 -0400 (EDT) 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 078318D0009 for ; Fri, 28 Jul 2023 16:34:58 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D3705160343 for ; Fri, 28 Jul 2023 20:34:57 +0000 (UTC) X-FDA: 81062174634.10.2EA3462 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 3D8EC40022 for ; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EECfAg33; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1690576496; 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=fdzWJripOcM/GiUUkWYEsIFDFoKl4JpaJcuoDMjVXR8=; b=fk+O5DzCx51zGIW0NamgMVaUnU04ZFN6a6aENlWal4kJZzzihSTI55Obs3TjFyShEH0GTc QDne5fwv+qQl+WJ665AVisrj8NhAHAr3+JysfUJox8P0G02JtaCFudDbWcOvXRaEGYB3xe ydptMqXMAkD0/uZmJYTOkAUl+oKQjfU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EECfAg33; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576496; a=rsa-sha256; cv=none; b=7IV1EM/sPSzVMQJo/4SwdEewq10VOFqBLULzbl16MUFGDwFnUYFMo981j/BOg3Y/j+s0rV WsOKop03df7F6zocm8zQjMclSyJ29KF9pRlC78LKkwfy7zJwvItLYesqu6PfVE7ljXcsmZ nbx4rlLnJFWiDsRfcbhiVcBy5wwu8kQ= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E683C62202; Fri, 28 Jul 2023 20:34:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C1FC433C7; Fri, 28 Jul 2023 20:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576495; bh=MiKQzUem1fzoQJpnZETahxS4bhAx7AKf5JO3KUUBnl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EECfAg33GG9SqqlWc+wrfsEImXkF6d6ycMp0inrJhToqWOJS5w+mziQY6qM1+VzOW yJAIbvcLzdspQMARFZjzy3AmCo6BqmfM3NWAvL0pkpWx7Yt6sRBXwoVkE5fusXqmub w5oLIoINT3xsuDNIolN8nJBcIRzbtGocgGMwepvXDhuG2FYfsA9T8hDMGzLkIvm22b FoyimEg865ElGcknEIKuhd5UsKo6vGoFtEtm1IFw/No6ZJIxShh4HmDL7Oe645TXVZ Lrkivg25m27CUtgTcmVblB1UPsAmTCbpO+ItKQ5IVNkZpQ7/X7HRuBHnbgzbf/ZajY NNTeUXrLf0J4w== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 10/13] selftests/damon/sysfs: test damon_target filter Date: Fri, 28 Jul 2023 20:34:41 +0000 Message-Id: <20230728203444.70703-11-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3D8EC40022 X-Stat-Signature: opbt3zpbeu5bhrs3n5upg7uhhotc3qpb X-Rspam-User: X-HE-Tag: 1690576496-364447 X-HE-Meta: U2FsdGVkX1/QcI2i/ZcWPJSXJiDeWpAyj6hskjroXnJb37l8BUnCJYOx2oZBBkkU5wXSfIjLXeW/B+50JOUMhKgD5ND6UHK608CZ9At4CgjgfsRfiWoBTeHf/flprc8Ru6jKn+lTLS/iHCCP49pzhdTr1Ma4KAZr3c46wEQqU3SC/b8ddJxutvnnE6jFsGui/X4+fHrdr/F8eIykqOkLqogMlIueSuLxEujG9N8luDY032WMsOC07TUFHDnGIj3Qfrx+Mj02HgbZJvC/gBhLGNRJQ3R/lbPLirjlW1sKnMaQsUDbo9aYshQucSLRp48hIy8s+wk0buw6LXPjaMjNn123JK5mFtRu5XlQ2Y5STqXxzJ9ktFejh+hfzwg9MxiQfX1kvGwEjbGU2z9mJRs5IjYajMaqK+aA0SW0hfAn5Ky9jf81XF7pAW/nqM4d0i/yinYVQFi1QPv0UswL/YNaAVcFsV+VH0690KSdUF29KzWtLKfCVniOETFYgKPU334yUmp9sR92//RRCwzTcSYl3pDdDexdyaNNaVE7QN02Km0PgkpXaVzXuel4EdlO1N9efihnl7SCM77AWKZA6LDXGQl9AVQHQW8KGZ6ALMsxDpNrHyHBtO+eLQahSyXmhHUYUrMqD5H/czfObjYeK+UDEWtFUf7I53GEEH/iN/n3xbggRrpSZMQfczWpGvYzeIua8D9JrPdpOlHVlXFhO8T2QFKBYTDusmH1+QofZtGXI6j8TB5p4NxwRMWkmS3sANFICdDuBSROsOqIk21GFce4Dbz54+CVKnYte4Pwskq2RXaRpFiJS1MqkjdfwlnpbaUuDtpgr5m+Lfy3h673JQwu532Wjkl5XGVBKWXvET8I/SLaZQtmjyG4JmlrlXCNmLHYPHbj7Km8jGth3qVC+74qsjb1Z3od1iAylY5xICJ8orm4p/MhrXjhkBw7o0Uq0/V2OVyUjZ1CNdAqBDy5nCX a6bFZxmr d8M6ryVu0r0kmSMEe2qiN5uceNZyHdUx+FlbBq35bjwUuCLPQzo8xEXeIFs+SpWfRgS5paxc1YcIfaRux6UZVKHiYWp0+PZCAE/KhCPv7A8YJ7Ofl636YbdHy5QXo7W6L57Z23O97jZDgvIM4oMaFxSZ8afqiwUzc38UFbNRhlRW8MT/w8DdYMA2vemuyKnYWpopS+l3iLKgmnwFfXKphHjx8wK+dzlFHRcdIq9PLTXi3N1b3QefquKjaA6JBw7kf0Nwgnv7NDnyW3V/ZyrG3BGthsgqQQAK4fwDes5HHl8dYVNF5I2ry+WKUnR0QQNkXIKgWBypNPoGTh74yFRCgkFZSdGS2Tzynn3u185sRaUu5XycygWatgbMqYuWWNfVInz5M 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: Test existence of files and validity of input keyword for DAMON monitoring target based DAMOS filter on DAMON sysfs interface. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index 5677cfd342fc..60a9a305aef0 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -104,11 +104,13 @@ test_filter() ensure_write_succ "$filter_dir/type" "anon" "valid input" ensure_write_succ "$filter_dir/type" "memcg" "valid input" ensure_write_succ "$filter_dir/type" "addr" "valid input" + ensure_write_succ "$filter_dir/type" "target" "valid input" ensure_write_fail "$filter_dir/type" "foo" "invalid input" ensure_file "$filter_dir/matching" "exist" "600" ensure_file "$filter_dir/memcg_path" "exist" "600" ensure_file "$filter_dir/addr_start" "exist" "600" ensure_file "$filter_dir/addr_end" "exist" "600" + ensure_file "$filter_dir/damon_target_idx" "exist" "600" } test_filters() From patchwork Fri Jul 28 20:34:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332658 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 7FB4BC001DE for ; Fri, 28 Jul 2023 20:35:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 403998D000D; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 363D38D0009; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 140848D000D; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) 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 E89728D0009 for ; Fri, 28 Jul 2023 16:34:58 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B146F806B9 for ; Fri, 28 Jul 2023 20:34:58 +0000 (UTC) X-FDA: 81062174676.03.C98757B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id E9B13C000F for ; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OxWEhRuP; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690576497; 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=eduCnC+OYEyOqU/7eWjUVOUI0rGHQmq49SKw029YYYk=; b=FYyfx5F9vU59vyXueAhb50Syn8giBq0AraDuKbfWk/9TCxeP8jjNgJh4xd84ua6exqK6pS 0pHZw4QQSqjDYaxpVMgXLJurAKhFmiUknRvr/3c/horD1nWyzblZx1pV56slw1QDLSXKm/ cuB3VVUpbzAuV67fmWtW65aibPvuk4o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576497; a=rsa-sha256; cv=none; b=Xsb06UyrlTB87KHl0HptDTOshnLY04VeWVS7uR3baF4061nOFdy01hMIUEl10JvQctY7dr K1C8R2c7DmcMF3XTUK9bNOwot4EFYhEBvMWjfslT+EON5nFraMm4eT/QYGAWP15qnfQyYZ WCUD8ixbDJMAhmzK0ZsBVbvwA3KT1Nk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OxWEhRuP; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A40AE62201; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93157C433CB; Fri, 28 Jul 2023 20:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576496; bh=/3fkCyEgrxb/AUOocTnJxHaLWQx7r2oBGZrkuNBIGj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OxWEhRuPcnfrcCVwBiXAj7XlQmmkMrkW9e3U/XpZL+HwfZYSYxvDTK5NHZ3PAyPG6 U8vjA9kEWx5bcJ05v0Z7MHa4bCwtMcGu8JCoYAlrEuJlCc7Vs7yyR1v/Sxx8AY4gfZ Rw47IgpK69FeRYLEkwZWWigquez9wdXepYBOd5mb5fOCaqcRIYMh/HbwR+mAwukQcL tsjQgy/BD9KP302rVfPdIHEJ0+GnxpHGFfbSeDr/Uo22p1aCiX6TZMCWTl5RbLO+R8 Ab1ecYyLD2f4biH6bjWAY5swpY2S9TkcobXnu7R2EqLBDptkXTK7f6lWry3g+yYHfP I7uhEvHyiwGGw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 11/13] Docs/mm/damon/design: update for DAMON monitoring target type DAMOS filter Date: Fri, 28 Jul 2023 20:34:42 +0000 Message-Id: <20230728203444.70703-12-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: goc8fqwtkryoyixj7bg3w74hr8ea7cy8 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E9B13C000F X-Rspam-User: X-HE-Tag: 1690576496-716505 X-HE-Meta: U2FsdGVkX19ehhNH8AlGTQUY/9R+7uddO1866PZu+SFH2+FhLOD/vMlYGgA+scE9o1p3JSxVBN8A+gVbcPPPn8D3pRzK+lLkTJ/Z+62aSF2dW/6RuAgR/inZaaICuC5eAl4DdAnZqXxgUoHmjpRN2TPVgxqgYpZBVBqZ84266ScrRiaAfOIoI2DvASpPtnXgRBPdizo81Tw6AffMRxblgprU6zEXrAlbJMTKfm3t0Js8Nszf6eh+gf/ftJehA/bKxfuLvHS31TFu++TC22epNE6M+azvsWatUJryLv+npNBfnr2FDFcQrALSsPzGmyAL95mKU7ueoPYVstdp+LGG840rhmMijW1p2kK/FiQFxF1i6RvuPML3JnCfWEy2GzrpTKYFRmE7/Knj3b79oUvhrgtLFCOFi+Drp/tTrMjd3iTTRjv/ZD+iDrorF/dbM1FnNIOwaAJlx/rtvxafZd7xactRCDH8fTkqzwIRcODuGzZknU6FGzhWx2B5xtVqZPZytKcjbniIX6JQt3bvwDakys5UCeDrOMHBi/AK6TxCTlyX9amfQfQqMQdDXn2TXs18LXfkVSojmocwhjIxnTRjWYHCqjMenwN3s/qpJ5JaOIvXQOsH9EyaljM+KDW1gp0H6FlZ45pgIrrBVMLfiFE1lztusvSdcHCFoGmTCLvg+GCqttBr1aXsxzHMtMtNeJdxK8zZ75L2w8Lo8Q3IECtChdgKsyK1RzebQEchCR12f1Ky0lXo3S6SF9hBVM2gixVm9BfGR0WIjeI3H1CbiBSapunMioN/Dwpj7XUPd6dAxmtB7O2O7cGtUPBlJ5UouCPAAPrpqu+N6PAZnGOgA6gguuNp1FF+sUBlXmh+kZlzXOcByr+tOQerFyZQjY5Lv/6qs6RwdYifDpj0Ek75ZjVdA5GauTQoa7StBcdjOKqso4e/01TOFP1haM3n1rq5yBljUYDeNn41FroxodRZaUm WrOY0Tom pfBqjuiE4ejUEtucRG2KvmJHXv0rvB2TG3JEsOdcs99KKhfC0uIrV9gptZH0bFVcWhuC3txKwBIgmiWsUN8htSzZxktX8yRK2Q021QLRCCr6FR3gAF+19l3/oFV/5FUPzB9h8VI8FSwhfHiKT+ixhQlnv+6gQ8TeNNSiA+wRjcttYH+D5ZfM5O+fn90EuowW9gD6R67y2F9JL7S+JgzviqohCZhQWXr0yxt8kMOI+AWibel7nAu+og6ZpYI5lAQ2F2bpMIKrD4yyN83JD8DG5Ebv2Czg2AwMsk8/EikNkk2/moTmOQ/H826UBfuCngECoYI8LoaL812DttIahWAKYNwE5Tg== 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: Update DAMON design document for the newly added DAMON monitoring target type DAMOS filter. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 33 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 134912166f5a..a20383d01a95 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -380,21 +380,24 @@ 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). -Currently, anonymous page, memory cgroup, and address range type filters are -supported by the feature. Some filter target types can require additional -arguments. For example, the memory cgroup filter type asks users to specify -the file path of the memory cgroup for the filter, while the address range type -asks the start and end addresses of the range. Hence, users can apply specific -schemes to only anonymous pages, non-anonymous pages, pages of specific -cgroups, all pages excluding those of specific cgroups, pages in specific -address range, and any combination of those. - -To handle filters efficiently, the address range type filter is handled by the -core layer, while others are handled by operations set. If a memory region is -filtered by the core layer-handled filter, it is 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. -The difference in accounting leads to changes in the statistics. +Currently, anonymous page, memory cgroup, address range, and DAMON monitoring +target type filters are supported by the feature. Some filter target types +require additional arguments. The memory cgroup filter type asks users to +specify the file path of the memory cgroup for the filter. The address range +type asks the start and end addresses of the range. The DAMON monitoring +target type asks the index of the target from the context's monitoring targets +list. Hence, users can apply specific schemes to only anonymous pages, +non-anonymous pages, pages of specific cgroups, all pages excluding those of +specific cgroups, pages in specific address range, pages in specific DAMON +monitoring targets, and any combination of those. + +To handle filters efficiently, the address range and DAMON monitoring target +type filters are handled by the core layer, while others are handled by +operations set. If a memory region is filtered by a core layer-handled filter, +it is 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. The difference in accounting leads to changes +in the statistics. Application Programming Interface From patchwork Fri Jul 28 20:34:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332659 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 0A1DAC001DF for ; Fri, 28 Jul 2023 20:35:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1638900002; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA15B8E0001; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CE1F900002; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7A5AD8E0001 for ; Fri, 28 Jul 2023 16:34:59 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 53ABE1C9617 for ; Fri, 28 Jul 2023 20:34:59 +0000 (UTC) X-FDA: 81062174718.27.F43C9C3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id AC7181A0003 for ; Fri, 28 Jul 2023 20:34:57 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rea+yT0I; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.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=1690576497; 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=TCUsqQmJnKJM5svbADdALKq1EVL3eMqwc5DVaHvmSMg=; b=bROeAmtjCayLiZLcq3TWoI3S7NUdtJe/IcDehseIcUBMOg+fMvI9HR+FRKnloAhz+EtZmb KHwSrJcuY8rKK2U28jWNu/PnO4TbtnkQRf6oxg2EmtzSoVxk9+K6Nd8EOv+y0xj2z8mX9W eQAQGcE4QslIAZW5PczIv3tCPMsyCYo= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rea+yT0I; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576497; a=rsa-sha256; cv=none; b=NDbZlni7Mqm7co74+6Veg+qGtMbZ9CVE5qAmqMedAnQgO+3gntw0xdj0vTfqwhJtD5twFX ODi+xxDyTM3NFp43lSdncyJK7pO6mvVTyQZXeju87Lj/iRaSNzo63EyaCh/9v4MZp9DeX6 kkQGDb/KiYngCyCcg0Ga5Tg/slIMVBM= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62A5F62208; Fri, 28 Jul 2023 20:34:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50472C433C9; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576496; bh=vyjBGWyxBLS7yKk1ryFlF7UDmbUqwEQwLNgOkCH6QUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rea+yT0IiwPGhhE0KEND4yApkw5a3ILg6BoIRM7AwSF2wCqS1qY+//EtMqzze8Odt xvJ58ujCsX21oar+Bcm3nIwbXsznDchR6t7ykIJ8WteZ9IBaM+SRQAItGePyDKRyoz nFJCVeodxBpFWwK5n9pfFfio1UJcbio51qqREQquQDwnokFsyrUJSTouI/uELCp8r9 58W76e0TNy8z/akRdaoJ9tfVPEhPZKvI1TP8Nah4cKXlumcE6G+/wuIOAksrqLZMO1 NaJLOWwoPrUT5MdfTpg+xPu8M9V2XqZhalpiWr9NQRPFw3tshGmQOjTYgHwt2Y0CB3 pMGiohUJ4mCOw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 12/13] Docs/ABI/damon: update for DAMON monitoring target type DAMOS filter Date: Fri, 28 Jul 2023 20:34:43 +0000 Message-Id: <20230728203444.70703-13-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: AC7181A0003 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: qrmubr5piyfipdurrpfmxw88ajy6kzxh X-HE-Tag: 1690576497-26557 X-HE-Meta: U2FsdGVkX1+Weru4vz4BncDhDAnun895Ff/iGh+/DxpgDSKxaijbNg7iQB0+CR7JDmvf8jwmZGjQuziy6YbGflwVyJwGqccZyCczZxGmv+nsZMqG0yn/fokIsMT8fNPfnwFYoeqRvNS8UcY4V4csZGvMqjS410W2RDj94csdIFCgcOhoKRuXAXkBB67nkjyxbN9jmE8HGBHbkpJxm6BUVTkWtv0k88ouv20sInx6VuJ0aArAfOj2MbFAPJBDgDPYkhrkdUz8YScPYR/h3vsCrBpa2JdiCVzQShMK3ze+7+iXaqrXYhdhoUl3dI9voV1JO6jenySTbbX12qO8hxRA5YIb8TNGZC6J6MyqnKiplWhXgupfH7i4w5wX/YkREnAuqpjIl8Giw7MQLUZHzg+SPhaJ53cRxhsjYiGGP9EiELCFznsM+ZkY7F7g3mb/2Bihbs1J++yA5DEXMCAcC4+umrwaI0Aq7IWR3B7Dw3YjMBhXmNUaixjKPQpjANV5La6z0HaBtaItWG3XuClL+51zOw+9dXgE5K1AATLkoZOYdSVd7G5L3PeTKo0RIvUqe0sd9RaMEoK7YleEB1IQ/kbGwdn9ojuxIMZBmg0dwUdNYjjVc+nXjt3VX4r37L+t9XIcIDP+l0H8cTzzuqW3qaOVJ8T7ndCXHGFc0UCGUaqPnIqhxHrrrUvA0pMzX0ED6aslloxYLpPwRYDaf6kmJT35Ckg5mkCxuDToyakFQjp8QTDwaQKDKaCEAuYUCzSDmh18Kx+0XozC3Zyk9w/PgsMbSLg57njhAV7B0YODsl7dsYBBqG5j7NawQt+ilWWMwT4oLvxXTBQgilg6qfhkpDoaXo8SethJH0n/SfkYjteK+Dp4A8tjLS52wGIepqk4x4GJXDq1Ooltrxv6nS4y6QkaiGd1XWlEArXvq/qvPHsMdxsb7kHF8vPY6498ncmUXcjeJpXfSwpSpjDNzTvzhY9 Zy3Zm1Q9 33Mkh7LuYJfemKX9kRzJq3gQ1VGsyP18VZOW4kDjhiE51PZNStuzwuv2HkPCCED3dgFHMLT+KmTuh7QX5kK9nBYxk2YLv3eOnT5yBjssTZQJRpLUZ2EgXbxGN/oghoretwA6MSFO2bULfJFQuwGROcx1YNd9UHl3wEXFOgSpQqhvLO2b2dMTK8IxaWY2NeMnWDWWqb8CPOjMv7+i03t6+929S+v6nnAxC3uDEd124TYrpsmYjwY8WiaaqpZP8G7cmRIy6PkM/JcnqjKOK05H+DEibOro7DB4kl7YP+t9jJk6uSxWWEGJrl9nJDZ1TJw9d3n7PdFzuR2fCfHhbY1gmbQBS3EXTLrQhksC4TjXl4le72dmofWuUyB6kI2i9Ssp42KzWi6tjOrIZhdk= 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: Update DAMON ABI document for the newly added DAMON monitoring target type DAMOS filter. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 0bc074d4618c..334352d198f8 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -272,8 +272,9 @@ Date: Dec 2022 Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the type of the memory of the interest. 'anon' for anonymous pages, - 'memcg' for specific memory cgroup, or 'addr' for address range - (an open-ended interval) can be written and read. + 'memcg' for specific memory cgroup, 'addr' for address range + (an open-ended interval), or 'target' for DAMON monitoring + target can be written and read. What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//memcg_path Date: Dec 2022 @@ -296,6 +297,12 @@ Description: If 'addr' is written to the 'type' file, writing to or reading from this file sets or gets the end address of the address range for the filter. +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//target_idx +Date: Dec 2022 +Contact: SeongJae Park +Description: If 'target' is written to the 'type' file, writing to or + reading from this file sets or gets the index of the DAMON + monitoring target of the interest. What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//matching Date: Dec 2022 From patchwork Fri Jul 28 20:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13332660 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 7EDF2C001DE for ; Fri, 28 Jul 2023 20:35:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69A248E0001; Fri, 28 Jul 2023 16:35:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FDE8900003; Fri, 28 Jul 2023 16:35:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 474508E0002; Fri, 28 Jul 2023 16:35:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 31FB58E0001 for ; Fri, 28 Jul 2023 16:35:00 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0EBDFB1CF2 for ; Fri, 28 Jul 2023 20:35:00 +0000 (UTC) X-FDA: 81062174760.19.B0CFDE4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 747BA4001C for ; Fri, 28 Jul 2023 20:34:58 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kCfYKwe4; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1690576498; 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=iuunIUn62bhZjdaFR+qEAwFTLHuVOYMKzjEUqds7ss8=; b=p9e+38lYVVNBu/sy5daURUdHQZC0Xqyk4MB1VR4eU16u8p9Bm5Di32SUrJSWkxI56kcS4o fY65dAC+cwnnYap8Qja9BAcURFLqIDEULMSbpH3vxTxN/A3tBl2fTfKii9HjjOL1K0WRPT 5+Bp9eWPtSG223yUy2cEuO9XW14jQ8s= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kCfYKwe4; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690576498; a=rsa-sha256; cv=none; b=LAhxgh4EHnQRHPLAepgMjN8r0mvKlv5iw7ZfeqW7rEBZh38+eF0L1CixF1JcG8ywVu4ej7 EB6id8Z8VjKziwStCb+pYa40bvFP4YBQS30BHOduOc1Wlx/z/1CCrPMq5LnPRj6aiPzpgr nK275ikGhtkOG3s6jOOrjjJItHSzZlQ= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C223621FE; Fri, 28 Jul 2023 20:34:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B4C7C433CA; Fri, 28 Jul 2023 20:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690576497; bh=jeC4GAEfQQwmVnTIZskvg6L9vM/nrayE2m9ijer6n98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kCfYKwe4QL89JDRqiWJGihImM+qcoMbDWecJ7hn5Iu+Tfw0wwq6G5Soa4tXigbIs+ cKRMiMjzFiwRgTa6FFAOyZ/Cj4fLXYlE0wrBytmbm3mQbInHJDivY+r/aUeIdGg3oE Mttwki34KUH6dQ4afT+n7RpDZEfriIuE5WtcfXH3hSOT9fbYJoS/uhCmYL6v6zaHlF 8kHxycb0NP0w8mRdV0JOMb4kDQW6JCY/h32sSZ8ZyZ3iqHTsijHYjs8Co5cqxVWS7F bRGrb21xaEpee+/SLZW1SB2C5OnDQu3NvdTvQg0bZ/zZxF8gJPpGUrIvZB02FSjVjY AEaMp+FQ3zbXQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 13/13] Docs/admin-guide/mm/damon/usage: update for DAMON monitoring target type DAMOS filter Date: Fri, 28 Jul 2023 20:34:44 +0000 Message-Id: <20230728203444.70703-14-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728203444.70703-1-sj@kernel.org> References: <20230728203444.70703-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 747BA4001C X-Stat-Signature: d8erexio3qdfkjaqyx1t9cuneaaz6g1c X-Rspam-User: X-HE-Tag: 1690576498-399221 X-HE-Meta: U2FsdGVkX19QKO7L9jFfzVm4YSNBz17wqw59e4Pczo1fqGQAFvPcS8umYmEKycCqXb8BBNWlzA+ea68Mcr5iLttggna5EmPUJL8OBZ/zgxCcnk2n0+bZ5bep0nOYo3kCfobM54yXCwFiHfabzumYEGGHVjXEzCz+AcNiJHHWZDnIqyjburypd80beCTtAN7P7QZeiJvyljd7DlAU2TAHlwvzxeDbnGCFPuqj1Dr1r6w8lLr7cl+KPVpniTQgtznGKRnmI3O9nFLTKuCq6KzufrITBuPwSgdI2XMZCGOaRt7QOa3zWRzfPFFpJcUhq2cM36yYhY0tNUr9ebS4mllqG+3y8mwobEGrNO4ihPNcPX5zWHhKEw0NBAbMBEG4+iT0Q9DeCV5V5tQdhutCVVzye6SgQlHxGHpW+ZUYPHKxc37+x3QBggiFitljGQARYtWQWTqwHnYedPILEo0h3wcHMWspWgCzb+woqa9BAazpOm3+e1gnnxbK0efdv6rqg7KQHYiq4URFY0bFCjiCTEVAqgt/a/r80Yt4nSeoE1hgp0pQjIm2X6rmCAc6OkRBksYaFSwcaXC+KpNYwpeuqQexVxNBAlONNNxicQG01MN/s9ZlHK9CkBVyByMcsqMuW4taUhgfCCf6Wt/qVvOqsmen9Zc0kIQOnyk+7QbGBrwcJyzWV8w2A9jgJK2d2RHyhcJlHLEhKSAc4rV+ebH6/pz7/YZhVDJLziANviOnayzkdmiuU2FQXNCUyfM6rP9C5dMwheBQZFBYOTaY6qfLYIDGaVEUV98RJ1eeI29imNGF+/6jriViHPG4VJMjRSvVB33vPnVFgmbMYpvEgIZnZWqE64JSQ+9eGAASMBl3z9U05NN0mAb899DcKIlpF58djKvAEIkyFXOXDyqlUmuHO1kWoGNLr+1jfH09i++0KerXlhZn5jsO52Dlez2b2z7632uen1kVJs312VWjlj8gQU0 nrCq27iV +H37gThsDWYneRRe5V2MTG1OtX03BwHJO03/eIsOtI1ntcgOVzidwYUstL96SLY5wsZ7sz+jRAKMXhtJetYfuw+D4AXFb3Hf5lW5XHjnHTN04DmBbMEwXN5bYjOYilmVp2sFA4FlSa9+rrqRiNtJuffW80ov1bDI1N9bq/1rJhcmvEWmnK9+lRVNOC3XA1FLaYTcjqPElHj50PhajGNfc92fAONObsxpX8J55KB1I1KJ96BvAomK/1Nv3mi7auRZYCZRsH8MVuzGGXEN8uEz8Bzt5EvI6BHdMIDpZnJn+jR9wD9FpoyFsxtWEhMSDJldNxaFHzO4TVBenR6g+r6wsdKvb6Q== 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: Update DAMON usage document for newly added DAMON monitoring target type DAMOS filter. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 37 +++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index a9cb9949b796..084f0a32b421 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -363,18 +363,21 @@ 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 five files, namely ``type``, ``matcing``, -``memcg_path``, ``addr_start``, and ``addr_end``. To ``type`` file, you can -write one of three special keywords: ``anon`` for anonymous pages, ``memcg`` -for specific memory cgroup, or ``addr`` for specific address range (an -open-ended interval) 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. In case of the -address range filtering, you can specify the start and end address of the range -to ``addr_start`` and ``addr_end`` files, respectively. 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. +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 four special keywords: ``anon`` for anonymous pages, +``memcg`` for specific memory cgroup, ``addr`` for specific address range (an +open-ended interval), or ``target`` for specific DAMON monitoring target +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. In case of the address range +filtering, you can specify the start and end address of the range to +``addr_start`` and ``addr_end`` files, respectively. For the DAMON monitoring +target filtering, 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. For example, below restricts a DAMOS action to be applied to only non-anonymous pages of all memory cgroups except ``/having_care_already``.:: @@ -391,11 +394,11 @@ pages of all memory cgroups except ``/having_care_already``.:: Note that ``anon`` and ``memcg`` filters are currently supported only when ``paddr`` `implementation ` is being used. -Also, memory regions that are filtered out by ``addr`` filters are not counted -as the scheme has tried to those, while regions that filtered out by other type -filters are counted as the scheme has tried to. The difference is applied to -:ref:`stats ` and :ref:`tried regions -`. +Also, memory regions that are filtered out by ``addr`` or ``target`` filters +are not counted as the scheme has tried to those, while regions that filtered +out by other type filters are counted as the scheme has tried to. The +difference is applied to :ref:`stats ` and +:ref:`tried regions `. .. _sysfs_schemes_stats: