From patchwork Tue Jun 18 18:18:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13702813 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 55A38C2BB85 for ; Tue, 18 Jun 2024 18:18:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F5318D0037; Tue, 18 Jun 2024 14:18:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A66F8D0036; Tue, 18 Jun 2024 14:18:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA7B98D0037; Tue, 18 Jun 2024 14:18:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B545D8D0001 for ; Tue, 18 Jun 2024 14:18:22 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 63D9380985 for ; Tue, 18 Jun 2024 18:18:22 +0000 (UTC) X-FDA: 82244819244.05.766F1F5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id C3B54140007 for ; Tue, 18 Jun 2024 18:18:20 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="gQ/CB4r0"; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718734694; 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=lZw5UshCrbLVu/J9nDf0egiPlz/h8iuY3CLlnC8azGw=; b=6bu62bct91fbis/PooaiT3p8uRN4Wm1VDHEsxhZlUvaK/2hV1aNVbivgqhy6LeoCnXb2SG QEN69AGDqMUHG/zRpmT4BdaZjmgWW9PlpaUfPh5mhbXb+DIwp9f9mG5igpvbxnHeAKiUfA bpU/cOymYWHjaCHJPEId3SPTJKVGJN4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718734694; a=rsa-sha256; cv=none; b=JN8FZ+SLhpycjwC6kX32MjYrkV8y9lwTqgpLYU493nEC1q2/fbn9gglraGVsBtcq7eVScR c8scV+003YN9rjWi3TGa9bK9Mhz2QlKRLAOYrOLEPt3Pc+4Stu2RpIVPfUsmW2HZAwZ7z8 lFqfSMpdz6uRUwyK/KMk0lwPtubJSS8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="gQ/CB4r0"; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EF8EF61A5F; Tue, 18 Jun 2024 18:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66037C4AF64; Tue, 18 Jun 2024 18:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718734699; bh=kQhv3CeO5+UCw9SJSn7ZxV5sAw44NEd/krZ6l962Oqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQ/CB4r01A0ClGT+QwDaT7ylpWMw3N+dob/wzVdm7wJD9HDuPo57XRBVku1+5BZZf k3KE4bLPtcIAsUXjZo670ljF89YMHona8451FMZ4mkRU0iCVHxswVKcO2vt6BEX98O /hnQh6TPCFAvWEHUNflOSLMe0hpR4jPahbJJKcHwmBVcWD3Lqa7WgKWlD/LKud4EYT sth87vbfVIsgkevcpxrNdwA7VVIsqeJWdAvvt+bPPmSN0Ap1KHOC9+DI3gJ/2T2LXL ymXCzvt+u91KmVkLalchFgH5miTU3BoCS9AXS1b0NVnnJCMM5fiTHaxV+BMjWJDZuq XbtAtMPFPO3kA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/12] mm/damon/sysfs: remove unnecessary online tuning handling code Date: Tue, 18 Jun 2024 11:18:02 -0700 Message-Id: <20240618181809.82078-6-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618181809.82078-1-sj@kernel.org> References: <20240618181809.82078-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: C3B54140007 X-Stat-Signature: 5kn5sspazpg8p46mzch51u5ssbiuusaa X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718734700-490179 X-HE-Meta: U2FsdGVkX1/LmuzqHdLFQL11HROv+xskPA/in5pLx+UYi+Dnz0mOcLwv81XOiXULpR30KC9Lgd3iuKgc/HcXpqnlaabREixXIukjmULDo1ubWcB34YvD38gDOyecN8BU6GM2V5pf0Mn74//v4cgjWGKf3rMJXumMprs9YADMvIw3kqOR8O8+UH0vzTly2aqdRvKY7yyJhBAl2b8fLP8SLWG3NzqpoHJ6NacljYMFD0UIQB0A21vujqoEe2SIxlWQD4KCD5jL6YGeTsk2aBFosO4wiVgTsQl82c7L2AuAMnRf6RfywvEAxSyMyPhWRq5eJcgUuvYTOJVfRGGPji1H5zNQjcE1stWEKwQVHsVFWv0lBhjQlHyatjH7HBVmYijIB8PSM+OuCCbhyDdd2Lap0FRs9snDJqwQEj9ZUiIz59NC6CI5UoHE7DT/ZCvNxKH6gTg/RLptr8Y8dWVJzk5/5PGu7NAJXcbPHsjjLM9s6iinkQOl4hD3074KOkmq1CXPs6QzePbScRiKoCoYZdxv0sCO/4D0+0vx/nI/OC1q6oAscvVtLX1enKB0YWQb8ufolyAFMdH1jqWt28StltIldW4GVJdYzQGqYwUYhxlpafZ7IPhlr+N6n+JfNQB0G9pT4rbJc207To7nIDg3lHGb7O1laxPZWe3Kfou634lEiVxuf6pzTT4fS26lTrEUaBEibxhW09bGnWNfk9L5lIC1JCBUI2tb7H2ROTVEUpoNc/RZsyn2Fk9i7N9OEROy0VkKZ+/iVgzRf0WvzZ8ZoPepPPJNSEYt1MejWqGGRe53aPx2UERzzJL8LsrlZ2wJTBknZb5s/tPV0EjytAkpYedT91PCTqwxkoc4JL5S6PztwfEhaXKNohGSuANGMLXbNpJMod+ZnScnnVGvk1ws9Xkmxu+mZzKgZc2N0pcYG8rWjm5aocxmwVIf+sNSOpZvfFe6NKiSo1bqQzMTIPNXhMT Xh2LuxH3 J5broURSq8LKr1iHO8DWkVmGToHgFPjyx+Qv4ml5Y0eIay3oo1Mw/Yz5Byz81RngJUkI0Un6UPsdEm4p/0LBdFaLBy1Wr4eXujcmN0DbLne1gNs6+kKtB6c/0Dp3cC+vzaGWsR5VpdVhftzIffWG59ctSoXw5ErFXGMvh+FHEbz5f5uPbnYAomCJO6S0gPkxfpmOPKncVhbylZ9Bx7d3lgMrUUJfP5QECZw7/i5S3tTyzxvo= 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: damon/sysfs.c contains code for handling of online DAMON parameters update edge cases. It is no more necessary since damon_commit_ctx() takes care of the cases. Remove the unnecessary code. Signed-off-by: SeongJae Park --- mm/damon/sysfs-test.h | 2 +- mm/damon/sysfs.c | 60 ++----------------------------------------- 2 files changed, 3 insertions(+), 59 deletions(-) diff --git a/mm/damon/sysfs-test.h b/mm/damon/sysfs-test.h index 73bdce2452c1..43a15156a7c3 100644 --- a/mm/damon/sysfs-test.h +++ b/mm/damon/sysfs-test.h @@ -62,7 +62,7 @@ static void damon_sysfs_test_set_targets(struct kunit *test) sysfs_target->pid = __damon_sysfs_test_get_any_pid( sysfs_target->pid + 1, 200); damon_sysfs_set_targets(ctx, sysfs_targets); - KUNIT_EXPECT_EQ(test, 1u, nr_damon_targets(ctx)); + KUNIT_EXPECT_EQ(test, 2u, nr_damon_targets(ctx)); damon_destroy_ctx(ctx); kfree(sysfs_targets->targets_arr); diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 0f9fe18beb40..c729222797b8 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1162,72 +1162,16 @@ static int damon_sysfs_add_target(struct damon_sysfs_target *sys_target, return err; } -static int damon_sysfs_update_target_pid(struct damon_target *target, int pid) -{ - struct pid *pid_new; - - pid_new = find_get_pid(pid); - if (!pid_new) - return -EINVAL; - - if (pid_new == target->pid) { - put_pid(pid_new); - return 0; - } - - put_pid(target->pid); - target->pid = pid_new; - return 0; -} - -static int damon_sysfs_update_target(struct damon_target *target, - struct damon_ctx *ctx, - struct damon_sysfs_target *sys_target) -{ - int err = 0; - - if (damon_target_has_pid(ctx)) { - err = damon_sysfs_update_target_pid(target, sys_target->pid); - if (err) - return err; - } - - /* - * Do monitoring target region boundary update only if one or more - * regions are set by the user. This is for keeping current monitoring - * target results and range easier, especially for dynamic monitoring - * target regions update ops like 'vaddr'. - */ - if (sys_target->regions->nr) - err = damon_sysfs_set_regions(target, sys_target->regions); - return err; -} - static int damon_sysfs_set_targets(struct damon_ctx *ctx, struct damon_sysfs_targets *sysfs_targets) { - struct damon_target *t, *next; - int i = 0, err; + int i, err; /* Multiple physical address space monitoring targets makes no sense */ if (ctx->ops.id == DAMON_OPS_PADDR && sysfs_targets->nr > 1) return -EINVAL; - damon_for_each_target_safe(t, next, ctx) { - if (i < sysfs_targets->nr) { - err = damon_sysfs_update_target(t, ctx, - sysfs_targets->targets_arr[i]); - if (err) - return err; - } else { - if (damon_target_has_pid(ctx)) - put_pid(t->pid); - damon_destroy_target(t); - } - i++; - } - - for (; i < sysfs_targets->nr; i++) { + for (i = 0; i < sysfs_targets->nr; i++) { struct damon_sysfs_target *st = sysfs_targets->targets_arr[i]; err = damon_sysfs_add_target(st, ctx);