From patchwork Wed Aug 2 21:32:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 130157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp744125vqx; Wed, 2 Aug 2023 14:44:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHB6GsHX03y6HChIBcFfXyFwfbotrE9MCVnh8W/MiAtjseywWyjPBNS2FAn6krlhq+wR2Is X-Received: by 2002:adf:cd8a:0:b0:317:7238:336a with SMTP id q10-20020adfcd8a000000b003177238336amr10479478wrj.5.1691012678476; Wed, 02 Aug 2023 14:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691012678; cv=none; d=google.com; s=arc-20160816; b=f1iXA+PMKV3hPJZHlWCSGQx1nstPlurPXZ0FBS+01eGyFCZm9smDTys3VHAVt53MM4 tG3gLldaNyQDWwM/6psOKpuSuPv/H0PVKO7yo8aQJ4ayCFkAobnEDnEApg5r/WDVPDWJ ZJxUfmSW1910ipuxRCnTB/Gnw/JKyguJ97F/Ff42Fgb/3kxvt+zoY6XkNRC3fsQGcoIv lmVUsox+3rsSLhE5AfXRxXoimL/h//775JaGPOTUDjP3ox7Rr7sNasz6EFT3QM7zjOgb MB/+frw9ghsseBYSGnH/Db2n6tVooERcDqeWg5Jt8iyzPp9vxjaHnj5OzLuiJZALD6a/ yDqg== 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=5nQkTjpE5JkIK0Ug+slCBTeILDePWtarDq+twvurfAs=; fh=8oGWbdHExGIIBBigm5y9/rZRjvqmeY+HpW+qV30w+go=; b=CKVS2hYKvFqduYccid75Eo1YZBM5b9WWZS82hA0H3gUSakbXgdvQJTpCuVXotSGvWL /4u9d1J+6tdVh4CaZna4vMszOAGPsTlf6A76mHfjl/fR0d8FR/szbF+nCds7jBEhSklb jcEllxLzeR5WEZ5wVhkpkL6EFPEfUjHrh+MRdeEluR3ljxrE5ZoqfmZhlMlQ3c5NLbop jClfi8K7XDZeJjckDIIJEZa60p+oMbMU3RNRQy0sogSrece3kldyIkJi09Zk9TZ2Qqs8 jtKFCvQKPH1veMZfe06/fOY8TqSzM8qNkbdKmKez/BhgMen5ZtreD397MSl8iZYbspgI fMxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mhAFKMX9; 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 o12-20020a1709061b0c00b0099334262e18si11094012ejg.49.2023.08.02.14.44.14; Wed, 02 Aug 2023 14:44:38 -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=mhAFKMX9; 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 S232795AbjHBVcg (ORCPT + 99 others); Wed, 2 Aug 2023 17:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232717AbjHBVcb (ORCPT ); Wed, 2 Aug 2023 17:32:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 334C51FF3 for ; Wed, 2 Aug 2023 14:32: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 BC34E61AF0 for ; Wed, 2 Aug 2023 21:32:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE37FC433CA; Wed, 2 Aug 2023 21:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691011948; bh=f9khGIJiHzKXZGP9/5olstezaDHUu4yK0qoxQ3r57d0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhAFKMX9BWvgmnVvVuE+YKjYxd17hsK/C+pCyLC9qL+02hqk3arsp5C5P1SP7ibv0 nx029Y6xQ5WdsNc/dcokX9cPYD6v4jxXD+bLFUGTnqZU+CpAM2GL3dE0DLf/mKv2MK xyGswxMq/DERqXK7S1dRnRlV/4pRuC92wzf/UhpE21z8l69eE9aIiXl2zmZEy0MOIk uO/99Ugid4LYO9nqaSqVwud/N+jYnqajNXZnYo1XU1Tbzr1krF/BB2UH87kK4D/X/r piUAiCRGvLeCU/R+wJ6IRqufBUYXGSA2yxraYB3SelUuc8r1adX3xDSK5CBGHJtltp EpVf8hvegNgJA== 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/5] mm/damon/sysfs-schemes: implement DAMOS tried total bytes file Date: Wed, 2 Aug 2023 21:32:17 +0000 Message-Id: <20230802213222.109841-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230802213222.109841-1-sj@kernel.org> References: <20230802213222.109841-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1773155309438710871 X-GMAIL-MSGID: 1773155310029371488 The tried_regions directory can be used for retrieving the monitoring results snapshot for regions of specific access pattern, by setting the scheme's action as 'stat' and the access pattern as required. While the interface provides every detail of the monitoring results, some use cases including working set size monitoring requires only the total size of the regions. For such cases, users should read all the information and calculate the total size of the regions. However, it could incur high overhead if the number of regions is high. Add a file for retrieving only the information, namely 'total_bytes' file. It allows users to get the total size by reading only the file. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 50cf89dcd898..6d3462eb31f2 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -117,6 +117,7 @@ struct damon_sysfs_scheme_regions { struct kobject kobj; struct list_head regions_list; int nr_regions; + unsigned long total_bytes; }; static struct damon_sysfs_scheme_regions * @@ -128,9 +129,19 @@ damon_sysfs_scheme_regions_alloc(void) regions->kobj = (struct kobject){}; INIT_LIST_HEAD(®ions->regions_list); regions->nr_regions = 0; + regions->total_bytes = 0; return regions; } +static ssize_t total_bytes_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme_regions *regions = container_of(kobj, + struct damon_sysfs_scheme_regions, kobj); + + return sysfs_emit(buf, "%lu\n", regions->total_bytes); +} + static void damon_sysfs_scheme_regions_rm_dirs( struct damon_sysfs_scheme_regions *regions) { @@ -148,7 +159,11 @@ static void damon_sysfs_scheme_regions_release(struct kobject *kobj) kfree(container_of(kobj, struct damon_sysfs_scheme_regions, kobj)); } +static struct kobj_attribute damon_sysfs_scheme_regions_total_bytes_attr = + __ATTR_RO_MODE(total_bytes, 0400); + static struct attribute *damon_sysfs_scheme_regions_attrs[] = { + &damon_sysfs_scheme_regions_total_bytes_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_scheme_regions); @@ -1648,6 +1663,7 @@ static int damon_sysfs_before_damos_apply(struct damon_ctx *ctx, return 0; sysfs_regions = sysfs_schemes->schemes_arr[schemes_idx]->tried_regions; + sysfs_regions->total_bytes += r->ar.end - r->ar.start; region = damon_sysfs_scheme_region_alloc(r); list_add_tail(®ion->list, &sysfs_regions->regions_list); sysfs_regions->nr_regions++; @@ -1678,6 +1694,7 @@ int damon_sysfs_schemes_clear_regions( sysfs_scheme = sysfs_schemes->schemes_arr[schemes_idx++]; damon_sysfs_scheme_regions_rm_dirs( sysfs_scheme->tried_regions); + sysfs_scheme->tried_regions->total_bytes = 0; } return 0; } From patchwork Wed Aug 2 21:32:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 130158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp744161vqx; Wed, 2 Aug 2023 14:44:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9xf8dhCXKnvVNNFXq4H10RLXvFV4v6xzsfCrJ3/fUo3pgOR8Wgn8ONrvrZ0HhnXaYniA5 X-Received: by 2002:a2e:b54b:0:b0:2b9:3c1d:6ec0 with SMTP id a11-20020a2eb54b000000b002b93c1d6ec0mr7206547ljn.4.1691012681993; Wed, 02 Aug 2023 14:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691012681; cv=none; d=google.com; s=arc-20160816; b=CTlz16BCdf1hS4mus1LnFaJegSg1dAApVb6v9HqgT4BIAhNAsNwF+nl7fmEprFGvN+ td74y0dsb4nSTUpYGxFCo/DOL5XXsabq0NglkQhoRp+h/UDpZ2SIgHxvWUmeKoiEc4/b 2NeoTR1ZMTVds1EQfV8+WwHSZUYfo5Ry5zjBI27Eal15/0ZJXyxz0hkuJn7twNh3Mua/ oRj+9w23CowYL5Z0l0Uj8LoGBnGrHkhF8T5GYtTCFjmwcQhnmYACRuSCIcNMrHFodj1e xqWCowRIdetakDmZEndmbFgiXzoTd9Njhf0LwmUIdDCkpm9E91w4jK+gtleCg3cS7tKG lm0Q== 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=Y8y6ZFofqxuhQim+d53dFU3tWR7Oq+gWsiH2qLyaQSA=; fh=8oGWbdHExGIIBBigm5y9/rZRjvqmeY+HpW+qV30w+go=; b=UPerCQSzrnLC0haPQnXZA3zEe36id2ZfTJsi1hrij/vu5ntaPdSCyoQuYN/IpwG7Tl mDYf2frTK2HMJwxjX90zDm9Q0gxUmeImVzZnjI4WeNay+8FcIddfaA2Ak28CBu5lYuKm 02+mP5X3TJ8algdOc3I0jZnBP88ElEHK0PZvqoEcEY/JISGdN/j00KXClpDELcuj9b9O DuR7zJzWXMA/UNo9cA69YdJi6MTrZtjBdRaUPEBAM3zRUGrjRdm3zbaXyO44Wv50XPUH p9Z1FtAVc/EDP0NSqfUNo8+2kq2YxCK6YDU1AnGUBGVl5afGIeDfWFc1ubfLnx5O0PhF M69w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uGGKjcUz; 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 t25-20020a1709066bd900b0099263f8cdc4si10885273ejs.207.2023.08.02.14.44.18; Wed, 02 Aug 2023 14:44:41 -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=uGGKjcUz; 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 S232753AbjHBVck (ORCPT + 99 others); Wed, 2 Aug 2023 17:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229960AbjHBVcb (ORCPT ); Wed, 2 Aug 2023 17:32:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A9819A4 for ; Wed, 2 Aug 2023 14:32: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 6A59861B3B for ; Wed, 2 Aug 2023 21:32:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 611F0C433CC; Wed, 2 Aug 2023 21:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691011948; bh=ywwkrzBmUQl1yAbJ8J8SAzYo0s1zHyng9N/GQVlAxuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGGKjcUzdRVYJx6iCGw2mNOxfYk2F0Zbi0payg8qfCkVAxiswPvCfUtoycnPmji2R 9xCQe4RbaWucotEQRU7vUzK/8Ph+JErkYGKaYt4/JLfv4+IA2OlbtCl2dn7NZKcr/C Np+li/YqLNEoHSBJBkHtFRlpEl4aePIzjwkNcHooheN5Zmi6E0+4tbPwHPAkCZvvgA mQQEB8Bt71voaV2qubWVy3vy7fIq5Re5P7IwIMpjM8hE3yhRfSXYxrrjMD1wVm3PG8 OEBM/FFLVOr6nDOrAwuMTbMp7CSnSx1mPyl4UwLJYYIzPLyho1Xf0LGF9qMJB21chY DFaVUjkDo4NUA== 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/5] mm/damon/sysfs: implement a command for updating only schemes tried total bytes Date: Wed, 2 Aug 2023 21:32:18 +0000 Message-Id: <20230802213222.109841-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230802213222.109841-1-sj@kernel.org> References: <20230802213222.109841-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1773155314202291293 X-GMAIL-MSGID: 1773155314202291293 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 33e1d5c9cb54..b86ba7b0a921 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 Wed Aug 2 21:32:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 130159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp744184vqx; Wed, 2 Aug 2023 14:44:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlEbYmRbPSjI5zyLPQlA5mtPNnqmsqLbSs4KtchuRG9JltxuhOtS60x/47zN/iBrkXzIf9XP X-Received: by 2002:a17:906:24f:b0:993:eef2:5d53 with SMTP id 15-20020a170906024f00b00993eef25d53mr11949908ejl.0.1691012685829; Wed, 02 Aug 2023 14:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691012685; cv=none; d=google.com; s=arc-20160816; b=jx5mcDpMNbLG1ml4/xGv+6R1UtzmydWdHua9OjxFxb+cDxSbZoXpAR8qjGxb/Y0MWj fuKPJZ3jxXUm3/kAeqa4BpP9Vve/hHAT/wpqmX0WpT+hpurUzJRn9Ay2ggEQFcWdefqx 7NLa483VbCwCtXy5huPHxOUJSZ9OPDUAakjWKKNf8xBfuAqz/kZ5VGXJDpVLaHMUq5qt mIh00y/BG7A0iVjdl4QSpzmP9lbobLxzYW5QP6Nof3ZDrhlGe+hM2HtCXKtNp6B/ZTng Ul7TvBZtMXXkyUIBG3nHk3NMtCyJQnERYqTtCbV09ERUF+vmJhQOJwUQkKYisyV20LJc l9kw== 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=EEOC0+LlXGIvTbW82fJgfwZmcwCoN7OfNSQwVknoAPicJzWregWqhhBGwYTL7EEJjd KZgg0k7m3QCLKlgNhA3TVM8epRcXu7apfBINXP/ayUq1tcRkwCGmBCcsxY1JN8JOqgUU gErb/O0EKoLvFA/gA4jrxDFlXZmADIZMpb0jqs5b1nVw39xiB3fUr2T7CKwRQKg+z3Pf WoiuzNu14XNUavEIc14aDyAyjavmxZJptBy/5uXZwOFIWjR8qd9DBaLnWaf2TpNfhIKY ArNGlxdErBfQa1ZH7FwCb716rsaBHQGK6R1/eY0Nq/Oej32e0shULBsbgsweGspXifkp cvxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B8eKOqA0; 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 o21-20020a17090637d500b00977e729a2f7si11683431ejc.951.2023.08.02.14.44.21; Wed, 02 Aug 2023 14:44:45 -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=B8eKOqA0; 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 S232763AbjHBVcp (ORCPT + 99 others); Wed, 2 Aug 2023 17:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbjHBVcb (ORCPT ); Wed, 2 Aug 2023 17:32:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9782819AA; Wed, 2 Aug 2023 14:32:30 -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 354D961B54; Wed, 2 Aug 2023 21:32:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14C40C433CB; Wed, 2 Aug 2023 21:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691011949; bh=T0fZGypLM6vPpWaOxwTR4DXjjDDCiOe0tcjb/Q7FYeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B8eKOqA044Ky8Eh09y4gIXYN9t2lUUZCL9kmmIy/8/wVup+Fz9JompcEKnQSE4jKf rNdmcJT9xd0IfodlTlcndLvX2Na6sPx1JbT9RuOE/wx2KM4b7YbEGyLkffuSceZ+Bc /l2rcKJrVQGxQRjm7e7wQ/sOIx8A2X90cgjvwQ9FEMNRdzU9EZEC7larfDkW0RmVUa EFomDu/3WBUrWr6v4wEUKLbqIRHSxfQoDfMG2TqcAFphcofllNeSdaHPsefS/bArI+ SqYi4oXNcrkHbCEbhjQOaUDlg/0qyd4dBsqQHZEM9pIX8GCakb9VXQJvvEx/nNj81F BQ+3vr2RfZiuw== 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 3/5] selftests/damon/sysfs: test tried_regions/total_bytes file Date: Wed, 2 Aug 2023 21:32:19 +0000 Message-Id: <20230802213222.109841-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230802213222.109841-1-sj@kernel.org> References: <20230802213222.109841-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: 1773155317741665345 X-GMAIL-MSGID: 1773155317741665345 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 Wed Aug 2 21:32:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 130160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp744191vqx; Wed, 2 Aug 2023 14:44:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlHtAj4UkJ1XA1CTRNpLJs5hiP8l/cOVpn5zbmST1xmj5JXLymFMGqlWFJVq8dMQ3lHqkGGZ X-Received: by 2002:a05:6402:4315:b0:521:7a4b:9d1 with SMTP id m21-20020a056402431500b005217a4b09d1mr12255095edc.2.1691012687121; Wed, 02 Aug 2023 14:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691012687; cv=none; d=google.com; s=arc-20160816; b=ROLc06rSEz9pUhlfwNzGmOIOOXXxk1qgrLia4IUQ1elu/k4HAjx7QsQM0mLwgrIFUJ emY0UmwI/SRj4Ued1YPCa0Qhm72JE9+AGuqW6NODzDk0z8eIza8DrWTEpRzK5v5ouszg yzIIYs4BRI44VjOvtvOL0avqytlAA14LQcEZ8psunHX1+oyse9+UqfRvQQl+VFqcJnJe XeYo7KLqxKovIpr8T/sOuB1o3JXpeql9f5FSpE0Z6MBvuJ4FrHQG8Noigvi0yjEkiyU/ wEHX+kb6Xm6pMfZIPvq9/0p+SiexeYQ8SaOgc7KjyRj23qy83UJVf8Bic1bvp+VwsA4J vg7g== 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=Vq5B0l3NiQV/7vCtlHGfcNzX1p2gJ+luxGRzVv5ErV5M1wOFKRQezkRzX2cG+0MG9q RslA6YrHHFlxvGRjsymUPIdYTjah4ovIqbrfC7/FPVL8+gNx7PI1q6s3nhLZeAE6TIAm ekiEuaxlwZYcNKN+OkvYyHGBqsCWp74JR2t9KEIWf4nX2HDgQJt4ZDW6BOwI4Jnhzmcg wwUjkYF/+uEGD9lm38trBfCwOy0kHGZEXbv3swuS2DXk94xYEQV1NBvgayg3MhqetuDv Ihp+XfOaenmeEC4UxkwjoUtdLjxB23Bx6NR5b4kcP3qbnFkS08h4uteImddKiTdoiCx5 eUgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N8XK8bu8; 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 e14-20020a056402148e00b005219bc76c7esi1280766edv.113.2023.08.02.14.44.23; Wed, 02 Aug 2023 14:44:47 -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=N8XK8bu8; 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 S233056AbjHBVcs (ORCPT + 99 others); Wed, 2 Aug 2023 17:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232740AbjHBVcc (ORCPT ); Wed, 2 Aug 2023 17:32:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66AFC1BC7; Wed, 2 Aug 2023 14:32:31 -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 F060961B30; Wed, 2 Aug 2023 21:32:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D12A5C433C7; Wed, 2 Aug 2023 21:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691011950; bh=hZi4JMj8VgF69C/0cI6pgbuOwe9TusEzinxMwIrTwRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8XK8bu8QUF7j5mokMLp4WthiMSkYqCy1cY7HO0GbwC4arQZLodLipZSG5aSuS0s0 a3brhyuqU3Czlf8mRzp//Te0l/DLvozy4eCLuUXIeVuGhH9oAjBoGX4Kgw2glbMFfr r8ZRcAJavf+7zMP6kgLEFRY5NZlrtUIdQ966iL4IIWKYkl/wj4g46mtFXYANURfcCv 5ZKTfkfycATaFOVl56xgsVul41YgKaWOm/C1gG2UuYJBSUjCDXbBaSNr7qoX6bnPcX aoMTHxcWDg4YbhqjwA9oiUrVf6TTHyEEk+ESpebMbe+tARmMq//AJ+I2leTRzzfyls z6yzxG2O4nt8A== 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 4/5] Docs/ABI/damon: update for tried_regions/total_bytes Date: Wed, 2 Aug 2023 21:32:20 +0000 Message-Id: <20230802213222.109841-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230802213222.109841-1-sj@kernel.org> References: <20230802213222.109841-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: 1773155319295871395 X-GMAIL-MSGID: 1773155319295871395 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 Wed Aug 2 21:32:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 130161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp744199vqx; Wed, 2 Aug 2023 14:44:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlEKPyi2c7ZkpsVkB0lu8iXRFMZmFdmDnunb3ovS5k8YaYv3rKZobf6gwkLF4YYOJaqfLTUR X-Received: by 2002:a17:906:224b:b0:99c:22e9:fbe4 with SMTP id 11-20020a170906224b00b0099c22e9fbe4mr5866524ejr.1.1691012689607; Wed, 02 Aug 2023 14:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691012689; cv=none; d=google.com; s=arc-20160816; b=UQeID6dZ+FlcoTUllwVKVwGWIiecaDozF0cThuBE4fl5SLG03NCzlg3s4+qZ4hx3mv 2Iyo4ndZQOJY4hmNXWe5pFPFTL+RW/2S1YlkZY/pgGXArGmt4NiIN/dE+UTNVNOl4rtv Ts1wL4CSAk494fqZprAdlYGAXv7ITFVsTfUpKYX17WErihhxhfEA93tAgysbzDDP83Fq zF9tBEjdA+KKY7T8TZpYK9jGlninPShV+OID4YI5bYfuhY8w6XJS39qresMEd2ontgpZ 4zFA47blqvp6QUWGMOU1C+KXj23orq/ZakPoVHlD2O1NoV6xRXzqpLx4kU4TwWmNh7le /x0w== 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=se02Er0sjx5GchjgqJRX+9QD8vaoWagWkCgNyBbkqvbyqCoTqS62G+TgIbaMI7ml8Q OxfQNMlGFo3W5WErbHfV4Ck3UJrBC+5DRIXlFJUjX+nXIVvaoc1AE0tqojkRy7ddXOTv t/UDuUVY60oaCBrDCniVuRxsrDtMRigsMYOBuMPalyo6lKf4ggQ7yrSHJZsXfDYFQLqD X9rCEkqnCc+zb/jxWI6EePb0WXtDNiO9m/BY/vzv6oya5DcOxoL9nMjDOL3gQPueZDnm KbuMwLFStt8Bm7EdWlYbrDN3g9SDrm6z2vfB/4LL78PuHMFQyvACEwWuTRASv2YNGF6X o2LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZqyP22dR; 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 y12-20020a17090614cc00b0099b4222f51fsi995654ejc.266.2023.08.02.14.44.25; Wed, 02 Aug 2023 14:44:49 -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=ZqyP22dR; 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 S232994AbjHBVcx (ORCPT + 99 others); Wed, 2 Aug 2023 17:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbjHBVcd (ORCPT ); Wed, 2 Aug 2023 17:32:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B45D19A4; Wed, 2 Aug 2023 14:32:32 -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 B249F61B32; Wed, 2 Aug 2023 21:32:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9802AC433C9; Wed, 2 Aug 2023 21:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691011951; bh=yEbF4+MD2fwxwTT+Hga32t2Dr/eR/mptRKFvKfgNyUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqyP22dRe9txftfj0mTUSKJdBVIfJS1fQ0q1DN993ssD71Y/JqUWnM0H60utm4t2J uMCZdbNjNYBEz2HiAbC4KO9ZTcRMCAlxOo93soa5DH1MH2yNhVq6MNYcRbGNhY0ZOB oHCr8oMfDxScd3CpAtFHklMIqLUyywRvNsuJmsL1Z3afAKXlBqtzQuw9liSjCXiwsG ZnWPOJPpSLsqkpRJCTHsn7DIS0hIFSOz0BR+yYwpUTZ8B//Vm6Re/QFwCS9iW9aQKO rVZEF0cDLe1gJGf6HsNUEyr/1p45zPFuEOX8VrD/DD6sBCE7YZRLXHgcaXt/NP7SrL sQHPQ24C4gGgg== 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/5] Docs/admin-guide/mm/damon/usage: update for tried_regions/total_bytes Date: Wed, 2 Aug 2023 21:32:21 +0000 Message-Id: <20230802213222.109841-6-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230802213222.109841-1-sj@kernel.org> References: <20230802213222.109841-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: 1773155321865283770 X-GMAIL-MSGID: 1773155321865283770 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