From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3D32391513 for ; Tue, 28 Jul 2026 04:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785212698; cv=none; b=UmXybCOuI3UeGOlr9U3RHc6p150NR7uXsr4CC23rBx4Ok8Cc3K0JoBvkZ/cWlbWmndKGW+IAQFZwJJzO/XHGwzQ+6eaxfFqYmSLBls0+Bx/bqRgqsf2kmm1iXMSAY1xQ4FCWuq1OnqcuBIddWVny5nXdZNPOrQQjf1BrL6erE6I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785212698; c=relaxed/simple; bh=d46YQ03EJpoo9aBUH1Y0vuiKUm74SxELgBFiN6cjVnE=; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date: Message-Id; b=YHGcaCC0r5YTRcXGnZEnOMLY7VjIGyOlQFjgdFLdsHqIr8MyQK0SpzLEop9IicmAt91ODJMkCFljyQKUi5Fj4BVXqXeFYc4K+2fBPTf/OTkj59u92m9vL1f7BZJKdzyykPOEgK0otkEWt3NJNAvr6jbsonWQszSi763tYrXUbE8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=asfTo9cS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="asfTo9cS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48D531F000E9; Tue, 28 Jul 2026 04:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785212697; bh=jj1MMS0gsFx3yGhg9PytxKPAT0qv1wv2OrjodmaiHAM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=asfTo9cSCg5KLLesVUIEsTdNbLmEATfLQwCyEIF67RYebYHe+1EokFz2N/tAGSrhn zjkWO+5EKR5R/LJu1gEim+WnRVW0UJX4hqT62Zv7i2l3gLJsmwCmQdvDDNgPd8stTY rRpquCdIu/GyE2oYcyp8nlx60c+UlJSgHt+MHQR1HpjnZQ5ih/YMTWzLzlVF3ZvEGD MW2yZ5ugCU+/E3CaZp2IBmYerUTyIKelzsKCchYEis/qs1CQ6WI8uBV4UCHiaHs58T iQpY9k/ZL7/k/tu85u7X+fyQAx5MvBo2MNPHa46KksrScbHKRkshBQwIEwB3zX+oTc rQkP6GkxPIJAQ== From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v2.2 08/17] mm/damon/paddr: support damon_prep Reply-To: sashiko-reviews@lists.linux.dev To: "SJ Park" Cc: damon@lists.linux.dev In-Reply-To: <20260728041242.187380-9-sj@kernel.org> References: <20260728041242.187380-1-sj@kernel.org> <20260728041242.187380-9-sj@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 28 Jul 2026 04:24:56 +0000 Message-Id: <20260728042457.48D531F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: damon@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] damon_pa_prep_probes() executes prep actions redundantly and ignor= es probe filters, causing excessive rmap walks and global LRU degradation. -- --- Patch [8]: [RFC PATCH v2.2 08/17] mm/damon/paddr: support damon_prep --- commit 5d5b08fab7578294743c8bbbba6c3bfa16036115 Author: SJ Park mm/damon/paddr: support damon_prep This commit implements the damon_operations->prep_probes() callback to support the DAMON_PREP_SET_PGIDLE action. It unsets page table accessed bits and sets the PG_Idle flag, similar to what is done for access check preparation. > diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c > index 199de1463fa06..8d8fcd1369e56 100644 > --- a/mm/damon/paddr.c > +++ b/mm/damon/paddr.c [ ... ] > @@ -105,6 +105,40 @@ static unsigned int damon_pa_check_accesses(struct d= amon_ctx *ctx) > return max_nr_accesses; > } > =20 > +static void damon_pa_prep_probes_region(struct damon_region *r, > + struct damon_probe *probe, struct damon_ctx *ctx) > +{ > + struct damon_prep *p; > + > + damon_for_each_prep(p, probe) { > + switch (p->action) { > + case DAMON_PREP_SET_PGIDLE: > + damon_pa_mkold(damon_pa_phys_addr(r->sampling_addr, > + ctx->addr_unit)); > + break; > + default: > + break; > + } > + } > +} > + > +static void damon_pa_prep_probes(struct damon_ctx *ctx, bool set_samples) > +{ > + struct damon_target *t; > + struct damon_region *r; > + struct damon_probe *p; > + > + damon_for_each_target(t, ctx) { > + damon_for_each_region(r, t) { > + if (set_samples) > + r->sampling_addr =3D damon_rand(ctx, r->ar.start, > + r->ar.end); > + damon_for_each_probe(p, ctx) > + damon_pa_prep_probes_region(r, p, ctx); [Severity: High] Does this code redundantly execute damon_pa_mkold() and ignore probe filter= s? In kdamond_fn(), if standard access checks are enabled, both prepare_access_checks() and prep_probes() can execute on the same tick: if (!access_check_disabled && ctx->ops.prepare_access_checks) ctx->ops.prepare_access_checks(ctx); if (do_prep) ctx->ops.prep_probes(ctx, access_check_disabled); Because prepare_access_checks() also calls damon_pa_mkold(), the subsequent iteration over all probes here unconditionally calls it again on the exact = same sampling address for every probe configured with DAMON_PREP_SET_PGIDLE. Sin= ce damon_pa_mkold() performs a costly rmap_walk, this multiplies the overhead. Additionally, this loop does not evaluate probe filters (such as MEMCG or ANON) before applying prep actions. Could this blindly clear the accessed b= it for all sampled pages globally, artificially aging pages that the user explicitly excluded and degrading system-wide memory reclaim decisions? > + } > + } > +} > + --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260728041242.1873= 80-1-sj@kernel.org?part=3D8