From patchwork Wed Dec 29 13:10:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12700881 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 B4608C433FE for ; Wed, 29 Dec 2021 13:10:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A67436B0078; Wed, 29 Dec 2021 08:10:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 950C56B007B; Wed, 29 Dec 2021 08:10:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8186D6B007D; Wed, 29 Dec 2021 08:10:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 6AD7B6B0078 for ; Wed, 29 Dec 2021 08:10:36 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2A757181AC9C6 for ; Wed, 29 Dec 2021 13:10:36 +0000 (UTC) X-FDA: 78970866072.02.57D7B33 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id 60CB8180006 for ; Wed, 29 Dec 2021 13:10:28 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2B47B818D0; Wed, 29 Dec 2021 13:10:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36D96C36AEC; Wed, 29 Dec 2021 13:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640783431; bh=kpBr7XACXxAFZN5kDwVDdUSWedkX+AtEw87rcFRtVeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tj7VsdtUIaRI0eXkrtNV5KFNQ7u0xol3+a8R1Ye3HbVHY2b07SCnHHQLotoY9ys93 9o3ovQr5KiP4Ckzo+Fe3Jin3EPc3qmGb8rg2FmyaU5sK8dqf6IbTeFB0MrVKnArAMz NOP6RjuLpyp1La+aaLkhDYoygde708hsCMMx1f9Bw+8sMMPd1DKoRo9FEq6dGSxhWQ WxEaCcV3LbrCYTmbcoGU7DIOIpjUuIgIM9xngCC1UXCq6HKM6Q1zWOKYVS7JeUIjID rgfysXxhRgzfYHTaJOiFPmOX/FyMHRD8nyks8+UCKeTwaPC4IiuCWjXJUTloG4ltxm YuXqBFAS/5QXA== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 1/4] mm/damon/dbgfs: Remove a unnecessary variable Date: Wed, 29 Dec 2021 13:10:13 +0000 Message-Id: <20211229131016.23641-2-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211229131016.23641-1-sj@kernel.org> References: <20211229131016.23641-1-sj@kernel.org> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 60CB8180006 X-Stat-Signature: 85sb9jwsaxiusstgeo7u3hxmkgsrn7ah Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Tj7VsdtU; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org X-HE-Tag: 1640783428-316721 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: This commit removes a unnecessarily used variable in dbgfs_target_ids_write(). Fixes: 4bc05954d007 ("mm/damon: implement a debugfs-based user space interface") Signed-off-by: SeongJae Park --- mm/damon/dbgfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 751c7b835684..5b899601e56c 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -364,7 +364,7 @@ static ssize_t dbgfs_target_ids_write(struct file *file, struct damon_ctx *ctx = file->private_data; struct damon_target *t, *next_t; bool id_is_pid = true; - char *kbuf, *nrs; + char *kbuf; unsigned long *targets; ssize_t nr_targets; ssize_t ret; @@ -374,14 +374,13 @@ static ssize_t dbgfs_target_ids_write(struct file *file, if (IS_ERR(kbuf)) return PTR_ERR(kbuf); - nrs = kbuf; if (!strncmp(kbuf, "paddr\n", count)) { id_is_pid = false; /* target id is meaningless here, but we set it just for fun */ scnprintf(kbuf, count, "42 "); } - targets = str_to_target_ids(nrs, count, &nr_targets); + targets = str_to_target_ids(kbuf, count, &nr_targets); if (!targets) { ret = -ENOMEM; goto out; From patchwork Wed Dec 29 13:10:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12700878 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 24FE7C433F5 for ; Wed, 29 Dec 2021 13:10:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8276A6B0073; Wed, 29 Dec 2021 08:10:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B1686B0075; Wed, 29 Dec 2021 08:10:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 643CD6B0075; Wed, 29 Dec 2021 08:10:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 561E76B0073 for ; Wed, 29 Dec 2021 08:10:35 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1A3B1180EB719 for ; Wed, 29 Dec 2021 13:10:35 +0000 (UTC) X-FDA: 78970866030.31.5F1004F Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf14.hostedemail.com (Postfix) with ESMTP id 1C7E3100003 for ; Wed, 29 Dec 2021 13:10:32 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62863B81902; Wed, 29 Dec 2021 13:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA207C36AEF; Wed, 29 Dec 2021 13:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640783432; bh=J6ZMpaN2aHN46NtgTZHJCKdNW2n5fbVEwYw8XD91LhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qo+mEMLVm+mY10GwS6gaWaS4LWzHzZ5uYVH+x9k2MWivYxaDiOZS2m0iXl2j3LfSp Jq3SAt4k2l76kgapOiNPAgpsMTWqhhXgHqty7C/DMPq8l8xfk7jsPafg95sC5yl2sd eLlp2CsWIG1DKm+RPZkQ0A/Lc3QM8zqvGFv/1W3DVTBBqro5F4X8rOa8ibgw7azsVL jswaGK6sVWdlKQtFWxSGxHb14yc4KH/Tu2ulkRYJ0HEnwJNckuqVAgyexAMLtnNDVM nEpOzXzJKjkA14QuIx2qrJFQzBVDg+0SNV78wBRg2isf2xQiP/nt0Jzws5jkiyrd4M z3PZ96Qr5rGTA== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 2/4] mm/damon/vaddr: Use pr_debug() for damon_va_three_regions() failure logging Date: Wed, 29 Dec 2021 13:10:14 +0000 Message-Id: <20211229131016.23641-3-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211229131016.23641-1-sj@kernel.org> References: <20211229131016.23641-1-sj@kernel.org> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1C7E3100003 X-Stat-Signature: u1tughyrubfpk7ot5qtci98zo3ju8x3q Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Qo+mEMLV; spf=pass (imf14.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 X-HE-Tag: 1640783432-404218 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: Failure of 'damon_va_three_regions()' is logged using 'pr_err()'. But, the function can fail in legal situations. To avoid making users be surprised and to keep the kernel clean, this commit makes the log to be printed using 'pr_debug()'. Signed-off-by: SeongJae Park --- mm/damon/vaddr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 9e213a1d60c9..7997e1c000ed 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -238,7 +238,7 @@ static void __damon_va_init_regions(struct damon_ctx *ctx, int i; if (damon_va_three_regions(t, regions)) { - pr_err("Failed to get three regions of target %lu\n", t->id); + pr_debug("Failed to get three regions of target %lu\n", t->id); return; } From patchwork Wed Dec 29 13:10:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12700880 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 E8F6BC433EF for ; Wed, 29 Dec 2021 13:10:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 006886B0075; Wed, 29 Dec 2021 08:10:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EAD376B0078; Wed, 29 Dec 2021 08:10:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFCA46B007B; Wed, 29 Dec 2021 08:10:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id AC7306B0078 for ; Wed, 29 Dec 2021 08:10:35 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6FFEB82499B9 for ; Wed, 29 Dec 2021 13:10:35 +0000 (UTC) X-FDA: 78970866030.13.315E74A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 57E83C0005 for ; Wed, 29 Dec 2021 13:10:33 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4989E61416; Wed, 29 Dec 2021 13:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5916AC36AF0; Wed, 29 Dec 2021 13:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640783432; bh=Tqc33p9GRUSgtrjHIQAmSM+HAYm5FH9FB0Llx5PwAqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LPhi3v/kMUPXv96TQTW22OOl8z+JEHoDL1BPsEH8asi285cOnODkyp5IjDv8+9DPU Z2CB0VeK0gOamZH4joyCUv+w4HgJA/QhErfStJJ6rz3DQ4dF1DPEkAWcUU+meSEbnX iKEc0CYSIqe3NX6G0S8GxwF6BurG7ASPRlyekHHB8rXSrVzxO8vmykLeJWzNSUobTU lGHFBM3KMTj9wKKyZXPb4LJmeMh2lL9jnJPjl7QWbLrvcDcc5SIP5xzYrFzUnmdmzH KALCME/O8ZfLPh48LfI5bC/2+oAj5Y7uHSsBMMLzDfmpuxjO/e5QwBQPL0U9cZORfj VW9fkQv3VY+Ug== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 3/4] mm/damon/vaddr: Hide kernel pointer from damon_va_three_regions() failure log Date: Wed, 29 Dec 2021 13:10:15 +0000 Message-Id: <20211229131016.23641-4-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211229131016.23641-1-sj@kernel.org> References: <20211229131016.23641-1-sj@kernel.org> Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="LPhi3v/k"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 57E83C0005 X-Stat-Signature: oekjx3ttjzwyhnaqfyzxhmf9kedkor84 X-HE-Tag: 1640783433-267351 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: The failure log message for 'damon_va_three_regions()' prints the target id, which is a 'struct pid' pointer in the case. To avoid exposing the kernel pointer via the log, this commit makes the log to use the index of the target in the context's targets list instead. Signed-off-by: SeongJae Park --- mm/damon/vaddr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 7997e1c000ed..73ee9719f8ba 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -232,13 +232,19 @@ static int damon_va_three_regions(struct damon_target *t, static void __damon_va_init_regions(struct damon_ctx *ctx, struct damon_target *t) { + struct damon_target *ti; struct damon_region *r; struct damon_addr_range regions[3]; unsigned long sz = 0, nr_pieces; - int i; + int i, tidx = 0; if (damon_va_three_regions(t, regions)) { - pr_debug("Failed to get three regions of target %lu\n", t->id); + damon_for_each_target(ti, ctx) { + if (ti == t) + break; + tidx++; + } + pr_debug("Failed to get three regions of %dth target\n", tidx); return; } From patchwork Wed Dec 29 13:10:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12700879 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 5179EC4332F for ; Wed, 29 Dec 2021 13:10:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA4756B0074; Wed, 29 Dec 2021 08:10:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AFE616B007D; Wed, 29 Dec 2021 08:10:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 905B66B007B; Wed, 29 Dec 2021 08:10:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 768EE6B0074 for ; Wed, 29 Dec 2021 08:10:35 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2B3758249980 for ; Wed, 29 Dec 2021 13:10:35 +0000 (UTC) X-FDA: 78970866030.21.6BE3CA1 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf07.hostedemail.com (Postfix) with ESMTP id AB75040007 for ; Wed, 29 Dec 2021 13:10:34 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90198B81905; Wed, 29 Dec 2021 13:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC33AC36AE7; Wed, 29 Dec 2021 13:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640783433; bh=VQ2B0wuDXmafjk9e5koIOksR1NIA/USY11VBWynEVR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ISW9lcpSNaDv/3bwMyPO1VeTwaF+UMTxb6hwMRvRmELcy4CerL62kExmERH12vaP1 m1IxgP3ZCiLxmQ3DLNRhYe3Dtf4pQcZhS2boyvENsX2Xr+2dDaMiRbzwtaUZ38BhdM gBiJ/FjQ4/CoME6iX5CU7zVg2PeYNCig3CnNfJ7k1tFBMp7D9iMl+e5SA2fzeBJeOE MnW7XzTwQU2nTv40sAIQtSlmG9BzzS0y9jTF/WxkbdEKvMp9wjGD2i2yXqflZMt33H wMhHs77LYPeVx4ONh2pwINhUJ+34FPaSws6noxeeM6V4nYvw3WXDZFEzXCoNwxx4K0 fwThJsPGpMW2g== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 4/4] mm/damon: Hide kernel pointer from tracepoint event Date: Wed, 29 Dec 2021 13:10:16 +0000 Message-Id: <20211229131016.23641-5-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211229131016.23641-1-sj@kernel.org> References: <20211229131016.23641-1-sj@kernel.org> Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ISW9lcpS; spf=pass (imf07.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 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AB75040007 X-Stat-Signature: 61ym1p9cqxxhe6cw4rc5x7kexfm4yd9o X-HE-Tag: 1640783434-81346 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's virtual address spaces monitoring primitive uses 'struct pid *' of the target process as its monitoring target id. The kernel address is exposed as-is to the user space via the DAMON tracepoint, 'damon_aggregated'. Though primarily only privileged users are allowed to access that, it would be better to avoid unnecessarily exposing kernel pointers so. Because the trace result is only required to be able to distinguish each target, we aren't need to use the pointer as-is. This commit makes the tracepoint to use the index of the target in the context's targets list as its id in the tracepoint, to hide the kernel space address. Signed-off-by: SeongJae Park --- include/trace/events/damon.h | 8 ++++---- mm/damon/core.c | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h index 99ffa601e351..c79f1d4c39af 100644 --- a/include/trace/events/damon.h +++ b/include/trace/events/damon.h @@ -11,10 +11,10 @@ TRACE_EVENT(damon_aggregated, - TP_PROTO(struct damon_target *t, struct damon_region *r, - unsigned int nr_regions), + TP_PROTO(struct damon_target *t, unsigned int target_id, + struct damon_region *r, unsigned int nr_regions), - TP_ARGS(t, r, nr_regions), + TP_ARGS(t, target_id, r, nr_regions), TP_STRUCT__entry( __field(unsigned long, target_id) @@ -26,7 +26,7 @@ TRACE_EVENT(damon_aggregated, ), TP_fast_assign( - __entry->target_id = t->id; + __entry->target_id = target_id; __entry->nr_regions = nr_regions; __entry->start = r->ar.start; __entry->end = r->ar.end; diff --git a/mm/damon/core.c b/mm/damon/core.c index 6482d510dcbe..1dd153c31c9e 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -514,15 +514,17 @@ static bool kdamond_aggregate_interval_passed(struct damon_ctx *ctx) static void kdamond_reset_aggregated(struct damon_ctx *c) { struct damon_target *t; + unsigned int ti = 0; /* target's index */ damon_for_each_target(t, c) { struct damon_region *r; damon_for_each_region(r, t) { - trace_damon_aggregated(t, r, damon_nr_regions(t)); + trace_damon_aggregated(t, ti, r, damon_nr_regions(t)); r->last_nr_accesses = r->nr_accesses; r->nr_accesses = 0; } + ti++; } }