From patchwork Tue Jun 18 18:18:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13702818 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 C132CC2BA18 for ; Tue, 18 Jun 2024 18:18:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C22908D0048; Tue, 18 Jun 2024 14:18:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7B268D004B; Tue, 18 Jun 2024 14:18:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 400BF8D004A; Tue, 18 Jun 2024 14:18:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AE0388D003B for ; Tue, 18 Jun 2024 14:18:23 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5EC78A2C40 for ; Tue, 18 Jun 2024 18:18:23 +0000 (UTC) X-FDA: 82244819286.28.7E26318 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id B50F2A0006 for ; Tue, 18 Jun 2024 18:18:21 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PjoSmauB; spf=pass (imf25.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=1718734696; 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=zwB8ozK7Br0e5BeIoJR/HX7vYM26VYq+1rAfUEsbWJQ=; b=21qBgwS3mkkUVaH3pKrz37iapLmwJbubOzn9wOjIynuRPfXs+vo9KbkoYx7hfczK6pNQnh XekasVtMvBOoQ15nb6kIcNCqerHp2pRz5MQL3R32Ez8d1qgdU/EsKcsaMZPCCUnqtrceuR Ar+in4nfKa06HdxFK69ktJ+Bi88hDuc= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PjoSmauB; spf=pass (imf25.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718734696; a=rsa-sha256; cv=none; b=7ry39zQO5+MjkCH3PQdx55cpEgc/hL1S6fJMRfd+wXX5LLXNo3t7B3yS62SgypvTegkuo8 ojbflEWvG4H2M/S6tfv57Vi/s+g3Ke33G1a/DYr6NreHDrD/VnP3f/SB3EwUL9JEm8E84s Vi4Nfdhy0I0sgx6IivZWqmSOeCaPagU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9532F619EC; Tue, 18 Jun 2024 18:18:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07F2AC4AF53; 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=1718734700; bh=EJciIpJkn54LApe2WvU8Qvem30aT3O4bHfII25VjoqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PjoSmauBnyzwWhhnbMqKVxNzt+ZsloVpP7l+vWj1e6DIaRfGZ3ecZyu3aYIrRHwYq gkYh0jfvuo91oJYjeFefoLFGuNHTWx/VQfwOUDYtq+WQfSeG4aHju3NPphSufmZDyM VWIyveow4XQMugCPdEuTG2g0AH3Tr4mbFNjFRDVLRLCqG4QoINhx0aID0+Fk7iua0e 0AkN3SLPSEwlx0oOoCZfq2l6hTpiZfVxH9zikTxB4s43cawJzfrIIf5NleDNwmsobB jwsAooNpgTPmqUC3y0o4YPvlJZ4SG6JvAfZiFK0AhcaQDvsd4HaeqkFXdWHxr4yTwL ze7fOUTGtpCXA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/12] mm/damon/sysfs: rename damon_sysfs_set_targets() to ...add_targets() Date: Tue, 18 Jun 2024 11:18:03 -0700 Message-Id: <20240618181809.82078-7-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-Stat-Signature: ytg7kujqgqe9omwpqanwx3wmg8mpwhwk X-Rspam-User: X-Rspamd-Queue-Id: B50F2A0006 X-Rspamd-Server: rspam02 X-HE-Tag: 1718734701-845052 X-HE-Meta: U2FsdGVkX18WfLF76t6k1JcEfaYltCWLZDnLe7r1akAUuKDiIhx9IL9nOGir2lSIDrhO6npLlBwTTAOUOxsoPivdIFNoya49uUe/lhapvZ7vKBkUYG8OoK/GuB4dp/rwaiwDcdzvmQ9C4WnzyxEcLc2dmszx+PC8S4O1+hslukrC6an/k+Lvo5MqQpGnqGFRiW81wFY0l2LE61H6QgbySvR6RFSu7dVxPj+Dv1Q2TuxOiaF7bF2FjMxqov4JzlGeWHQb8H2xMLL9SH/FzCfZitCIoa9x4Bvd/R7IHUXhW27IvyMP90WJUKxRReqyrqAOQPThnaUMG+MkYMrATXlFP4nVjbpwgvmx8lWnCpPRSVqPXTezSt03KfexUPHcQuBWMu6gEcW4Gen+WHU72uUj3uICVVewq2gOWLBvys0oPaJvXEymN+C7k6XJaBbnSP/FDMK0bZycFppWqOBckQrtjKV+FaWuT0U4nRHOa/TVk2nqmPlL+QM8YzvMBNXM4heYW5DKWc76O4E8p2gIZ0BQunt9CvIGa1iNTPBRoS2cEdLGF4ykHAZSCYC3CJ1p5dtEYH4K1hA3NnvGbclq/1WvCy2Zbq/bEPUvGBAsOFZzZd0pjKwvZH9I8bNrThKxPqEl+me5K4ZSyMdNI6ZmM+cSy5fduvr/tN7a683FNTTu9D6V2kkkM1XRkzxMs0sDh3/a/8YWb4OCosdV8D0vtmOhBJfN0gJelueFy/Gha5FKHGMd13LtfEtPThABVaxBASeBohm/RujlWVDi9EStKNuP9AJwAJ/HAVgN1P1ePJSR+M7LPTxQEoz6IkckOv94huEwi0zk+h1PQ6CR4f2wAc/omRZUcf5MT0B+5yz+9BPDWwCavaZNkG/zS9elUKFVEnSvVx5f1sJTeeNSjZjKLszGx+RQrLkszLd0flkxcHhbFfnoAvj1ijIvAGjSavB2MrwLwPC65xUj0BzJMigOKK/ l0eFZrZl 17bwDnIIKTebdey/2n1UTx4au9P3Q7xk5bsX41JWAWN7u1sFXxkwRultq6cJUJoR4tlehi01mwLzmaTk+Uxmm+65SYe1jXh54yYfAhF4uW4pIwKLTav6cmq284ie+FCAAlpBwvLJqAFi4CEsXB30bcJ0/Jbpm5rlE8t3tP5F9C265Sshhpi1qRWThqSkzoBiELtUBX44mX3cjaGolmK4MTAc5QVzWtwrmxBQmBnfIscu8mVXlTPrAAnLKRucXVFgW0qBy4ArPZhYCG2fPRG/RY3LHqw== 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: The function was for updating DAMON structs that may or may not be partially populated. Hence it was not for only adding items, but also removing unnecessary items and updating items in-place. A previous commit has changed the function to assume the structs are not partially populated, and do only adding items. Make the function name better explain the behavior. Signed-off-by: SeongJae Park --- mm/damon/sysfs-test.h | 8 ++++---- mm/damon/sysfs.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/damon/sysfs-test.h b/mm/damon/sysfs-test.h index 43a15156a7c3..1c9b596057a7 100644 --- a/mm/damon/sysfs-test.h +++ b/mm/damon/sysfs-test.h @@ -38,7 +38,7 @@ static int __damon_sysfs_test_get_any_pid(int min, int max) return -1; } -static void damon_sysfs_test_set_targets(struct kunit *test) +static void damon_sysfs_test_add_targets(struct kunit *test) { struct damon_sysfs_targets *sysfs_targets; struct damon_sysfs_target *sysfs_target; @@ -56,12 +56,12 @@ static void damon_sysfs_test_set_targets(struct kunit *test) ctx = damon_new_ctx(); - damon_sysfs_set_targets(ctx, sysfs_targets); + damon_sysfs_add_targets(ctx, sysfs_targets); KUNIT_EXPECT_EQ(test, 1u, nr_damon_targets(ctx)); sysfs_target->pid = __damon_sysfs_test_get_any_pid( sysfs_target->pid + 1, 200); - damon_sysfs_set_targets(ctx, sysfs_targets); + damon_sysfs_add_targets(ctx, sysfs_targets); KUNIT_EXPECT_EQ(test, 2u, nr_damon_targets(ctx)); damon_destroy_ctx(ctx); @@ -71,7 +71,7 @@ static void damon_sysfs_test_set_targets(struct kunit *test) } static struct kunit_case damon_sysfs_test_cases[] = { - KUNIT_CASE(damon_sysfs_test_set_targets), + KUNIT_CASE(damon_sysfs_test_add_targets), {}, }; diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index c729222797b8..f83ea6a166c6 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1162,7 +1162,7 @@ static int damon_sysfs_add_target(struct damon_sysfs_target *sys_target, return err; } -static int damon_sysfs_set_targets(struct damon_ctx *ctx, +static int damon_sysfs_add_targets(struct damon_ctx *ctx, struct damon_sysfs_targets *sysfs_targets) { int i, err; @@ -1283,7 +1283,7 @@ static int damon_sysfs_apply_inputs(struct damon_ctx *ctx, err = damon_sysfs_set_attrs(ctx, sys_ctx->attrs); if (err) return err; - err = damon_sysfs_set_targets(ctx, sys_ctx->targets); + err = damon_sysfs_add_targets(ctx, sys_ctx->targets); if (err) return err; return damon_sysfs_set_schemes(ctx, sys_ctx->schemes);