From patchwork Sat Sep 16 02:09: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: 13388069 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 9E0C5CD37B0 for ; Sat, 16 Sep 2023 02:10:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04EF96B0409; Fri, 15 Sep 2023 22:10:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F41416B040A; Fri, 15 Sep 2023 22:09:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E30106B040B; Fri, 15 Sep 2023 22:09:59 -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 D10356B0409 for ; Fri, 15 Sep 2023 22:09:59 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9BFF01407A0 for ; Sat, 16 Sep 2023 02:09:59 +0000 (UTC) X-FDA: 81240830118.24.7D3FC51 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id DDE6620020 for ; Sat, 16 Sep 2023 02:09:57 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DE5n19QT; spf=pass (imf13.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=1694830198; a=rsa-sha256; cv=none; b=umIqieNSqNCu/ECsuiwEWkwnZouZLE6tPhLaerca2Fl9oymor57cDN1u+AnF9K8hoxHetX sVLT5Swqgjsq9YVkjK5otEbERGF7VvqMc6taCNLZn/0Cy8hJHzCTfLRmHXnjzGmaFjaabJ nxOIS+OVFuU3Vp8Bfr1ogIVArog2IwE= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DE5n19QT; spf=pass (imf13.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=1694830198; 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=mxS0NDdtbPRnU18dk9+OTOoH37taYp/+bQDsW+ALhsc=; b=7RhGDvp5QroemM56NKX5EF+9VJpi3LUgoAjBUxsOA/bkE+l0vJOoTSZT28QqX+Zvwz5/eJ nxbqEd5lUAA4jlmdOwed0xrmIyZVBAAUCMoSzFooTZvFHHLG5eQfuZ3RIzwULbLJekEkFn YfBOQ0az8gMAsyd/cfUC5XsSwMAStZ8= 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 E8B4562180; Sat, 16 Sep 2023 02:09:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC149C433C8; Sat, 16 Sep 2023 02:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830196; bh=VEo1bT4L3oASolFpAiFgoKtkxwTv3u9FxZ+yfBw7tjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DE5n19QTrLA/q3MCbj6txVWl1uVLgvfvimtQFgvcddmHPnYMGBO3fFDzwOKCAE1Ea 6ZYLcxHkm5CTWFprrqRjF2KtaYm2Pz1lRDiwdDYTuq77AJA0RSUh5o65EYEXrOnEHs xWMKylLYUB2wBv7QR/yROAzDf7cNTsquwx29G72dwKWAZ+EmwIigZOPRJm/YCHaQd8 oGtGCMonOLobfZnVSyKN0ZWlbECSyGnvfq2vefdC/SACWvKlxDcHJ9gAJk10AUBeAe OUhBoRM9HauQyDIauN7P46WxsCKPvr3KFTi/4wXKmwRabKlNI1DRkIECckLti/Mt8P t2+3IdJ/6uTGA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] mm/damon/core: make DAMOS uses nr_accesses_bp instead of nr_accesses Date: Sat, 16 Sep 2023 02:09:37 +0000 Message-Id: <20230916020945.47296-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DDE6620020 X-Stat-Signature: ooer7zaohmwq67ss5jw3o7yc3ux5oj6n X-Rspam-User: X-HE-Tag: 1694830197-84000 X-HE-Meta: U2FsdGVkX1+2+Q2lj072SpqXGu5CXxiAPDmTd4YYmPw3qVZzhf37MuQL5HkeEGLc75IrBHUuUvxAb8okJLD93s9pZ0ue4twE4j+lXYyDP9MzFTZnK98ZvTbRDjmL6hgluhVbHXXqOf6ABO7dSCEf8KPdXG9C5FxiVtLUPCgtfqFb+/LaM7XZUY2/djyW1eOtwVmLgMaC+FoR0z26p2prdUHz2apbGKjTyKWFyuOI9HT5dfBABDexD9VwxrMwzR35VVaSBQmDOG4HJMcvqcwyJ9Ut28MHgRoTcnyD8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ti4u 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: DAMON provides nr_accesses_bp, which becomes same to nr_accesses * 10000 for every aggregation interval, but updated every sampling interval with a reasonable accuracy. Since DAMON-based operation schemes are applied in every aggregation interval using nr_accesses, using nr_accesses_bp instead will make no difference to users. Meanwhile, it allows DAMOS to apply the schemes in a time interval that less than the aggregation interval. It could be useful and more flexible for some cases. Do it. Signed-off-by: SeongJae Park --- mm/damon/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index b15cf47d2d29..79fef5145a4b 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -770,12 +770,13 @@ static void damon_split_region_at(struct damon_target *t, static bool __damos_valid_target(struct damon_region *r, struct damos *s) { unsigned long sz; + unsigned int nr_accesses = r->nr_accesses_bp / 10000; sz = damon_sz_region(r); return s->pattern.min_sz_region <= sz && sz <= s->pattern.max_sz_region && - s->pattern.min_nr_accesses <= r->nr_accesses && - r->nr_accesses <= s->pattern.max_nr_accesses && + s->pattern.min_nr_accesses <= nr_accesses && + nr_accesses <= s->pattern.max_nr_accesses && s->pattern.min_age_region <= r->age && r->age <= s->pattern.max_age_region; } From patchwork Sat Sep 16 02:09: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: 13388072 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 293C6CD37B0 for ; Sat, 16 Sep 2023 02:10:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4D3A6B040E; Fri, 15 Sep 2023 22:10:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD56F6B040F; Fri, 15 Sep 2023 22:10:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99EC46B0410; Fri, 15 Sep 2023 22:10:06 -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 86E9A6B040E for ; Fri, 15 Sep 2023 22:10:06 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 53D461607E2 for ; Sat, 16 Sep 2023 02:10:06 +0000 (UTC) X-FDA: 81240830412.17.9C47936 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf27.hostedemail.com (Postfix) with ESMTP id 59DC940011 for ; Sat, 16 Sep 2023 02:10:03 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VOW72m4+; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 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=1694830204; a=rsa-sha256; cv=none; b=4Kcfk+MdtVDga/8ecHqhK2zsi3TmIQMmQ9LYJYfNRvcPOA+83W82t/s4H4kwuIbCi3plwW FeOiKXr1/IQphxhs1Rs97hqMMhPFapfOro0+WGQeppKYI5YP0H6eMftDSU6PRWpWeW80Iv c8/hn2Br0+zf6cxLeiz/NXgJn9o7Pn8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VOW72m4+; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 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=1694830204; 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=XMv7ZYg2RAYZEyI+n5LIQn6oa94Zk4SRuNBtg0vN5u8=; b=QquRAu/iL9QwQwuMqDieR7dWk5OJkhWpmgcaELK2xj74eWLS6c+ktYKbC6ucsjMjrJ0o2p iFdJsTVGGZ0DreGw2Ud3lgGa13/uJOJRkZ4PCofuZDwsUkn7m+NeWfuW0JQBR1YwP3nWU4 +z8ErAHeKKfVQ6Ac7UH3Oa1DUkik3Xk= 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 sin.source.kernel.org (Postfix) with ESMTPS id E8A10CE2E60; Sat, 16 Sep 2023 02:09:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0623C433C8; Sat, 16 Sep 2023 02:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830198; bh=DNLoykVfcLunzlqLq92ppaTwpNSuqGnLy/p/x4HnboY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOW72m4+tcRyIHubvfGta2PK60I+MtD4+v+Xr+eH0EemTaxQPuTpCGCkUMLnjCAa+ o/2hmGpyllSeicIhd3FysLe0WsJ8ETtGUxFa7DFAmLgljTuv8bSbEQX785z8vISz2W ULi87aU+zbisxJZKBJ7bMQ5GwcLGJYKr1vBzMsiUzRCaqaatj7WjHpB7n5/570XMYj QjUNjvbxGcwD9TPVr7FBbPoMwNYPLh3eRe/8kKkE8me85m9jNJL4GfTQoKudWnzImQ vsDZ2/2R8LpB8aAXw+R0ARwhL5AEaBGZAzoS/PYxAr/WWECQg4TsDtiObwoyz/ZEpc mD1gZAGqr5wfQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/9] mm/damon/sysfs-schemes: use nr_accesses_bp as the source of tried_regions//nr_accesses Date: Sat, 16 Sep 2023 02:09:38 +0000 Message-Id: <20230916020945.47296-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 59DC940011 X-Stat-Signature: r9hojjrsxigybq8yhakm6kg6rwaoaxhy X-Rspam-User: X-HE-Tag: 1694830203-321628 X-HE-Meta: U2FsdGVkX1+a1ZyUxfKhSMcts/y4K36FVGfY6bcZUEBhcoJHLwPAZd70KphIHRr0tPRACSYBq2/Ci4niI2qk2qWpSiA3a+38yWfBAHLIpxsDxZx+/jrnuNH/tTAV/k9jk5vS4RlTtaocyH/w0OxUV37b4v+EUoNbTe49QolCgEOWUYn5saNPq426phvvq5YMkuH2w1E0c7S94gKayfqXfKCqW/YyzIvLcgXQ4nOUvVGBaGihXT/EgtjvWagn+b1HbtLF9ezun3SfL0wtbVexiucnPK1CBJtiixdepdyxtfdIanHiflmp80cSBU/La3cnk+gHqwK+3Zi3KMHBTDY9p0mIRJGj2DvGCa0Is31+vKgWwI6xh/w5FxyzpQxomvQbSXAx1yA2A82PUuhrxCTQ1o4XEYnVS9b1y+cMYamD1kIbBSiQs01IQhq2jtqYbNshb/UfwwYHdmttC1rSK0u0kxP1kQiNDOCB9qFoSuTtE9pKfKfmvkDI2wbnRq0BBedrN8LS6/jcgjQ5cuRbwtIWyr0njczPhSazz1gmiOr3FIxaulTLHVVH0xHxGGKgLu0wq4iKZOYoaGzBGozqD5ZRz4mvKKndDkyTRZL1qkklzl9wTfnweeXYtU6jFRGGWlMd3rhs27IAdf4UilP7C4SWO551KMArsCRQoxDnMpHq1pRjaBJvCEtEq5h+MPWhcG6q7Ds4QE61p07BjSTEL+aQyJiy5MY6AB2NuyyzetW2j0aodGNSz8JJLbDJDTSJaFL7jaOtD+NwXnBN2q44mz7JZ+o39i+GqrPppRDnZyzdCGGoM7hAPw0GPMopZdhpd2RasOLKoTGjDT/TcpPchjyFs3Ofv/Pv3FoMi1Mzis5IhjDzyIOQb5M4SIYfMN+mhMVxQ4kQ4Xniy9O3xI7N4dGdWWitnCK/lVu04TSe3hc3fvjN83KuDrl9RyBkbl0VnJcAkSG3BQ2D6X4wxlbk7lE lUFJAFeZ S1eCHzsaSWT7iFvo3FXbG7byaD62cq7AdcKLdOSqN+V/k9b+fWafV3TbIzkl7s6FBnDu0aRj21Bi/hzRt0DQ2EH9RO3Cziyy4o37sckphRoUs6uebFyc1UAh4f2+RP2pFQMvj18EzI+rC/0OUiAiQcPTSDnwEvkW80NbSCan9aOcySnQ5saKGlYB/+2ZHlL1QmL5Um29H4irC1CiQlNMuvUVddsHfxa3t2nd6AwgdSs612SNX2Xpzoo9Bv+wGzy+tCI/8+wp7rVN4UJaIquVtUZTAfdx5xFNWi68/yXFUxIzfbOVpE2grnprVw7w9u0xJCR/yh3zaEJ1EGFTvk9n1kT5LRRmicLmQirKDTp1ARXAXmn0+qz2O3hOPqWBgmdLo7rUd 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: DAMON sysfs interface exposes access rate of each region via DAMOS tried regions directory. For this, the nr_accesses field of the region is used. DAMOS was actually using nr_accesses in the past, but it uses nr_accesses_bp now. Use the value that it is really using as the source. Note that this doesn't expose nr_accesses_bp as is (in basis point), but after converting it to the natural number by dividing the value by 10,000. Hence there is no behavioral change from users' perspective. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 527e7d17eb3b..093700f50b18 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -31,7 +31,7 @@ static struct damon_sysfs_scheme_region *damon_sysfs_scheme_region_alloc( return NULL; sysfs_region->kobj = (struct kobject){}; sysfs_region->ar = region->ar; - sysfs_region->nr_accesses = region->nr_accesses; + sysfs_region->nr_accesses = region->nr_accesses_bp / 10000; sysfs_region->age = region->age; INIT_LIST_HEAD(&sysfs_region->list); return sysfs_region; From patchwork Sat Sep 16 02:09: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: 13388071 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 87B30CD37B1 for ; Sat, 16 Sep 2023 02:10:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FE226B040C; Fri, 15 Sep 2023 22:10:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1872B6B040D; Fri, 15 Sep 2023 22:10:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFF9B6B040E; Fri, 15 Sep 2023 22:10:03 -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 CFD0E6B040C for ; Fri, 15 Sep 2023 22:10:03 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AE6111C9F63 for ; Sat, 16 Sep 2023 02:10:03 +0000 (UTC) X-FDA: 81240830286.29.E9CF04D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 0D1B018001C for ; Sat, 16 Sep 2023 02:10:01 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="HYpkwR/i"; spf=pass (imf06.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=1694830202; a=rsa-sha256; cv=none; b=L6nVGP/4ZK06KKxoD33rimdzdI0y17e3DYSE30BwxmWZTLBtNvQdgwsdIcGKRlyhxq/2Ie 7NSjuF4Ewhk1rUr6N9g0USUOP6WF7ALXGurirHH0XU1FmE8S9DkqtjglE/McPraLvDAGgC PvqgvwlzwtVUmD8v7cBbjOno3YGHyg4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="HYpkwR/i"; spf=pass (imf06.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=1694830202; 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=tjIZD4tmf+jZpp9P0nQE+oJlGzUWJFPJIvL3wjD6Bi4=; b=XNQsSgnQRlVZpQXoF+LfwWL5FfclTocR6eHT4EW4kHrLbW4b+RaX+b4Of3dzNaijSFPgUk R1bAKhy91PC/I6fnu3FEjl2C4/z6Zp+DIuITIX8Dpuyucqy805+YLt9r6lADbDHaMxFd7j 08af7Bl+pMGFF9btl7bSJSeGgu3ruIg= 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 45BC5620ED; Sat, 16 Sep 2023 02:10:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E761AC433C9; Sat, 16 Sep 2023 02:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830200; bh=JTX8roVUkoUgDpJsiDynoUw1rs0WkWhqwrFFpgZDGAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HYpkwR/inXjdyb2gngS4f7p4SFsHSMS3VtSAcLEHye2QBHmQXeQgFFKB1NqwqQ069 aJfOypDmoD9vgbsIZl9SG2hsjrARJmocVcmfc/djvDJOFqWJS/uhEYh7mMfeMcasN3 73lPOFle6veIKb+soiMhLbfXEYO1mG/l1prQj89951ycdnVn6p3OtlOpLDZ4nd1Yj7 4vwABlBysLdDFobnl2b32WnWVtx24Dl+WTM0ek1K1yrfioD5GPKq1jvihIEL2IfNhB tBJSx15beCsLcfE3aARUMt7pYaWx5eQrqJiM4aOxKic2a1uSGSjm3HDYEMadPWoeB3 9twb5KOKOqTMQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Steven Rostedt , damon@lists.linux.dev, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/9] mm/damon/core: use nr_accesses_bp as a source of damos_before_apply tracepoint Date: Sat, 16 Sep 2023 02:09:39 +0000 Message-Id: <20230916020945.47296-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0D1B018001C X-Stat-Signature: 9bs6pi3sbfuniuknkhh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xm1XCebtRklNnvIqCWduF1YxiJ55KOR5Phkp4kB10glyUE4HBFQ0SxcaGhsc6s5Lst3rXamiY0w1wdqqZ2MsWRb9g4DPG4AMzdrZPRe+h34VVPFAkAY2RXS9SDo49A4vw0uEB+UQvScoTZ5kVh0Vn7YN0JMEPHpSVWDL39r+RNmvTrVd1a7UPOop95KOKEAerNYzQBsAGVn/PqYvfHO3G8gnfIUze/Qd48qYEJnzzeWS0Qf+olf6IJGOT6lLC5RGZEMBc1NnumMrEq6CI8ylSfubLqNx2TFVVg3IGBGfRAkP8GMMxrbeI6NaiNp8vzeZ5+cgKeX6Eb7ejRUGysrpX5PKFG2Bg138KtqMv 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: damos_before_apply tracepoint is exposing access rate of DAMON regions using nr_accesses field of regions, which was actually used by DAMOS in the past. However, it has changed to use nr_accesses_bp instead. Update the tracepoint to expose the value that DAMOS is really using. Note that it doesn't expose the value as is in the basis point, but after converting it to the natural number by dividing it by 10,000. Therefore this change doesn't make user-visible behavioral differences. Signed-off-by: SeongJae Park --- include/trace/events/damon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h index 19930bb7af9a..23200aabccac 100644 --- a/include/trace/events/damon.h +++ b/include/trace/events/damon.h @@ -36,7 +36,7 @@ TRACE_EVENT_CONDITION(damos_before_apply, __entry->target_idx = target_idx; __entry->start = r->ar.start; __entry->end = r->ar.end; - __entry->nr_accesses = r->nr_accesses; + __entry->nr_accesses = r->nr_accesses_bp / 10000; __entry->age = r->age; __entry->nr_regions = nr_regions; ), From patchwork Sat Sep 16 02:09: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: 13388073 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 70570CD37B1 for ; Sat, 16 Sep 2023 02:10:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2250D6B040F; Fri, 15 Sep 2023 22:10:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AD836B0410; Fri, 15 Sep 2023 22:10:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04E2B6B0411; Fri, 15 Sep 2023 22:10:08 -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 E96376B040F for ; Fri, 15 Sep 2023 22:10:07 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C2F8C1C9FE4 for ; Sat, 16 Sep 2023 02:10:07 +0000 (UTC) X-FDA: 81240830454.05.5652442 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf01.hostedemail.com (Postfix) with ESMTP id ED6A140005 for ; Sat, 16 Sep 2023 02:10:05 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=JRCz0chf; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1694830206; 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=DVEaMa28rX+Gs6eO+uCsU5jNGvIdC15qzAuqzh03Phw=; b=gdpxhqiKLcPvdLWg2bA2OtMfLeF8RaSs/kOW021+3fya7YVmLpkCbgELK0Fe2I9od6KebI /RcC1zM/lgAk0+b4kfq3TScZ4HYtVWGkPODh//BadoryEWnGIFLAsv5Oe57W6uZtaQCXVU OBrMC9a1/xv8kkoi4K7qAqnumEFyd2E= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=JRCz0chf; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694830206; a=rsa-sha256; cv=none; b=mXeOWYrZX0hoAg7dIKRFKI5YtkNbUsGblGSyRtRZR1M1sw5JgvxI6Qg/qc26sRA8ZKLFfe xfDrIIthjZIDVkvP3b7lA6ItJ0TJhczeqcg4b/lmFaPlvcdDDRlihh/h596flyT8ptXMXq J4ghx8hYekr0SWzTPQR9HkuQIhqFNmw= 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 ams.source.kernel.org (Postfix) with ESMTPS id 63F26B830A8; Sat, 16 Sep 2023 02:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E686C433C8; Sat, 16 Sep 2023 02:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830203; bh=JUVOiKnbFP1P3h1N8WZGp4VELJOnjvi4EWBeSgCcdes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRCz0chf72Vh9+e392vovS+W0gIrf5nqSKcbjSTAfrHR0WzpUZcZfXzufoaUDoCrG i54SHcNj/Dq3jrj0ZdmDdiX84betAgXfTm6kFnaElrGpDSRLgHJ+2jYq64pyXhElOi zdV/+zkOrE0oDT1D1rMiL53MrK1fTQXIj9M0sOxVMejcKxqK54BTp22C9ne46CMjtc tdp6zOu920EzUgs9EaAYhTinj7HWrSt1Hd7fT10QftDqNTxQlWrN7BUHS7gm/skaJr RkgZTzkfGn5ipCSRVOhTpqu7iyRNhME3KIXVvuTNM+V4BPnnmKDjhUEW3GS5kJlxDz h2qUHteRiyjGw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/9] mm/damon/core: implement scheme-specific apply interval Date: Sat, 16 Sep 2023 02:09:40 +0000 Message-Id: <20230916020945.47296-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: n5daozi4tmo7hic9in43swombb5rh6su X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: ED6A140005 X-HE-Tag: 1694830205-513974 X-HE-Meta: U2FsdGVkX18sFnLStQrJ5i4k53icn00iu9OfkYSXrZcBjycohX+VrmelCcy0nFYbKqjsH4Z13ffhuoqKF3EaBkuhoHlNzUg+/JQ0BhkKop1sI6C4Us2DYucUMQJ0qtMqYOaZUD2RhEvDORu3uk3lMV8RiIDK2bm4zzFTgkBoMLrbtuNIWZjqQDe/9GHq0OPW74CiiiOvDD3s312eqQJBtBSibhIvSleUP84aZoV/HqBgFADd8bgydtaSj1ILX7+aw7NYOxmTpL/oUfGoIdtT7uENG76rXW9ciISAUWcYrvqH4uPqlP3fyUl7dRXXlPCz5p4YNTjSW3BUsgWDYF9psf7lm7cSB8i5vVMwC5SRyV5ixNDH9XhOYfUR4P0L4ZwfU8ObWihBj0Ngz8r2qds+fhgseOAMiekEsGVlRPd46QLKf/fBYagDYk9GuP0RfghPeLvV+RamIjMYmxWSBZdszqTqjk747t+fLcec3m7UIKbTrTUCoaF6727b7MKDXSYRjrwgIFyQf+N2oF1jt6ar8btrX7Z4Ft085F8rEdECBKrq6LGElfhIoIjq6RXkqWKK31nXp9VQXsFvJ7m9DavEF3OXSKSs8ThkUark0HJj3muDG2gcKVKXebmRuL74YM9g0wsN0xOc+mkShzxsmls8zfTASGQepTzpfAC6kjK53wnyxNWX7Xwk/RaWZXnoc9jbH5yFiKHvkEaDCnVH8tCWCntJCx4WrW9hNyHxOqV6ibJIdgcpExXJrWnQwN+LN2XxjZtyCr74X+KrHvZEw28s9p0gl3czotXBCiyfJ4IDACAcYTFYZbTB5TF/IOjydBpjJyU6EaTWRdcOaT/kB0j5pQ6bm0iIPxynZCn3ZYyIrrtBGZk4ECliN34CrmTKnVtxfNFlf27ORDCi2qJeg+9hnAOH+01USGSysuOdDfZgWNZWcgdQAGjECrbc0DPGR9pWhAkNbKRn8eZBBsHInZ0 l/2SImXI UEnAF9VOfbe9dfbprqM32VmOilrpB5RLxf/oLCsE6k5ARnTWu4MRFKHlgH+eex8e54kELXML095DbHhK+3+ACm9/C5qlRHuSJZDIRg9kZcvO+pY3DNiztozRDQJgj85sspSpbRXVmJLfDjz/p7AVzl3uKBpl9I/XHjIWK8X5632/NbvpvovKB1w7ssQE9JJL3RmqS9vRLAtsdMfTZokWmWSHgjHR6pQOo+wY6TGr3li+DTBfB6vMwa/MaxHPAW//oGNwMvu7BBtcINRim2RroVjd8/LZitfZOdOMCZtlJDSauLs2gZctHO03DhWOoTd1r60H+aT4nkzb+6LyOuD7Ion3EgA== 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: DAMON-based operation schemes are applied for every aggregation interval. That was mainly because schemes were using nr_accesses, which be complete to be used for every aggregation interval. However, the schemes are now using nr_accesses_bp, which is updated for each sampling interval in a way that reasonable to be used. Therefore, there is no reason to apply schemes for each aggregation interval. The unnecessary alignment with aggregation interval was also making some use cases of DAMOS tricky. Quotas setting under long aggregation interval is one such example. Suppose the aggregation interval is ten seconds, and there is a scheme having CPU quota 100ms per 1s. The scheme will actually uses 100ms per ten seconds, since it cannobe be applied before next aggregation interval. The feature is working as intended, but the results might not that intuitive for some users. This could be fixed by updating the quota to 1s per 10s. But, in the case, the CPU usage of DAMOS could look like spikes, and would actually make a bad effect to other CPU-sensitive workloads. Implement a dedicated timing interval for each DAMON-based operation scheme, namely apply_interval. The interval will be sampling interval aligned, and each scheme will be applied for its apply_interval. The interval is set to 0 by default, and it means the scheme should use the aggregation interval instead. This avoids old users getting any behavioral difference. Signed-off-by: SeongJae Park --- include/linux/damon.h | 17 ++++++++-- mm/damon/core.c | 72 ++++++++++++++++++++++++++++++++++++---- mm/damon/dbgfs.c | 3 +- mm/damon/lru_sort.c | 2 ++ mm/damon/reclaim.c | 2 ++ mm/damon/sysfs-schemes.c | 2 +- 6 files changed, 87 insertions(+), 11 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 491fdd3e4c76..27b995c22497 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -314,16 +314,19 @@ struct damos_access_pattern { * struct damos - Represents a Data Access Monitoring-based Operation Scheme. * @pattern: Access pattern of target regions. * @action: &damo_action to be applied to the target regions. + * @apply_interval_us: The time between applying the @action. * @quota: Control the aggressiveness of this scheme. * @wmarks: Watermarks for automated (in)activation of this scheme. * @filters: Additional set of &struct damos_filter for &action. * @stat: Statistics of this scheme. * @list: List head for siblings. * - * For each aggregation interval, DAMON finds regions which fit in the + * For each @apply_interval_us, DAMON finds regions which fit in the * &pattern and applies &action to those. To avoid consuming too much * CPU time or IO resources for the &action, "a is used. * + * If @apply_interval_us is zero, &damon_attrs->aggr_interval is used instead. + * * To do the work only when needed, schemes can be activated for specific * system situations using &wmarks. If all schemes that registered to the * monitoring context are inactive, DAMON stops monitoring either, and just @@ -340,6 +343,14 @@ struct damos_access_pattern { struct damos { struct damos_access_pattern pattern; enum damos_action action; + unsigned long apply_interval_us; +/* private: internal use only */ + /* + * number of sample intervals that should be passed before applying + * @action + */ + unsigned long next_apply_sis; +/* public: */ struct damos_quota quota; struct damos_watermarks wmarks; struct list_head filters; @@ -641,7 +652,9 @@ void damos_add_filter(struct damos *s, struct damos_filter *f); void damos_destroy_filter(struct damos_filter *f); struct damos *damon_new_scheme(struct damos_access_pattern *pattern, - enum damos_action action, struct damos_quota *quota, + enum damos_action action, + unsigned long apply_interval_us, + struct damos_quota *quota, struct damos_watermarks *wmarks); void damon_add_scheme(struct damon_ctx *ctx, struct damos *s); void damon_destroy_scheme(struct damos *s); diff --git a/mm/damon/core.c b/mm/damon/core.c index 79fef5145a4b..5eb649bd002f 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -313,7 +313,9 @@ static struct damos_quota *damos_quota_init_priv(struct damos_quota *quota) } struct damos *damon_new_scheme(struct damos_access_pattern *pattern, - enum damos_action action, struct damos_quota *quota, + enum damos_action action, + unsigned long apply_interval_us, + struct damos_quota *quota, struct damos_watermarks *wmarks) { struct damos *scheme; @@ -323,6 +325,13 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern, return NULL; scheme->pattern = *pattern; scheme->action = action; + scheme->apply_interval_us = apply_interval_us; + /* + * next_apply_sis will be set when kdamond starts. While kdamond is + * running, it will also updated when it is added to the DAMON context, + * or damon_attrs are updated. + */ + scheme->next_apply_sis = 0; INIT_LIST_HEAD(&scheme->filters); scheme->stat = (struct damos_stat){}; INIT_LIST_HEAD(&scheme->list); @@ -335,9 +344,21 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern, return scheme; } +static void damos_set_next_apply_sis(struct damos *s, struct damon_ctx *ctx) +{ + unsigned long sample_interval = ctx->attrs.sample_interval ? + ctx->attrs.sample_interval : 1; + unsigned long apply_interval = s->apply_interval_us ? + s->apply_interval_us : ctx->attrs.aggr_interval; + + s->next_apply_sis = ctx->passed_sample_intervals + + apply_interval / sample_interval; +} + void damon_add_scheme(struct damon_ctx *ctx, struct damos *s) { list_add_tail(&s->list, &ctx->schemes); + damos_set_next_apply_sis(s, ctx); } static void damon_del_scheme(struct damos *s) @@ -558,6 +579,7 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs) { unsigned long sample_interval = attrs->sample_interval ? attrs->sample_interval : 1; + struct damos *s; if (attrs->min_nr_regions < 3) return -EINVAL; @@ -573,6 +595,10 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs) damon_update_monitoring_results(ctx, attrs); ctx->attrs = *attrs; + + damon_for_each_scheme(s, ctx) + damos_set_next_apply_sis(s, ctx); + return 0; } @@ -1094,14 +1120,29 @@ static void kdamond_apply_schemes(struct damon_ctx *c) struct damon_target *t; struct damon_region *r, *next_r; struct damos *s; + unsigned long sample_interval = c->attrs.sample_interval ? + c->attrs.sample_interval : 1; + bool has_schemes_to_apply = false; damon_for_each_scheme(s, c) { + if (c->passed_sample_intervals != s->next_apply_sis) + continue; + + s->next_apply_sis += + (s->apply_interval_us ? s->apply_interval_us : + c->attrs.aggr_interval) / sample_interval; + if (!s->wmarks.activated) continue; + has_schemes_to_apply = true; + damos_adjust_quota(c, s); } + if (!has_schemes_to_apply) + return; + damon_for_each_target(t, c) { damon_for_each_region_safe(r, next_r, t) damon_do_apply_schemes(c, t, r); @@ -1372,11 +1413,19 @@ static void kdamond_init_intervals_sis(struct damon_ctx *ctx) { unsigned long sample_interval = ctx->attrs.sample_interval ? ctx->attrs.sample_interval : 1; + unsigned long apply_interval; + struct damos *scheme; ctx->passed_sample_intervals = 0; ctx->next_aggregation_sis = ctx->attrs.aggr_interval / sample_interval; ctx->next_ops_update_sis = ctx->attrs.ops_update_interval / sample_interval; + + damon_for_each_scheme(scheme, ctx) { + apply_interval = scheme->apply_interval_us ? + scheme->apply_interval_us : ctx->attrs.aggr_interval; + scheme->next_apply_sis = apply_interval / sample_interval; + } } /* @@ -1428,19 +1477,28 @@ static int kdamond_fn(void *data) if (ctx->ops.check_accesses) max_nr_accesses = ctx->ops.check_accesses(ctx); - sample_interval = ctx->attrs.sample_interval ? - ctx->attrs.sample_interval : 1; if (ctx->passed_sample_intervals == next_aggregation_sis) { - ctx->next_aggregation_sis = next_aggregation_sis + - ctx->attrs.aggr_interval / sample_interval; kdamond_merge_regions(ctx, max_nr_accesses / 10, sz_limit); if (ctx->callback.after_aggregation && ctx->callback.after_aggregation(ctx)) break; - if (!list_empty(&ctx->schemes)) - kdamond_apply_schemes(ctx); + } + + /* + * do kdamond_apply_schemes() after kdamond_merge_regions() if + * possible, to reduce overhead + */ + if (!list_empty(&ctx->schemes)) + kdamond_apply_schemes(ctx); + + sample_interval = ctx->attrs.sample_interval ? + ctx->attrs.sample_interval : 1; + if (ctx->passed_sample_intervals == next_aggregation_sis) { + ctx->next_aggregation_sis = next_aggregation_sis + + ctx->attrs.aggr_interval / sample_interval; + kdamond_reset_aggregated(ctx); kdamond_split_regions(ctx); if (ctx->ops.reset_aggregated) diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 124f0f8c97b7..dc0ea1fc30ca 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -278,7 +278,8 @@ static struct damos **str_to_schemes(const char *str, ssize_t len, goto fail; pos += parsed; - scheme = damon_new_scheme(&pattern, action, "a, &wmarks); + scheme = damon_new_scheme(&pattern, action, 0, "a, + &wmarks); if (!scheme) goto fail; diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 7b8fce2f67a8..3ecdcc029443 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -158,6 +158,8 @@ static struct damos *damon_lru_sort_new_scheme( pattern, /* (de)prioritize on LRU-lists */ action, + /* for each aggregation interval */ + 0, /* under the quota. */ "a, /* (De)activate this according to the watermarks. */ diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index 648d2a85523a..ab974e477d2f 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -142,6 +142,8 @@ static struct damos *damon_reclaim_new_scheme(void) &pattern, /* page out those, as soon as found */ DAMOS_PAGEOUT, + /* for each aggregation interval */ + 0, /* under the quota. */ &damon_reclaim_quota, /* (De)activate this according to the watermarks. */ diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 093700f50b18..3d30e85596b0 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1610,7 +1610,7 @@ static struct damos *damon_sysfs_mk_scheme( .low = sysfs_wmarks->low, }; - scheme = damon_new_scheme(&pattern, sysfs_scheme->action, "a, + scheme = damon_new_scheme(&pattern, sysfs_scheme->action, 0, "a, &wmarks); if (!scheme) return NULL; From patchwork Sat Sep 16 02:09: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: 13388074 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 BFEA6CD37B0 for ; Sat, 16 Sep 2023 02:10:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61CCA6B0410; Fri, 15 Sep 2023 22:10:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57ECF6B0411; Fri, 15 Sep 2023 22:10:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D0C46B0414; Fri, 15 Sep 2023 22:10:08 -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 243B16B0411 for ; Fri, 15 Sep 2023 22:10:08 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 034611C9FE4 for ; Sat, 16 Sep 2023 02:10:07 +0000 (UTC) X-FDA: 81240830496.07.2211362 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf04.hostedemail.com (Postfix) with ESMTP id 53D044000C for ; Sat, 16 Sep 2023 02:10:06 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=D5fwDD0t; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1694830206; 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=/taA131RLMOon4BDgU01sqZZPFDcXmF9GVqTYwaZBbU=; b=dHT7zhQvyT6aaD8tCudBzx/VM0d1z02+taki4bTzAaSZkR/CwsPJUam5EAAQp6xGjyM/zW r6VLcK2sAT5+vD239QxTcvZRYdRSVtWlM5ysb7L/Yp/ZY9d62nyypkX4FgpcwyBVxeH7qn e7SJJAA8CmaHerK2BXE6G36hhJVW9dI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=D5fwDD0t; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694830206; a=rsa-sha256; cv=none; b=rOeIIgihyVGFYMzCbZvOAHqIxg+bmpLaauavNdYJhuMP4BOKz8aRCSJb5t9N3UQcmLNUay Sbw44tV3f4LGIwxdRVU3xlQOW/anKr6N4EhtymPETbe/6VZdcd41bGfjK0GOF1IlRiAfLj 1u9c1DNV6/Ahh9/PtqFbWiWi40jNhVY= 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 ams.source.kernel.org (Postfix) with ESMTPS id 100EAB80D05; Sat, 16 Sep 2023 02:10:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 382ABC433CA; Sat, 16 Sep 2023 02:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830204; bh=nsy3XKNul10yj7Y4C7UdRuVcXMAYGZfrN5/ruA9B7bY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D5fwDD0thq/Rt72hGYBK0NcXdn7gIm9hhCVt0E9COGIdJlZlT5diQNJHgrqlRm2/w /hJeRDI7YMNSa34674k2tuFz1TEtFUrS112DzxcXapnvRWe7lRkVkVGzUcP4Q6Mn1S RpaUPA/u6e+cUlUNhbCsmnNL8YEvnugttaxfg5Eu55gGGazyO5netSuj1JvK/y7F1I jvU2m8i4d4PyQ79MLBzTW0/6LiTw7gsPVE9Ca7ZMS7lGESQDY3HJxS9Z7YfMVuCJuP eXOAdloC1XbqCLlzqjd+bAxppTZqzXuG+XazVEwVZw+8OGlmGvK9EkXfP830RlrvVI IRF8dNOB4kzZA== 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: [PATCH 5/9] Docs/mm/damon/design: document DAMOS apply intervals Date: Sat, 16 Sep 2023 02:09:41 +0000 Message-Id: <20230916020945.47296-6-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd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KzSmoFnN+Zzh6w2t7GcjvW lg0XsAPg poFWSIX1yKlaPw0sFAcgezhkqYfiaEz+ZVl7avCkPSg47NYNFTz3B2AoF0fR0k12DcDniHGrEKfEPowVXHaf60zQ2cHtKRaaMj1pS74r+7O/uxM/OR8cH14VhL6jXpOu7T8CyYs4pspGBD/QfZKFmhrYm4xnICaZARtcaVCKezZcyLVUzc19rjHMZj7gpJs5VwyjTwNmiOULu0nexpPD7bfzKS8oDRoXNVDseUvk1XZe0bOoQHB7SXWENFhmQNFRPS/Uc/ccmTsyhUQroQKOb3lHAmDhE0HzCAsVkvPDI6UUCXnxxwj8g54YPrqK1SRQv+iEEXf0jkbMygcLG9NB4jqR+SA2NqDrfMrE/32GJ6TN09BQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update DAMON design doc to explain about DAMOS apply intervals. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 18e9b42673f8..1f7e0586b5fa 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -259,7 +259,8 @@ works, DAMON provides a feature called Data Access Monitoring-based Operation Schemes (DAMOS). It lets users specify their desired schemes at a high level. For such specifications, DAMON starts monitoring, finds regions having the access pattern of interest, and applies the user-desired operation actions -to the regions as soon as found. +to the regions, for every user-specified time interval called +``apply_interval``. .. _damon_design_damos_action: From patchwork Sat Sep 16 02:09: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: 13388076 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 1E7D1CD37B0 for ; Sat, 16 Sep 2023 02:10:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09F976B0411; Fri, 15 Sep 2023 22:10:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 028316B0414; Fri, 15 Sep 2023 22:10:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C36F06B0413; Fri, 15 Sep 2023 22:10:10 -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 A91F56B0411 for ; Fri, 15 Sep 2023 22:10:10 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7F87112081C for ; Sat, 16 Sep 2023 02:10:10 +0000 (UTC) X-FDA: 81240830580.23.726CA2C Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf29.hostedemail.com (Postfix) with ESMTP id AE3F0120005 for ; Sat, 16 Sep 2023 02:10:08 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XUb0Za8b; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1694830208; 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=NUas3Av5c7Yuwe0Tw6b8l7+Jb4Jf4UY1Y9mRHVVQKto=; b=iw/gaRaV18cgJh56gNVuEi4e1eSaTrymj6Etm+GkeWxGFY94oWXz8pKgy595Cs+rUfD1lz UICO13f9J+zY22jrLBv4VagdLl5ZI6yD9L8ZPqIj4Nj/dSlpVA+d62sg26W7yNvGmFSpfN feFa2d2LPtUGRGW32q88t86mIDiDdZg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XUb0Za8b; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694830208; a=rsa-sha256; cv=none; b=PUYREdZ/uDeJD61VUPDOZs++jFFdw/Tbz7Kn8Tl3NHxqAO9SbAUMzvCU4Mt3ynNiMRxosI ljitxMkb49+QJb9+h/Rj2L6bb5HRam9J/y2zWlhDyFKEPTSm8FSe7N123f3p3X9O4vHHKO ZtpJ3JXeo6fL5P3LDBodPxJjyvOo96M= 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 ams.source.kernel.org (Postfix) with ESMTPS id 67A5BB830A9; Sat, 16 Sep 2023 02:10:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8E34C433CB; Sat, 16 Sep 2023 02:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830206; bh=CxNdbzA0gxD0qFOAF+9FaJdfdv1eofTN2A5LeDdD5oY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUb0Za8b5NIRMAAJKo0tr9S53C++iGSYlP/jV4+2zMzBqfI5andQM3B8DKRE56GBE JYVNEg6j5tUbTrcXRo4I1lkPLG42yvwG5xUWCn3ezU4XMMbz2mOMwtn8B6BlIZq/d4 ICfyBmkefS09qC8by3z7VGo0i/vBV1m92PDvsbYYIwkdYLNmCZt/tpLHa+pEUw1vte RUoB1p1dMYcv5w1MNew42XFfsi5Wj+8P1zNARMuVwKQcUxazpj71sjgncklfPPnxin hiFnZpeP0MrQ5VCdcqcs8Hz8fv0mc7IYZ0/BWUsmqotVbhAEPBu1U+6oDF5nxeh2GC 5OM5b/TUAD5og== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/9] mm/damon/sysfs-schemes: support DAMOS apply interval Date: Sat, 16 Sep 2023 02:09:42 +0000 Message-Id: <20230916020945.47296-7-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: szs4br3ynkpgfcr8p6swsjzcn7yasy3b X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: AE3F0120005 X-HE-Tag: 1694830208-938996 X-HE-Meta: U2FsdGVkX194RH92jGemAPzf0wG4p2WfUjQ37gIQD99BJ+C/LPB1ByPR0SCo2FYgwkrAf7yqHvmk0690XBnIp4626wjZovTEMZvH7ilXk7nTBqQ+WNcQd7ebULi6GWKywQf9blXC5uuIpx1YHuk5ZMDDheCQ3q7Ev2ZCb9eaBwtZFZNSdPt0ckRLihoygodpW4eGzlmhOIhsrVE8e+EWIKne1ia+WT4MXJMhIXu32kYZXLCDgTEwL1H+c3ETGwZCzamBtsRDhrmhknOmDGpB7n4SKgz1W/GjRc1fss2JBBBAi+9e2hjpR1saEgtzGsLS8U1ISh7Fnd/vMoT/aevau0u1mV4XIybV88xMaz3TMTsx4IB4RqjuCOG5o4Ii8eRZPzSHln2TwRXRK2v2cm2jAKE+gMhe9XJzLt62CPcUyiKmU7ver8nLq4ORuNpjx0NyuOpUoLyLXLhlbOCn1yLsDDQL+jjtXi3VfcyDIwtnyxKHtIor226zkTyq9ELgui5oqjomxcw7Ij6dNFNWSwtxLHOhW0eJ5EcvhNnmQGZKppwNFHI6mpBp2CgZtY/Exg5VGL27UjGa0mPDk5y5otKgMYJ2WatG464V2YtCZzdPkFDFjsQDbqXSohucec1H9Cj7yJhw3uWa358Nimxt0X+MoSqqpMYxJ2ozre+Dk3g7t2Jfo+pAY2M4cchEmmaqb+Wje9nJLiCRAtS+pti9UtIRrEmMHdlT4pkrTdtAN321UP2uzQjABX+VHTr9pekWU/5WmxaToEWmP2WwCGj+HPKbdpnxXAUpe1QJzb0ubZ6pzkxiugwAxmFTYPpHxWGTncuT8tLLL74MO/Cc+HFMvjPagk6xMCHxrc6lwx7BCn+NAmJPNiiIGaxJQGe+7BMSz/O4BhjGINjkYw6bzACIJT6yumx2zpcGvrb3RUP2BWe2JaNMFWQUCQys+YfskIC1cPwYdSZHNZi9kBKMbex8Fjc VBehnZGk O9oJ8uiPTI7j7YxieoBOHZgYbUtitL1I316GAlYL4y0OzRFd9o5VtSxgyvpB6hyZhnvGIQPnSa7CTtO4XJ3L0ZDqJKM1oEx24m3SOxODii2zxUvXy5YJAc66waxq+eA/O3PzK70xD873H4qF+y/Hbfp90lKuoweiMHoOVRsEq45UjQg3jcMqn/+GCBnQ374kcIeXs79L+oD3JkGVbH9JN8FeY/of+x3QTbCfizd5sxJ2Mxwt5LLs47zwiRlLSHDgwKUkePhlDwQi7LHsNmGQxNte8SAD5/YqQ9/1CB8RW7ulDyChQ7pZgFWCKeRP7Uri72dMVZPEYePM+m/RoqbBA9Zoa3w== 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 sysfs interface to support DAMOS apply intervals by adding a new file, 'apply_interval_us' in each scheme directory. Users can set and get the interval for each scheme in microseconds by writing to and reading from the file. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 3d30e85596b0..a7d70b95c4dd 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1121,6 +1121,7 @@ struct damon_sysfs_scheme { struct kobject kobj; enum damos_action action; struct damon_sysfs_access_pattern *access_pattern; + unsigned long apply_interval_us; struct damon_sysfs_quotas *quotas; struct damon_sysfs_watermarks *watermarks; struct damon_sysfs_scheme_filters *filters; @@ -1141,7 +1142,7 @@ static const char * const damon_sysfs_damos_action_strs[] = { }; static struct damon_sysfs_scheme *damon_sysfs_scheme_alloc( - enum damos_action action) + enum damos_action action, unsigned long apply_interval_us) { struct damon_sysfs_scheme *scheme = kmalloc(sizeof(*scheme), GFP_KERNEL); @@ -1150,6 +1151,7 @@ static struct damon_sysfs_scheme *damon_sysfs_scheme_alloc( return NULL; scheme->kobj = (struct kobject){}; scheme->action = action; + scheme->apply_interval_us = apply_interval_us; return scheme; } @@ -1353,6 +1355,25 @@ static ssize_t action_store(struct kobject *kobj, struct kobj_attribute *attr, return -EINVAL; } +static ssize_t apply_interval_us_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme *scheme = container_of(kobj, + struct damon_sysfs_scheme, kobj); + + return sysfs_emit(buf, "%lu\n", scheme->apply_interval_us); +} + +static ssize_t apply_interval_us_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damon_sysfs_scheme *scheme = container_of(kobj, + struct damon_sysfs_scheme, kobj); + int err = kstrtoul(buf, 0, &scheme->apply_interval_us); + + return err ? err : count; +} + static void damon_sysfs_scheme_release(struct kobject *kobj) { kfree(container_of(kobj, struct damon_sysfs_scheme, kobj)); @@ -1361,8 +1382,12 @@ static void damon_sysfs_scheme_release(struct kobject *kobj) static struct kobj_attribute damon_sysfs_scheme_action_attr = __ATTR_RW_MODE(action, 0600); +static struct kobj_attribute damon_sysfs_scheme_apply_interval_us_attr = + __ATTR_RW_MODE(apply_interval_us, 0600); + static struct attribute *damon_sysfs_scheme_attrs[] = { &damon_sysfs_scheme_action_attr.attr, + &damon_sysfs_scheme_apply_interval_us_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_scheme); @@ -1413,7 +1438,11 @@ static int damon_sysfs_schemes_add_dirs(struct damon_sysfs_schemes *schemes, schemes->schemes_arr = schemes_arr; for (i = 0; i < nr_schemes; i++) { - scheme = damon_sysfs_scheme_alloc(DAMOS_STAT); + /* + * apply_interval_us as 0 means same to aggregation interval + * (same to before-apply_interval behavior) + */ + scheme = damon_sysfs_scheme_alloc(DAMOS_STAT, 0); if (!scheme) { damon_sysfs_schemes_rm_dirs(schemes); return -ENOMEM; @@ -1610,8 +1639,8 @@ static struct damos *damon_sysfs_mk_scheme( .low = sysfs_wmarks->low, }; - scheme = damon_new_scheme(&pattern, sysfs_scheme->action, 0, "a, - &wmarks); + scheme = damon_new_scheme(&pattern, sysfs_scheme->action, + sysfs_scheme->apply_interval_us, "a, &wmarks); if (!scheme) return NULL; @@ -1641,6 +1670,7 @@ static void damon_sysfs_update_scheme(struct damos *scheme, scheme->pattern.max_age_region = access_pattern->age->max; scheme->action = sysfs_scheme->action; + scheme->apply_interval_us = sysfs_scheme->apply_interval_us; scheme->quota.ms = sysfs_quotas->ms; scheme->quota.sz = sysfs_quotas->sz; From patchwork Sat Sep 16 02:09: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: 13388075 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 46C1CCD37B0 for ; Sat, 16 Sep 2023 02:10:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3CF26B0416; Fri, 15 Sep 2023 22:10:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B238B6B0415; Fri, 15 Sep 2023 22:10:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C5506B0414; Fri, 15 Sep 2023 22:10:10 -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 83F066B0411 for ; Fri, 15 Sep 2023 22:10:10 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4E12C120817 for ; Sat, 16 Sep 2023 02:10:10 +0000 (UTC) X-FDA: 81240830580.21.DB58E68 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id B2A44180007 for ; Sat, 16 Sep 2023 02:10:08 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SKhM4RCi; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.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=1694830208; 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=QGvGFrXp8RrAxQNw97Ot4AaOxtjAjo+XaujrL0TRHLE=; b=DEcFaj11dx1GM2IMK9XTjhtU1saHuNyBMzdtNiPlR0XEjTEJvkzjKWxMdl5fj7zggBW6Nz whjAZ0n2//Afa0u28w7R6X6+rVECFea5xVwELLT+twE57D+E3T6Z2lKTvuINXGLV0XEz9H t++I/h5wQ6mjJ3xIxesYfNL0gmosRKQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SKhM4RCi; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.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=1694830208; a=rsa-sha256; cv=none; b=PPY2TYBSh2S7Cog/Fb2s5orAbGRbaBz/U4EfvdxanW/XXll7d1uTyr/OGX9CSsiqFgVWMc t/KJ8pEyaKNsGHGZltKZHN+CPsef4aH5xGopyzi/rfNvZ0jpKahrF1vvnQHLjX10oQGGUz HLg9zH9oNVCu0hYjJHFK/rYxLYJW6dI= 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 D97C4621D2; Sat, 16 Sep 2023 02:10:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D3E2C433C9; Sat, 16 Sep 2023 02:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830207; bh=I2fvF7L5MWw0Xd6X92VF2iHBCnxT4grJu/1S+mVZwhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SKhM4RCiPW/WTsWk5JRgIEMREqf3W6POSXpmuWjX+pNtpbUKhf9uSSUSCfWwTyVmt O0IjP4qBbo7CWUTv7afVCGvVFZEuytTab+a9LlQKW78/utBW81O3uDztR6cOx5ev64 pIX82Gd/olQdHoBt8QLIc80rPpTTZd16EGrkeI9BkD0T3iFbc0tiYmCH/AFuqA2fFY j4s2acBog/OIGBGeyBvNG+xzEImkvBvcF83HnXH9ajYft0z5YG6VdlyQ3G190oTika y4PWdtiibt/78XrDsqhUy3bsC2YFWGbyhY1zo9tv79mChFaA9yJPIfOFqFoQTp8xQD H4lwh2LfGuiTQ== 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: [PATCH 7/9] selftests/damon/sysfs: test DAMOS apply intervals Date: Sat, 16 Sep 2023 02:09:43 +0000 Message-Id: <20230916020945.47296-8-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B2A44180007 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 5t16tzqdcqesw95udrrg1njguok3qo74 X-HE-Tag: 1694830208-878184 X-HE-Meta: U2FsdGVkX18BX2fgtlDDIZVKE8ptW9+Y7wcwM2Y61tsM8YuIVytbOe/ILREjae7Xc9t4TLSyQM5RaEpyjoixn04ke8y/iMLPKWUvftJoS2H3Kpz6DD330nD2ckNevEyStv2rFgHZBPiePumw9z+zry7ZAnwrlABL4iYHFLdDNCiOw4NfbmaW7qCH/aHFE9Su8ZBuCXRojGe/go0ns55ZrQLFlvfBIjvdGdSPhl5ZZ0WadC/zxOm8e86YtQ/5E7O8ZcyrCvRzxyvUJxrtktioFr7L0oDA7Evrng9E09WgkJpjmZ3DcVOyXOibhoD2dv6f0kPubNOWrB+Qg9c3DMvhlrxTnOCu31y5i73WLHnNOtOMH8EmbCvXaZxrdCmT2yJXbsPnVepXWXZoMEkpb/HHvFASJakdlebTgZYke357290xpRu1Z5wNtIRg/gZDV1xllcYvrhrugb3kIlZLgBlZg1uu+5tE818lq0ec0yu4ENe86blROIK1oFdWvCzY00B14fsJqm/2GsVds9SB5BLBfifwARTaF51ysGhEZDp7oFaDf9ijg7ToKB3c9R641SXxyphDQKZckWTr4Cs9lIbN9Bi3Q2vEXzsySE66qkaN+MVaQgHCyTDoqbKF16U9/+TL6PispBdq9zyFqbo6JZTsChf9aMhFKcfRxT4MFLrYABzdft55zgxaeg/EcuF/7+wEYSazEaMKpKklQbzFqUlOky6BgmvxZy3N4aNrmzbI7fy41ZmVRkxKeZD0J0SILzmSdXBpEDQ1I4VfXwaijuVrkLKAPNFbZK5nMADKN0BKlcknDjYoIt0hcwVpY9NmRVZj1YjDaaXsgKgI0hIi7jHKzBmXtbW4mGmorEoNL/zSkO7IWe5RRzIMXWt5OH16HA+kBYzjUm9dCQrTnukYlT0ELX+vmrx3eJJYUIopcmpY/zHwQSuT1JPAJDThES1GQeUUyj5EGT2SWuutod3eLxW g6Tp8Ho0 fol8+2jkCfN0C4WFhewEkLBsgUpOk8mxjU7o6maWjSfOcZ2wg24YbDfBuNm/ilQmSpIvDzFvhndD6WzTmY+m8amuotst+0tHd4xc0U3UrUehS6j39lMXdY0nymRa+vTxWRgAmncIaUdgifyV8doFsgi9O2g5FbVt9WuzgFnks8OKy7tvR81khaNIyQfH00VHteiBuNAAaRAAxLjurTKHM8E4cm/lx/ZvoOIEtSXJ5drNypwd/ThIREndve7Uaf3XGHFCQioYTbpL0ceMqla4WRgNFiSo2ZnOBDN38k5OMM3i443STOTMY+wPP8XydViTOx9ppiXyHTr6lVFNd5ML4KxbNqHzDmBAsNO252f6o7XsNxiQ= 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 selftests to test existence of the file for reading/writing DAMOS apply interval under each scheme directory. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index 60a9a305aef0..56f0230a8b92 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -175,6 +175,7 @@ test_scheme() ensure_dir "$scheme_dir" "exist" ensure_file "$scheme_dir/action" "exist" "600" test_access_pattern "$scheme_dir/access_pattern" + ensure_file "$scheme_dir/apply_interval_us" "exist" "600" test_quotas "$scheme_dir/quotas" test_watermarks "$scheme_dir/watermarks" test_filters "$scheme_dir/filters" From patchwork Sat Sep 16 02:09:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13388077 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 CBCC0CD37B0 for ; Sat, 16 Sep 2023 02:10:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C74C6B0414; Fri, 15 Sep 2023 22:10:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9500B6B0415; Fri, 15 Sep 2023 22:10:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A3A36B0417; Fri, 15 Sep 2023 22:10:12 -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 653026B0414 for ; Fri, 15 Sep 2023 22:10:12 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2F6BA140750 for ; Sat, 16 Sep 2023 02:10:12 +0000 (UTC) X-FDA: 81240830664.13.FEBE754 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf26.hostedemail.com (Postfix) with ESMTP id 85E64140010 for ; Sat, 16 Sep 2023 02:10:10 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RR9Frdag; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf26.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=1694830210; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pn6oOlASxZHN7mPKejPZwPvUfkQcqx14txayV6bXunQ=; b=6pNj0CnoGzD0fQaKrPUYN1YOnP92rgY7USykiRLR1k8jo8o9vfXYMC5188EuKgxNPcsUqk 2aG1yDWFhBPEZ19CuhVD3AcdgpoLg4OU51oIpt3Y8zVqAHDSQ1WMxSPeDx933y1tQVxE1f BE7HgBBc+6xpaZ+rEDdx4Ca5CksSOFQ= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RR9Frdag; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf26.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=1694830210; a=rsa-sha256; cv=none; b=eVJtj6nJ+4fDtBEzqxAGyrEXBuD65eBZBVwVn0APbRSmQABfJOjUZ450fldv4d70vtLBcB Ap5SDvV5kHOQtCTjc2g4KpphQUt8Auu9AcRQBeDiZfWnkifz8rsNme+bGluHvu84O1S0Gg uGTA5jC/hr/dIwjoiBK0+ucvVm5JphY= 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 B7CDF620ED; Sat, 16 Sep 2023 02:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E569C433C7; Sat, 16 Sep 2023 02:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830209; bh=mFM51HzoacyqEH6SUQlgy6Seux4I2scRhn39ZTi26N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RR9FrdagkAthQDZzU/MqLOXvaeDFzI76AyKnmNaANhjKl5qK562b8z09HGpclirta jYc6LhrAJdUrtF6/8jEUYFxkzhz4DQs0wM8OIqyrP6MuYh5q8fsrOCkAhZ8cDkRDL+ m68G1t0/aauOfr5qF8XtuEjYHQmFewU+Siz5iH7DwXksWnvKxs++VqIl9SDSLjoUoY 0QdXTO1VgnyGAGXCuhbJxMUqcWGdICS6t8Md21tTKIOimgBmf0pSxHXMHOvbu2Sjsc As4vL2HJ+p/l6ENXnlhs5iHasOdBcHl2cwXlMbhtQReq+p8GnBNOXcxmZ4rOV/Zo9t 87jyj74Sod1Gg== 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: [PATCH 8/9] Docs/admin-guide/mm/damon/usage: update for DAMOS apply intervals Date: Sat, 16 Sep 2023 02:09:44 +0000 Message-Id: <20230916020945.47296-9-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 4d5yay9nexqdkyqu8s9ihaydoia1quzt X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 85E64140010 X-HE-Tag: 1694830210-566863 X-HE-Meta: U2FsdGVkX198wDnf0WId88B7XTostjOO4om9EPtdd8p4yiK5Qkoy3EnqIZuwFRE+7tBBHlHRTQa/2aFc/OS+kjxvwLerMops330jfsN4qrzzpbQ84lveoffz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SHLmd9G0qexCXMaSkrRTwOji4xxe1KxXLUPcSEckB8CSLsqxJ9fCCTitrW89O+amARTLnB6uYSxTdP7Xw8ZllhSr2EUYFy4xuNwzPq6Jzbp6PJyy18gktVx2qdwZItxaHhFvHDN4xSYf5mSErBI+j0u 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's DAMON sysfs interface section for the newly added DAMOS apply intervals support (apply_interval_us file). Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 6272cd36590a..8507a6e45d86 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -76,7 +76,7 @@ comma (","). :: │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... │ │ │ │ │ schemes/nr_schemes - │ │ │ │ │ │ 0/action + │ │ │ │ │ │ 0/action,apply_interval_us │ │ │ │ │ │ │ access_pattern/ │ │ │ │ │ │ │ │ sz/min,max │ │ │ │ │ │ │ │ nr_accesses/min,max @@ -269,8 +269,8 @@ schemes// ------------ In each scheme directory, five directories (``access_pattern``, ``quotas``, -``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file -(``action``) exist. +``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and two files +(``action`` and ``apply_interval``) exist. The ``action`` file is for setting and getting the scheme's :ref:`action `. The keywords that can be written to and read @@ -296,6 +296,9 @@ Note that support of each action depends on the running DAMON operations set - ``stat``: Do nothing but count the statistics. Supported by all operations sets. +The ``apply_interval_us`` file is for setting and getting the scheme's +:ref:`apply_interval ` in microseconds. + schemes//access_pattern/ --------------------------- From patchwork Sat Sep 16 02:09:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13388078 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 67AB6CD37B1 for ; Sat, 16 Sep 2023 02:10:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D16E6B0415; Fri, 15 Sep 2023 22:10:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 557ED6B0417; Fri, 15 Sep 2023 22:10:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38CD76B0419; Fri, 15 Sep 2023 22:10:14 -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 22A826B0415 for ; Fri, 15 Sep 2023 22:10:14 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0208C12081C for ; Sat, 16 Sep 2023 02:10:14 +0000 (UTC) X-FDA: 81240830748.29.400731F Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf10.hostedemail.com (Postfix) with ESMTP id 506D0C000A for ; Sat, 16 Sep 2023 02:10:12 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GVF09ecm; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1694830212; a=rsa-sha256; cv=none; b=f8V3Txk0obnoRdAqoZGTefGcZEi6Fh5Z7xur/fXbdzKPmpb+RQhxZ1ZUlfVFKs6tni+Jxd /4kypQXPDsh8azeja+yZGzM5magiKojB6Jj+ZnKlpe7E4vyR6TwkC76W3pMjBkhoWdyEHm 9zradE490qOg2vPQdlRk8FEDAhRtZaE= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GVF09ecm; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1694830212; 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=alqlwqGbXdvxEAQtsSQzGpGwyTFVwe6CMf9RuauYePk=; b=0/TvYnMCYJaTCUhu3ztMvBReIGF6Wf+3eVL8BB8An+lGa95tYyfyuI9453PaM4+poYkH0D zz9LHJrLOBzdAfTbdxb3L35aa0ki9rIF6UJADazrbpdt2ypYkghEwRgYb7icky9tYHLvHo ElCh1joaWpq72YxoZ8QwiC8d5lOBEBo= 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 ams.source.kernel.org (Postfix) with ESMTPS id 003EDB830A9; Sat, 16 Sep 2023 02:10:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EFD3C433C7; Sat, 16 Sep 2023 02:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830210; bh=eynGbeHbTWCoAAQx22o6QCyTrP+ceLiyJPZLaUvkSBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GVF09ecmlXNA4Gm1ne2dlVGwKKBXDHM7gFSXc2cJejlIaCwBwiyeVvNwFI8Qm1Tfz 57C3h2zwphY3lOIm91d/nPqTyId4O9EfmA7qYlfZ9pjrLCWypmdLyaW3wq3kfx/g8W Ufot/UzqKCXn8eA1oOnj4ZTfdWwtg6ZxJIY0OXbLrx84eKVr2yfBGvmHItm70EhTmB t3jF1TX9mCuE5CdDmblHGw1dNK/2+9ZUjjNb3fryk2dA9h1md0SpkSkadBy1RnkSyV DaY+5mNkaYiItneVpS3IfMc+s+ZRSPTYENbTucEylRX2yfN09HKustYnQbjbq8Hlga PKAnbxZfPOZOQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 9/9] Docs/ABI/damon: update for DAMOS apply intervals Date: Sat, 16 Sep 2023 02:09:45 +0000 Message-Id: <20230916020945.47296-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 506D0C000A X-Stat-Signature: 5o8qr9qbuuufjdrduf177ndgyk1mydgr X-Rspam-User: X-HE-Tag: 1694830212-65056 X-HE-Meta: U2FsdGVkX1/Lnr+dGkaC23lM7pZd3DyAIlYzt6fYVScilVQk5KMLoPcwHVpSZaN9jbs1GWlEY4fGtGJKgiUsJ5hC6/a6eXm4A5U5Ha+H8LMB2WAawAYYqzFoVa17q+PvsqSu+Ffz5tAXpCbvhDLXXaY5v9QCPfJlAy7RZpk/IrcTqJxvtjZgHYSVYTF9okOtA+tfPyo4blVGRoZ2vyV9mg9Gb5Ue84KS+8wxFaraEIQxlcADL30xAY/cyYtUUHF2gYUYFyLVUbtVd5q7I0fXODRtp/XGxgst8oJNb+eGhAU8SsRLKCF8i9LOJVN9VLcYgtlomCJjS+IWg0yJ/FZZeDuYwJfqZ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ender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update DAMON ABI document for the newly added DAMON sysfs file for DAMOS apply intervals (apply_interval_us file). Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 420b30f09cf0..b35649a46a2f 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -151,6 +151,13 @@ Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the action of the scheme. +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//apply_interval_us +Date: Sep 2023 +Contact: SeongJae Park +Description: Writing a value to this file sets the action apply interval of + the scheme in microseconds. Reading this file returns the + value. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//access_pattern/sz/min Date: Mar 2022 Contact: SeongJae Park