From patchwork Tue Jan 7 20:17:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929579 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 E0F5BE77197 for ; Tue, 7 Jan 2025 20:18:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C12746B0098; Tue, 7 Jan 2025 15:18:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BEA946B0099; Tue, 7 Jan 2025 15:18:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3F456B009A; Tue, 7 Jan 2025 15:18:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8558C6B0098 for ; Tue, 7 Jan 2025 15:18:14 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 46A24C07E0 for ; Tue, 7 Jan 2025 20:18:14 +0000 (UTC) X-FDA: 82981767708.11.1E32BBE Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf04.hostedemail.com (Postfix) with ESMTP id B364A4000F for ; Tue, 7 Jan 2025 20:18:12 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="CWU0WB/N"; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736281092; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1Fwnw79mNVeBWYG6qVyV5DZOxHBxcloq+LteWVFVpYY=; b=ayoGD6s/WTPznRBZxr108Dl7pjYiCNDLc4vqMnNUHAzp5It6rWOnmu0FErO1zFVNMrUq/r e75a2I+A4fwYz2KJM2AII7lzLvwFY5AW8faP8RM5Tn+vK+AE9HlV8WMipefRmD+Ckjbruy qjfbQOpnu3GNizRPkqypmu1uZrfPeTM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="CWU0WB/N"; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281092; a=rsa-sha256; cv=none; b=NiyFi5i0i5qvMx4TYHcGawm4F7LgEwSvQTZBnWAqpTRrJkB3Eh6YUpsyE6hEwW01FmxA/u E9nPbJydYBHF9JEFgvKL5wGqvh4dUzE+La3OFLHMdaxjb/mr+3Hh6+BgVG0VBhKBxnpg69 /0Pz35y7xLX/17dGrFzha3ucvxnyfak= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 64D0FA41CEC; Tue, 7 Jan 2025 20:16:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6731EC4CEE4; Tue, 7 Jan 2025 20:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281091; bh=8dJ+7o3sCM8L0VHB+MIi4xnhlr9EGI5a92hneWpjd7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWU0WB/NlOmPRlgpVp5m6RizW/pJ7oVD8+xl/FMKgbU+0l849UfMQ+bx5pW52r/0c BhraHHr+hJTeDKyZWncd/S20vMMjbhTnHWP80XDrChQe5eXeoDOqFUHwSXm4oYxeW9 OIei9pW07xsVcqt8umUfH4Aq2WKPjmPC8JR3CjgGOSgM0M5+LbKE1Zvlz418cHYKy9 O+dLe6tmh+Gf+eEUjfh7ilHJL8FKyHiTpBstSaqYLvEphpK2h5W3+UCowXPsKMPrB+ IApVUYru99Kv9kHVsac+1s1qT3KXq6ayNiit4h1VoypnP+BdLicKGj95Vu012enfPx 3KtCbp1sNaPHQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/10] mm/damon/core: support damos_filter->pass Date: Tue, 7 Jan 2025 12:17:32 -0800 Message-Id: <20250107201739.79484-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B364A4000F X-Stat-Signature: 7cc96bqmgbxyr45nuqkjbkb1zcgkz36e X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736281092-741961 X-HE-Meta: U2FsdGVkX18WN4tl36YTq0fdC3Ryejelqj2Ij1bBDdyvtctW5rtPu+dIS/6BdJ7+BNJBCSmi7AzOGsW5SzvdbuxmGJtMmOrER77M2UkqQK6fO1zdoebDWBtKbG+5RcJBvGaSe2cb4pJIUsS+GwW9X+XEZLy1eUWBWeK58dtk+YRtGgT3IEcKew0NCdwSAaFFHbtZH9Jh+6nAaapiTZY+yV2I5kHjnkZERYC6ZyA+ZFcXCMucoIEU0c0Ld8hukx1ltHpkY4XQRzyEyX1t0wweeJj8O/EleeFWV8NbbtJ3YD0bXGxo05Q8PsEzSg1PfS5AJ21MVlRPpoHIN8nknS1swgLrAtWJrriQ2CIdn56KwQ06K/YRGYkXZrXnKlzhVDtfKsQchLN1omN/2QLSXxVyDeas2nBQBmJ5RgbsvRYjd8PAZKQS7SCMCcXNgQQRNeNL+h2daLv+IW94Vqxz8t0mQEKRSy9GktSQMYd/p2ktrrpBZ+DBJUKdmrkGkFmLqv50Zjr1rJDKva05hjj+IF/8batiTX80czNpGIrCos78OBhIjckNHcj7NzfHKOsHtkVQP35V802PcF8An7h/8VK6WczCVgKJ0iTFAaQIeI2ijl5iOPE55TUQxkKq2puOMGHnXY8HklpcB+Kw7IJuV8nZXOwQl1YmnxJ/By54+rbiBZE9b896nvdlA61t6lltS2RDQRD4/D0gd1w9k6HCcU8uhb28uCyzDWMTYJ7pp3YgpK/DSQu3uqp7agdbel/mP0lRjRe3sIGtmCTSJz36m0JghHrv1Vl+424ygjqNMiSlbo8YKnZ30vQQIQsZtKAPcBhVSeDoOwjYwEZ5ax1ngn6SB9/dR1mIKCQVqQKMLIv3AXGDzZ5iB0TG86Kzy8q6MiCvCh/sCGYQnxN6YdX5mzDT1ffabFAEiJrM+LQU6MB4KIx5gc/7qR2MdExzXYOBjANcm6qsyNjl5OM+Kuqjq+/ n2nY3oSF 6gPmkxeOCwZStdRFDxWWgiXjb82Q+KIS3fMCovk3AlPYTYbNOhKrforpHFA6WXzJgF+50IT0XndMIOspvly51qnhbcEExb8TvMNGo0CUVDx/QOaEKCBYFVeiIMO9xYObHVCUH7ZdgFr3v7jjbjXgaTBtEBFXthKmRaOovbUy1/QqPRneJsHqfu8cEELPvaq/MIkRHnt7NG5MUVWuoCPnq1RqtFsisKPzJ2aiQX0wLZK6aHLCS2NOj8JQ0SdVoND3zgWLCuUKZHl7Gf+jV/bYs0NqpUg== 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: List-Subscribe: List-Unsubscribe: Respect damos_filter->pass from core layer's DAMOS filed handling logic, by making the decision to pass a region in the middle of the filters evaluation depending on the damos_filter->pass field. Signed-off-by: SeongJae Park --- mm/damon/core.c | 6 +++--- mm/damon/tests/core-kunit.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index e54bd19d6f06..71db2c754e6d 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1374,7 +1374,7 @@ static void damos_update_stat(struct damos *s, s->stat.sz_ops_filter_passed += sz_ops_filter_passed; } -static bool __damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, +static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, struct damos_filter *filter) { bool matched = false; @@ -1428,8 +1428,8 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, struct damos_filter *filter; damos_for_each_filter(filter, s) { - if (__damos_filter_out(ctx, t, r, filter)) - return true; + if (damos_filter_match(ctx, t, r, filter)) + return !filter->pass; } return false; } diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index cf22e09a3507..8f58d3424c21 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -434,25 +434,25 @@ static void damos_test_filter_out(struct kunit *test) damon_add_region(r, t); /* region in the range */ - KUNIT_EXPECT_TRUE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_TRUE(test, damos_filter_match(NULL, t, r, f)); KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1); /* region before the range */ r->ar.start = DAMON_MIN_REGION * 1; r->ar.end = DAMON_MIN_REGION * 2; - KUNIT_EXPECT_FALSE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_FALSE(test, damos_filter_match(NULL, t, r, f)); KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1); /* region after the range */ r->ar.start = DAMON_MIN_REGION * 6; r->ar.end = DAMON_MIN_REGION * 8; - KUNIT_EXPECT_FALSE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_FALSE(test, damos_filter_match(NULL, t, r, f)); KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1); /* region started before the range */ r->ar.start = DAMON_MIN_REGION * 1; r->ar.end = DAMON_MIN_REGION * 4; - KUNIT_EXPECT_FALSE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_FALSE(test, damos_filter_match(NULL, t, r, f)); /* filter should have split the region */ KUNIT_EXPECT_EQ(test, r->ar.start, DAMON_MIN_REGION * 1); KUNIT_EXPECT_EQ(test, r->ar.end, DAMON_MIN_REGION * 2); @@ -465,7 +465,7 @@ static void damos_test_filter_out(struct kunit *test) /* region started in the range */ r->ar.start = DAMON_MIN_REGION * 2; r->ar.end = DAMON_MIN_REGION * 8; - KUNIT_EXPECT_TRUE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_TRUE(test, damos_filter_match(NULL, t, r, f)); /* filter should have split the region */ KUNIT_EXPECT_EQ(test, r->ar.start, DAMON_MIN_REGION * 2); KUNIT_EXPECT_EQ(test, r->ar.end, DAMON_MIN_REGION * 6);