From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796312468; b=3Ps1M/lzY0R4n79O+y1d+xtz2jcJlrmmM/8JYosDXF6r2ZFGHlabycLbGlJCUTOXSRK6 OHR8MiHqv62GQG4Jbcvbs9fj3d22GxCQHPzApq28+8j0xRsMLEeLA0z19NPV9x/sArjft hL1Qmf6pCYSKVvNEfHSQOEhv2tpWxQHkr2di61Qor5hcwfhaBSic/9ZDo1wJ7ar20a0bq hgqtR9qKhHw0TTYD9SGpmHLXlB7sMdd7BdiJPODoNotAT1Qq7hB1XJ8t0s+DLgxJ4sq/7 vUU+1C7Fc9MI9E7opcW0ISronU/q3qCbOMhH3/DrH2fxpdgfPwQzYhuw2ldpuHI0EKw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796312468; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=nsTmuKBiywIL9BEa5PlWcphDgTvx17ZkA6BfmuP1l/M=; b=S8d1gJHPGcXCS3fSni55cPM4VlSlazMqIMB7ZeibN2+xQ2Fu5xW9sIrNn2bgZ5uvj/5J Q+ym0e2NuiOHe07L+siQrBz/d/GQVPv9Kyjdffr8f40WPsTw+a1fWodXLMqtqXz4DTHTl xjBhNfu0flzNtChQ1U3MKM8c0EwD9gRvyr1gLINwF+s8i7lvSriw4xilcl7RhUQLIajGX NTjeZuMiB9fa6RTQzyx4DcF6tae2bUx1e4uID+XcaU3oUGB5GxOlPsGwcQ8zzkbRNYvHE 3/npzeYOJ+qfaG6UcXsGQBX6+UPgOnTsQqi6FskHEKdmBuxhIkOd2KVSamAciCS965Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=coSbkR2Y; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E2CB606A322 for ; Thu, 3 Dec 2026 15:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=coSbkR2Y Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA1861F000C1; Thu, 3 Dec 2026 15:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796312468; bh=nsTmuKBiywIL9BEa5PlWcphDgTvx17ZkA6BfmuP1l/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=coSbkR2YcAAM6L2RBAlefqwWrHnCpivQyc0lq2yNlWxD4g2NB6ZKds6X8Yg9gIvc1 9db5H7oYLmqEJFNbVwEhy49qaK0PAYdMejNNMTSkZihkvbJpadLvDnHPtES7Wj7fzX 8zizMUlnQtZIDkPWxPayNdSvYTqEpwp3DeVfVFcGlF9xyJ0XDkmhHUVl2YgOYWzwyz D3nFKmrFZJVsZl3r/H5fnGZ6LoXPSQ/zZ55ur6LhRT+pNtSLmaNk0Zv7D6uyU23ifW x0t4Ux9dpNVW9n0PEuEFHnGsdJbLxbXw9WuZO9R7u/AwyN0a093a7O63VP27hH0saf fVIExiUj37WPg== From: SJ Park To: sashiko-bot@kernel.org Cc: SJ Park , "Andrew Morton" , damon@lists.linux.dev, linux-mm@kvack.org Subject: Re: [PATCH v2 2/3] mm/damon/core: apply damos core filter in __damos_valid_target() Date: Thu, 3 Dec 2026 07:40:44 -0800 Message-ID: <20261203154045.733625-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: X-Mailing-List: damon@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Thu, 03 Dec 2026 15:26:47 +0000 sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 3 potential > issues to consider: > - [Medium] mm/damon: core filter runs before access pattern in > __damos_valid_target() > - [Low] mm/damon: commit message misstates parameter added to > __damos_valid_target() > - [Low] mm/damon: redundant damon_sz_region() assignment in > damos_apply_scheme() > -- > > commit 65ff401f1d42c531dc70b0b39a702a59a8905c6f > Author: SJ Park > > mm/damon/core: apply damos core filter in __damos_valid_target() > > This commit moves DAMOS core filter evaluation into __damos_valid_target() > and splits out damos_access_pattern_eligible() for callers that only check > the access pattern. > > > Treat DAMOS core filter as the primary method. Handle core filters and > > damos_access_pattern together in the central region selection function, > > __damos_valid_target(). Update __damos_valid_target() to receive > > damon_ctx, to allow it access to core filters. > > [Severity: Low] > __damos_valid_target() already received struct damon_ctx *c; this commit > adds struct damon_target *t so it can be passed to damos_core_filter_out(). Good check. I will fix the commit message. > > > diff --git a/mm/damon/core.c b/mm/damon/core.c > > index 2766ebec01501..b0e9325e032b6 100644 > > --- a/mm/damon/core.c > > +++ b/mm/damon/core.c > > [ ... ] > > > @@ -2550,6 +2554,15 @@ static bool __damos_valid_target(struct damon_region *r, struct damos *s, > > r->age <= s->pattern.max_age_region; > > } > > > > +static bool __damos_valid_target(struct damon_region *r, struct damos *s, > > + struct damon_ctx *c, struct damon_target *t) > > +{ > > + if (damos_core_filter_out(c, t, r, s)) > > + return false; > > + > > + return damos_access_pattern_eligible(r, s, c); > > +} > > [Severity: Medium] > Can running damos_core_filter_out() before damos_access_pattern_eligible() > cause DAMOS_FILTER_TYPE_ADDR splits to break region size checks? > > For a partially overlapping DAMOS_FILTER_TYPE_ADDR filter, > damos_filter_match() calls damon_split_region_at() and shrinks r in place. > damos_access_pattern_eligible() then checks min_sz_region and max_sz_region > against the post-split slice instead of the original region. > > A region larger than max_sz_region can then be split into a smaller slice > and erroneously receive the scheme action, while an eligible region with a > narrower filter overlap is falsely rejected under min_sz_region. Regions > failing nr_accesses or age are also split before later schemes evaluate them. > > Checking damos_access_pattern_eligible() before damos_core_filter_out() > would preserve the previous semantics. Good point. I will update this code to check damos_access_pattern before core filters. > > [ ... ] > > > @@ -2896,8 +2909,6 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, > > } > > > > if (c->ops.apply_scheme) { > > - if (damos_core_filter_out(c, t, r, s)) > > - return; > > sz = damon_sz_region(r); > > if (damos_quota_is_set(quota) && > > quota->charged_sz + sz > quota->esz) { > > [Severity: Low] > Is this sz = damon_sz_region(r) assignment now redundant? sz is already > initialized to damon_sz_region(r) at the start of damos_apply_scheme(), and > nothing modifies r in between now that damos_core_filter_out() has been > removed here. Correct. I will remove the redundant assignment. > > -- > Sashiko AI review ยท https://sashiko.dev/#/patchset/20261203150821.730276-1-sj@kernel.org?part=2 > Thanks, SJ