From patchwork Fri Jul 28 20:18:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 127875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp698918vqg; Fri, 28 Jul 2023 14:22:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlGD42MM9oXQl99Ub6flYcpl0X52CDajWk6g9aL7iHntwCM64llw+9DK118QZEy3IIJrs1Mf X-Received: by 2002:a17:907:7819:b0:99b:d168:41e5 with SMTP id la25-20020a170907781900b0099bd16841e5mr413700ejc.54.1690579372660; Fri, 28 Jul 2023 14:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690579372; cv=none; d=google.com; s=arc-20160816; b=0u+gUqmmA6bITyTzlCjt4UYvnT5QvkEBlo9CvMfHMwzTI5Hy4q1bdlY6gPMqJGiLtr v00pRZJKnZwtO6+gdmO+eK4A/b+3bK8BaEzXQvmeIoQDBzvcr/BerEXa9RoWnjo8vzrT SfaOPCxFdjvJ24sHWiu7P4EtOwWH9CIa+zLI3oP8F9r5CI5w2l3zw+SU4hnZv1rmPsT7 HyOSVOLtN+cEe0lVoAjIyh9BtMM+cRnWOeMykmXyYTI3xYOFI6A8Hi7zMwAmOcHPoaoI vuensW4B6+GZxHBkW5ArzKwGHV5SsaYhgUrBsrpI5ud5k1QXnh+HrIL8gsD0K+m16JkA eg0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6Uog1QOfMkmzFkqlp8sg/lEIxnloSXWhmoyJq/BlhU8=; fh=8oGWbdHExGIIBBigm5y9/rZRjvqmeY+HpW+qV30w+go=; b=RXb93Dc2xShJ0umxdDBLle2PwoSBEh2M2Q/FOoxOM7GNWbBh2sUPjrSDR9up0MQLdY 06GAlpDCh52g+mTpbtr6vkkouFpWnByDEdB9551kPIk0Cf21r5xWnXIJA+KcAD/LIHUt GM6hVY3JmvMglCxZl3w5mdVckX7xJwG/4+2DLNwGJ7B5puu0n+kGCWhlE6qfgiAEuG9K j9LT28tJAi1vAQmEzhTpbj3yTiDnDsy3mfu21tCTOg0Z8q2Kdqs5grUGiIfCRy97cbmh K5A5TQEMfUumPC4fHUxwiGVxEp9Jl8Vmve2TSYbd3I0JLuove/1Y6DiqMZtmlpcsm4of zLew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gtAzWRIf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170906838200b00988da9cd05csi3343445ejx.23.2023.07.28.14.22.29; Fri, 28 Jul 2023 14:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gtAzWRIf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233926AbjG1USd (ORCPT + 99 others); Fri, 28 Jul 2023 16:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233319AbjG1US2 (ORCPT ); Fri, 28 Jul 2023 16:18:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC6444487 for ; Fri, 28 Jul 2023 13:18:27 -0700 (PDT) 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 7B4E6621FC for ; Fri, 28 Jul 2023 20:18:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D019C433CB; Fri, 28 Jul 2023 20:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690575506; bh=8j2+FNiZI8rNwlWT1Owk5tX0jfkbTMQHhOcdlB3rG8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtAzWRIf66KYbWmItbkVHlcngdgrqWJ6LlxXFcSH7JGfJ6rIgHmKBYZ7kRMu+/P14 txNVbLhn18kP7h/FruOB4BNzfTaRfdyxQfDzvotC0eQeA2xrfIAtuem17mVWLTFMV7 /4+wDQRTlL/JnV+uwEEqUkCAibVt1zSI78urjrJZZL7sPsLxC/DODW1BV37+ENcbPe F0B6CBl+QuMyHArXvm3w2EnWyl4kiIeKnMPzJuhkM/38MymeAnA5y8qF5bBqsl8Rrs Txxdl1ZJLnrUiq/iXAFgsLYphZYiKB7NtVm9ywfrDpnzz1OuifdU+0NdBSVGALVPyF Ii4l+Fdf7G2nw== 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 2/5] mm/damon/sysfs: implement a command for updating only schemes tried total bytes Date: Fri, 28 Jul 2023 20:18:14 +0000 Message-Id: <20230728201817.70602-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728201817.70602-1-sj@kernel.org> References: <20230728201817.70602-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772700956568526239 X-GMAIL-MSGID: 1772700956568526239 Using tried_regions/total_bytes file, users can efficiently retrieve the total size of memory regions having specific access pattern. However, DAMON sysfs interface in kernel still populates all the infomration on the tried_regions subdirectories. That means the kernel part overhead for the construction of tried regions directories still exists. To remove the overhead, implement yet another command input for 'state' DAMON sysfs file. Writing the input to the file makes DAMON sysfs interface to update only the total_bytes file. Signed-off-by: SeongJae Park --- mm/damon/sysfs-common.h | 2 +- mm/damon/sysfs-schemes.c | 7 ++++++- mm/damon/sysfs.c | 26 ++++++++++++++++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/mm/damon/sysfs-common.h b/mm/damon/sysfs-common.h index db677eba78fd..fd482a0639b4 100644 --- a/mm/damon/sysfs-common.h +++ b/mm/damon/sysfs-common.h @@ -47,7 +47,7 @@ void damon_sysfs_schemes_update_stats( int damon_sysfs_schemes_update_regions_start( struct damon_sysfs_schemes *sysfs_schemes, - struct damon_ctx *ctx); + struct damon_ctx *ctx, bool total_bytes_only); int damon_sysfs_schemes_update_regions_stop(struct damon_ctx *ctx); diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 6d3462eb31f2..9a015079f3a4 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1635,6 +1635,7 @@ void damon_sysfs_schemes_update_stats( */ static struct damon_sysfs_schemes *damon_sysfs_schemes_for_damos_callback; static int damon_sysfs_schemes_region_idx; +static bool damos_regions_upd_total_bytes_only; /* * DAMON callback that called before damos apply. While this callback is @@ -1664,6 +1665,9 @@ static int damon_sysfs_before_damos_apply(struct damon_ctx *ctx, sysfs_regions = sysfs_schemes->schemes_arr[schemes_idx]->tried_regions; sysfs_regions->total_bytes += r->ar.end - r->ar.start; + if (damos_regions_upd_total_bytes_only) + return 0; + region = damon_sysfs_scheme_region_alloc(r); list_add_tail(®ion->list, &sysfs_regions->regions_list); sysfs_regions->nr_regions++; @@ -1702,10 +1706,11 @@ int damon_sysfs_schemes_clear_regions( /* Called from damon_sysfs_cmd_request_callback under damon_sysfs_lock */ int damon_sysfs_schemes_update_regions_start( struct damon_sysfs_schemes *sysfs_schemes, - struct damon_ctx *ctx) + struct damon_ctx *ctx, bool total_bytes_only) { damon_sysfs_schemes_clear_regions(sysfs_schemes, ctx); damon_sysfs_schemes_for_damos_callback = sysfs_schemes; + damos_regions_upd_total_bytes_only = total_bytes_only; ctx->callback.before_damos_apply = damon_sysfs_before_damos_apply; return 0; } diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 533d06052c09..808a8efe0523 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -999,6 +999,11 @@ enum damon_sysfs_cmd { * files. */ DAMON_SYSFS_CMD_UPDATE_SCHEMES_STATS, + /* + * @DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES: Update + * tried_regions/total_bytes sysfs files for each scheme. + */ + DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES, /* * @DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS: Update schemes tried * regions @@ -1021,6 +1026,7 @@ static const char * const damon_sysfs_cmd_strs[] = { "off", "commit", "update_schemes_stats", + "update_schemes_tried_bytes", "update_schemes_tried_regions", "clear_schemes_tried_regions", }; @@ -1206,12 +1212,14 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx) { struct damon_target *t, *next; struct damon_sysfs_kdamond *kdamond; + enum damon_sysfs_cmd cmd; /* damon_sysfs_schemes_update_regions_stop() might not yet called */ kdamond = damon_sysfs_cmd_request.kdamond; - if (kdamond && damon_sysfs_cmd_request.cmd == - DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS && - ctx == kdamond->damon_ctx) { + cmd = damon_sysfs_cmd_request.cmd; + if (kdamond && ctx == kdamond->damon_ctx && + (cmd == DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS || + cmd == DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES)) { damon_sysfs_schemes_update_regions_stop(ctx); mutex_unlock(&damon_sysfs_lock); } @@ -1248,14 +1256,15 @@ static int damon_sysfs_upd_schemes_stats(struct damon_sysfs_kdamond *kdamond) } static int damon_sysfs_upd_schemes_regions_start( - struct damon_sysfs_kdamond *kdamond) + struct damon_sysfs_kdamond *kdamond, bool total_bytes_only) { struct damon_ctx *ctx = kdamond->damon_ctx; if (!ctx) return -EINVAL; return damon_sysfs_schemes_update_regions_start( - kdamond->contexts->contexts_arr[0]->schemes, ctx); + kdamond->contexts->contexts_arr[0]->schemes, ctx, + total_bytes_only); } static int damon_sysfs_upd_schemes_regions_stop( @@ -1332,6 +1341,7 @@ static int damon_sysfs_cmd_request_callback(struct damon_ctx *c) { struct damon_sysfs_kdamond *kdamond; static bool damon_sysfs_schemes_regions_updating; + bool total_bytes_only = false; int err = 0; /* avoid deadlock due to concurrent state_store('off') */ @@ -1348,9 +1358,13 @@ static int damon_sysfs_cmd_request_callback(struct damon_ctx *c) case DAMON_SYSFS_CMD_COMMIT: err = damon_sysfs_commit_input(kdamond); break; + case DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES: + total_bytes_only = true; + fallthrough; case DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS: if (!damon_sysfs_schemes_regions_updating) { - err = damon_sysfs_upd_schemes_regions_start(kdamond); + err = damon_sysfs_upd_schemes_regions_start(kdamond, + total_bytes_only); if (!err) { damon_sysfs_schemes_regions_updating = true; goto keep_lock_out; From patchwork Fri Jul 28 20:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 127864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp691440vqg; Fri, 28 Jul 2023 14:05:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlEMKVFSNAMvD66HJzq+ZjmpykGfQGqsvTEaaK5vEO2HskJht7WAOfp7iATi/MCAEWdYMQKC X-Received: by 2002:a17:902:aa46:b0:1b8:9002:c9ee with SMTP id c6-20020a170902aa4600b001b89002c9eemr2366149plr.1.1690578342781; Fri, 28 Jul 2023 14:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690578342; cv=none; d=google.com; s=arc-20160816; b=qVWeNCwB4ROZfD4cQwXRni8Tl8ZVFuS1rPCidHl9SegmfFP34HQCEJPyOeGpXqcBX/ MnMSfuQdBTT2M2ot2TBsY87SMkIOyCwlg6tXRCn32yRQcm7gAnsOFKYHDVdZquJoodGY e5LmfJLs7qLqXRDVchwuRrpfAnyIFiu9quXfGd8P6xorzJPBI3FbfwTfklAH9p/lqM/T Bhcb4wnYJ7BuJd+zvTwbUaigHCNYSL+Kgc/iqSKkfunsp0/83Twn0wE1hj+ML3HasnkK nVEhfWSudG26whwpTdya85jHrrLyilflc7K/sw2YXSGbsjhI2q0dwrdrdTbwvf9YBGQp AsMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M6iKB/8DnuuuqI3l7pYmM8Gm6s8Ppxk8Sj40hVY7DBA=; fh=hJpvtmYKYE0BOPLgUEDgOmGgYMxmJ79pj0vtAYRNCO4=; b=LNnhZFecM4T8ghVzsBLjvwxkQ6Z0ggUXDxeHuEKulSyzgAV3wfnSRKevkcIiOfa7r7 dLxJnbudQqbX9468Rpdsbn6/NraPWOjufg/nw/4KulErjrirE9W3PNdePB0WBYEJJa8F Jm+zCNjVAOxS1SczwU1vlkmGl7QMqAsldJwFw4orVMLi+q3n4951FQM9x9dR6p82/k9X 2fBFqGUCOploG/13pxyuWMSmD7laTPTpl7jbG9IiUqEA/GpAKWvy2aiBq/W9m7CihAsa eCwVmov7lwLtR5E+y+hk92ILRJmjO2JOHUjpfb3Zfjr7fwh1F4fEqxmgPe8sXsTFSJnk vkWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RX260k1o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a170902c40300b001b9ed01eb1dsi3722839plk.361.2023.07.28.14.05.29; Fri, 28 Jul 2023 14:05:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RX260k1o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233072AbjG1USj (ORCPT + 99 others); Fri, 28 Jul 2023 16:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233461AbjG1US3 (ORCPT ); Fri, 28 Jul 2023 16:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 993C82D75; Fri, 28 Jul 2023 13:18:28 -0700 (PDT) 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 37AA8621F3; Fri, 28 Jul 2023 20:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26B70C433C8; Fri, 28 Jul 2023 20:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690575507; bh=T0fZGypLM6vPpWaOxwTR4DXjjDDCiOe0tcjb/Q7FYeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RX260k1ogVJVTYldpyL2MGeGBk3tczpbf55SpjRAVjT3q1MLI8Xd9HW7ZUgZsmtHH Cj0LUABIEdtOyJhlJgJA5+ddILF/b7B0oCVXSNLQfQOMSZv8Vl+GTamyICVRsZYGRx qNI7iYll5IOZ7YKkhn0Fjp4aa9TYYyUMcQtFPkI93XQ4g1zKrupkRLVpcsVtOj8Bpi 7RgCEgKylHCjNMsAzUG3/JKObwfK68tEDIhlTB9zKKvqQYw4733MSpaHK1VOChBCtL w3r+CWSFwF/pvgYfNgmZh8Gd6cK6AkaI+6/VilRbS8fXBk8oV/m0Wk2SwDhShqnRa5 tuBgaodKk3dtw== 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 3/5] selftests/damon/sysfs: test tried_regions/total_bytes file Date: Fri, 28 Jul 2023 20:18:15 +0000 Message-Id: <20230728201817.70602-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728201817.70602-1-sj@kernel.org> References: <20230728201817.70602-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772699876481678406 X-GMAIL-MSGID: 1772699876481678406 Update sysfs.sh DAMON selftest for checking existence of 'total_bytes' file under the 'tried_regions' directory of DAMON sysfs interface. 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 bcd4734ca094..967e27267549 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -84,6 +84,7 @@ test_tried_regions() { tried_regions_dir=$1 ensure_dir "$tried_regions_dir" "exist" + ensure_file "$tried_regions_dir/total_bytes" "exist" "400" } test_stats() From patchwork Fri Jul 28 20:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 127858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp681681vqg; Fri, 28 Jul 2023 13:42:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlEODv3eV5k8GXEHxiOj5jjswtEMoQiTR3ebjPAGRskDHnrqIYkK8WfQIcvXvwee+Ycfdcyz X-Received: by 2002:a17:902:778a:b0:1bb:a941:d940 with SMTP id o10-20020a170902778a00b001bba941d940mr2305610pll.15.1690576971471; Fri, 28 Jul 2023 13:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690576971; cv=none; d=google.com; s=arc-20160816; b=ouZdFNaG2vVTPh3+EK/ftn5csUuLins4ML37AmfICZDCV7fwnSMGiT+IIFGgTikQrD 3p3H6y/UCo5b0SVeh1kTICu7X5oWlGiOmSl3vj+61OtW6GgDHZ2pv6gdLSKr57+KgStA 29omMhjk65/cCPznfJFFdioOB4KwTWJPvdjWPiiZNQCWXLH3Ua/NTNGVyDd3lxegwjcO euVIJMnyEOImScq0Umt6MhkzTiM0CgysM+HKnI6LUekuMwo6C5/B83s5deKzV08iIejd Q8+XfwtSiZUPHE7EK/algZPGZduMpbVFhg8GzPG0TYDfyK2CI84kdNTKdw6WyGn1PD6D bTZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BQF35P7hXjl9TwWNqpj6Qfp3UJJFmpviFMibiLDIQgg=; fh=Jn9vwBBsv0/M243wtBPWgrycE99QwFHXCzusFnO8K0Y=; b=hQ3l240+KltcIEZ8+1ls9jMOyN/ssF9XgCbh0T1Z2kXip4ftxondZBShena4YMQghZ G3bCNT5jw4RE1+DACIxYHKkEfyhaPegYQG97HFw+7lXZCl9YNTZF98Sii3MQ697FnbsW bmSsHnSzhZFQZ439N43Q/yJKVp4jUxqTaXTX03vMYj7obq1tQWHP3Mc8w/BcJMJi5pg2 gZnEOgnEhoisplJ+WPqLPHMzqD99WH+EJvEnTEpX5x5BRRbuu0iJOebPoK96sG3/8vuq cTG5oAixoAYGPXqUm+HWcVYIQ2Cd6k/RkixRAKZ2Ry1t79X2gc55sAH4IfHAvl0wpFzu lrBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QyGP4+cb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a1709027e8600b001b9ca3550bbsi3519956pla.150.2023.07.28.13.42.38; Fri, 28 Jul 2023 13:42:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QyGP4+cb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234392AbjG1USm (ORCPT + 99 others); Fri, 28 Jul 2023 16:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbjG1USa (ORCPT ); Fri, 28 Jul 2023 16:18:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51B20423B; Fri, 28 Jul 2023 13:18:29 -0700 (PDT) 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 E462E621FB; Fri, 28 Jul 2023 20:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5926C433C7; Fri, 28 Jul 2023 20:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690575508; bh=hZi4JMj8VgF69C/0cI6pgbuOwe9TusEzinxMwIrTwRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QyGP4+cb8vPs1cOqldkfI60vHEt6GW58BND6QKRpWnpRyPcnJjNzbMiHvKbL9sr2f Gd89fZUVgnWzXVJE8Ov8HLUGJen9Lw5jd0RX+XIcilGNjDfRSNkWXm209E2KRuCtPa F8UY4Eqc6arjvEGTVzBSN1mw2IhBvPs0jAE5IqeK9kzyWeAGdTwB3M2ErhdHYFsl4G WV9PSZKsagHHQaKljpGc9LWz6H+qSthGrI3dMvNDLEQyaQblO9+IIv3nDwE6+65d83 cboN3H1SPsHUB2yduqbBqlYlsgiU5j7gNat2nzF1OVPsWcoAlJN+yhrt+M1hPRY6Y1 cPpjkWwWV1JSQ== 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 4/5] Docs/ABI/damon: update for tried_regions/total_bytes Date: Fri, 28 Jul 2023 20:18:16 +0000 Message-Id: <20230728201817.70602-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728201817.70602-1-sj@kernel.org> References: <20230728201817.70602-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772698438529645879 X-GMAIL-MSGID: 1772698438529645879 Update the DAMON ABI document for newly added schemes/.../tried_regions/total_bytes file and the update_schemes_tried_bytes command. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 2744f21b5a6b..3d9aaa1cafa9 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -29,8 +29,10 @@ Description: Writing 'on' or 'off' to this file makes the kdamond starts or file updates contents of schemes stats files of the kdamond. Writing 'update_schemes_tried_regions' to the file updates contents of 'tried_regions' directory of every scheme directory - of this kdamond. Writing 'clear_schemes_tried_regions' to the - file removes contents of the 'tried_regions' directory. + of this kdamond. Writing 'update_schemes_tried_bytes' to the + file updates only '.../tried_regions/total_bytes' files of this + kdamond. Writing 'clear_schemes_tried_regions' to the file + removes contents of the 'tried_regions' directory. What: /sys/kernel/mm/damon/admin/kdamonds//pid Date: Mar 2022 @@ -317,6 +319,13 @@ Contact: SeongJae Park Description: Reading this file returns the number of the exceed events of the scheme's quotas. +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//tried_regions/total_bytes +Date: Jul 2023 +Contact: SeongJae Park +Description: Reading this file returns the total amount of memory that + corresponding DAMON-based Operation Scheme's action has tried + to be applied. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//tried_regions//start Date: Oct 2022 Contact: SeongJae Park From patchwork Fri Jul 28 20:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 127871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp698141vqg; Fri, 28 Jul 2023 14:20:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlFh/P68vKfpYU29xxsC4TxzJgw6/4o7fsHo4dutygwDDC2k8IArUjILJFmGTLyelxczh0fI X-Received: by 2002:a2e:91c8:0:b0:2b6:e2c2:d234 with SMTP id u8-20020a2e91c8000000b002b6e2c2d234mr2865013ljg.33.1690579253071; Fri, 28 Jul 2023 14:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690579253; cv=none; d=google.com; s=arc-20160816; b=OjUt/UPx4dYGHLDfYAryrg3eI52OULjcqz1fiBN3HTmFSXFCElJTZDJ6ASLZ02YDpM 7OUM2y4ke2/dFg5ZXKaXunBpXrrVIC4LXGqeolMrO1a+FkM22v/kq5NH5W8hxxQeM0Wy N1XR7Blyhy2bCzMB2v8Fr0fCGMTSdskKASqC607OLofyFnj8zyJCiLn61pg6tNq18v1j jXcXWZ+Wk3jaZjhDnuM2aXt/WXMKANrdTEfTGkZxzK1D9QzqbMyFh7Q7KnSlKLKT37Ow niu1N4IRypArBS31Nsuwn1BQjeRxQ1jfPoZklhO14A/OjPghRPDCZ623II3247hP3tKq LSFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q09WJ0RoG3VU5Ry5RDVvaFMyJgqoOMJYC4LY2HR/5kM=; fh=Jn9vwBBsv0/M243wtBPWgrycE99QwFHXCzusFnO8K0Y=; b=z6EcKVWzH1sTfK7wjxnLjzt1fdPrmHaHjtD+XRP83pz4qJZtaqHwl0hV5mg21ov0pF I9kH/himNSNO4keomYTnAclBONr//yRNYPTku6reQxzEQpyiLXg3yVtPmiba5MO/qnCT oJ3oXwWm274CtB8LfY/LtlcffQi9EodRGiYLEBnydCCHLa4WnQkxPE9GG4/vZlRW8KxQ cQragf2x0VXWilvp5pgRLRXWCWiTZWkuOmkQYqBk7x388P40Utbuzyj3ETRK2yDk2Y72 dGzWvVFcOpXU+/PyfnWmzj02yHvNIZTenPJz/hEb/SLCKkBaZyh02qIZMXMX7f2PNVLJ U8mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WDJUz30Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ko12-20020a170907986c00b0099318060d50si3185448ejc.463.2023.07.28.14.20.29; Fri, 28 Jul 2023 14:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WDJUz30Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234552AbjG1USr (ORCPT + 99 others); Fri, 28 Jul 2023 16:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233735AbjG1USb (ORCPT ); Fri, 28 Jul 2023 16:18:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C07F24487; Fri, 28 Jul 2023 13:18:29 -0700 (PDT) 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 A263B621F3; Fri, 28 Jul 2023 20:18:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91E1BC433CA; Fri, 28 Jul 2023 20:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690575509; bh=yEbF4+MD2fwxwTT+Hga32t2Dr/eR/mptRKFvKfgNyUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDJUz30ZehPsXA+PQlXSm9ldhk+fPDLca0I+OUG/yn3vxepk0mbOOs2+GH/ZLVgH9 idSbNzHHPgRSd+wZmFUG5A4pMJ9xHp5IqXtfaMPxw7Nw9L1lNa1zDqNV+aKEWrzb8E SpKo4kEuErqGFwO7SQgmuh+u8bXDBqdIvDPCYxKX6SvpNHL6Tk3v1/R12mIXf3KnZU Q0lwrt0sVWMLxDpK7V0LGTQjb/CFLs3nG2e+LYXeiLf2AbeTn2AcPon1z/CCsEQubS pvh07PquPFmXHGk8+pCbivFx3M0GZqW177OkD5L/twoxcbMh2BbtU2zFuCZEGvX8KH 4jU15BTtd3P7A== 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 5/5] Docs/admin-guide/mm/damon/usage: update for tried_regions/total_bytes Date: Fri, 28 Jul 2023 20:18:17 +0000 Message-Id: <20230728201817.70602-6-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230728201817.70602-1-sj@kernel.org> References: <20230728201817.70602-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772700830932428124 X-GMAIL-MSGID: 1772700830932428124 Update the DAMON usage document for newly added schemes/.../tried_regions/total_bytes file and the update_schemes_tried_bytes command. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 42 +++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 2d495fa85a0e..1859dd6c3834 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -87,7 +87,7 @@ comma (","). :: │ │ │ │ │ │ │ filters/nr_filters │ │ │ │ │ │ │ │ 0/type,matching,memcg_id │ │ │ │ │ │ │ stats/nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds - │ │ │ │ │ │ │ tried_regions/ + │ │ │ │ │ │ │ tried_regions/total_bytes │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... @@ -127,14 +127,18 @@ in the state. Writing ``commit`` to the ``state`` file makes kdamond reads the user inputs in the sysfs files except ``state`` file again. Writing ``update_schemes_stats`` to ``state`` file updates the contents of stats files for each DAMON-based operation scheme of the kdamond. For details of the -stats, please refer to :ref:`stats section `. Writing -``update_schemes_tried_regions`` to ``state`` file updates the DAMON-based -operation scheme action tried regions directory for each DAMON-based operation -scheme of the kdamond. Writing ``clear_schemes_tried_regions`` to ``state`` -file clears the DAMON-based operating scheme action tried regions directory for -each DAMON-based operation scheme of the kdamond. For details of the -DAMON-based operation scheme action tried regions directory, please refer to -:ref:`tried_regions section `. +stats, please refer to :ref:`stats section `. + +Writing ``update_schemes_tried_regions`` to ``state`` file updates the +DAMON-based operation scheme action tried regions directory for each +DAMON-based operation scheme of the kdamond. Writing +``update_schemes_tried_bytes`` to ``state`` file updates only +``.../tried_regions/total_bytes`` files. Writing +``clear_schemes_tried_regions`` to ``state`` file clears the DAMON-based +operating scheme action tried regions directory for each DAMON-based operation +scheme of the kdamond. For details of the DAMON-based operation scheme action +tried regions directory, please refer to :ref:`tried_regions section +`. If the state is ``on``, reading ``pid`` shows the pid of the kdamond thread. @@ -406,13 +410,21 @@ stats by writing a special keyword, ``update_schemes_stats`` to the relevant schemes//tried_regions/ -------------------------- +This directory initially has one file, ``total_bytes``. + When a special keyword, ``update_schemes_tried_regions``, is written to the -relevant ``kdamonds//state`` file, DAMON creates directories named integer -starting from ``0`` under this directory. Each directory contains files -exposing detailed information about each of the memory region that the -corresponding scheme's ``action`` has tried to be applied under this directory, -during next :ref:`aggregation interval `. The -information includes address range, ``nr_accesses``, and ``age`` of the region. +relevant ``kdamonds//state`` file, DAMON updates the ``total_bytes`` file so +that reading it returns the total size of the scheme tried regions, and creates +directories named integer starting from ``0`` under this directory. Each +directory contains files exposing detailed information about each of the memory +region that the corresponding scheme's ``action`` has tried to be applied under +this directory, during next :ref:`aggregation interval +`. The information includes address range, +``nr_accesses``, and ``age`` of the region. + +Writing ``update_schemes_tried_bytes`` to the relevant ``kdamonds//state`` +file will only update the ``total_bytes`` file, and will not create the +subdirectories. The directories will be removed when another special keyword, ``clear_schemes_tried_regions``, is written to the relevant