From patchwork Sun Nov 19 17:15:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 166858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1750478vqn; Sun, 19 Nov 2023 09:15:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEI/dwlLT3X0Y5PUBaQX30h5Oi6MmYKDDEdJZ/cI+SXVEgS+Fpooc8mQqlTkZgNzkUY/Y+Z X-Received: by 2002:a05:6a20:2203:b0:180:ebec:da1e with SMTP id u3-20020a056a20220300b00180ebecda1emr2359349pzb.21.1700414159494; Sun, 19 Nov 2023 09:15:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700414159; cv=none; d=google.com; s=arc-20160816; b=HDGTqNXjcPTAUZAu1vWskY6t5gMFiTk1wX+QpTc+iS5ZmgVIQPcRZGpSSvSe5zGEco TueWb8/EES/m7f5IhaQx1rx9Fp1fiVOLczmIqCL2pf27ejyGZTY6ehhVSY3NEGGKMYAG UXCoLeNg3IHKNYk1P5zs6iAqT/IQxtcJbmswfDHtQdIpBCoeYkBZx17Dzq4gSeOPaB9g uQVRn15RFYw2pRni3zOaNjbxO6QpXHz7zCyQU33an7GGifcTKp1tyNRek0J8mm55Aqai /h7R3e7r68/aagXDHssd88wTJKX4lwqI3vpMJH0oIiN26lsktsr65UJqDg3vmBNwCl5w HCqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Dz3JwZ6TItvV+BBLFmzbVlDOXHt5HH6pjq5477TbDUY=; fh=yShER6sAU1t2EUnKfsE5D0X+v9il5RZ0sMRx2SrxMeQ=; b=cDJKGoAog7ofszcDiF9GexeH1QBaUtgD965LHK0cyefEaSHc/PB37MuzXV/VmKL0EB iIPfVFySmNxj8ihGMHonMEIaVDGofAf1bZKgsczuQCQO4T8JYrTp0Z0kxwc5JKzkSsm3 O9ube0vXtZaAKbHD0fa26ALZF2/f12671e/ugtBL+p5Z+u4phloC+kwx0gkBiWCVd518 PG3a4rhaNBwYqOxtt+O7CEAcCXS5xWqwbDUco4vUGpsGZsF2hMhflFsKhR/pcL9BTM3r AxM3AMeDV9fI5gG0MW+Gs8grI1d+v4P1HJlQv16gOA9eXljZDkLQTpd1RWILWNHFadE0 EZsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LjylG+h6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e9-20020a056a0000c900b0069335e0c824si6321400pfj.204.2023.11.19.09.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 09:15:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LjylG+h6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0E6D080615C8; Sun, 19 Nov 2023 09:15:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231512AbjKSRPj (ORCPT + 99 others); Sun, 19 Nov 2023 12:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbjKSRPh (ORCPT ); Sun, 19 Nov 2023 12:15:37 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F77C0 for ; Sun, 19 Nov 2023 09:15:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BEBFC433C9; Sun, 19 Nov 2023 17:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700414134; bh=YDy2xpgd3SqWOCCdmUAUqNT0vwzIyx0UHeHWEu/iyRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LjylG+h6XhlGYO3Ub30LrxVW6R/8F/y1CvnVEtKokrXHOcCFNtYWT2iWfNIgY/B4K 3cS78u1fskzF0FeyFDELRMq5TGWSesXNl4/W3mWmuwYfRQzZCmNw2+gsO/6c275yI9 lnjz95ZZZsA805p85xdm8l6+tEmOblMYoWkYqyFUbkXTk+r7NIa6hTPjWBd3AZosuH LLNMn21EXI7PiMbDrpx86j1jLp87JOZAMKgeIQcRxzMvYWHk33LKX6OR/pCBN4wNAQ C0S+WwA3iwQFHhmX4KpoAXFc6YTFVbPHaWIr7m+e21K+AGomVHVN1WYJN3Qvl7KYEG MiEfdSmcOp5uw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Brendan Higgins , David Gow , damon@lists.linux.dev, linux-mm@kvack.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm/damon/core-test: test damon_split_region_at()'s access rate copying Date: Sun, 19 Nov 2023 17:15:29 +0000 Message-Id: <20231119171529.66863-2-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231119171529.66863-1-sj@kernel.org> References: <20231119171529.66863-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 19 Nov 2023 09:15:57 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783013478018450782 X-GMAIL-MSGID: 1783013478018450782 damon_split_region_at() should set access rate related fields of the resulting regions same. It may forgotten, and actually there was the mistake before. Test it with the unit test case for the function. Signed-off-by: SeongJae Park --- mm/damon/core-test.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mm/damon/core-test.h b/mm/damon/core-test.h index 649adf91ebc5..e6a01ea2ec54 100644 --- a/mm/damon/core-test.h +++ b/mm/damon/core-test.h @@ -122,18 +122,25 @@ static void damon_test_split_at(struct kunit *test) { struct damon_ctx *c = damon_new_ctx(); struct damon_target *t; - struct damon_region *r; + struct damon_region *r, *r_new; t = damon_new_target(); r = damon_new_region(0, 100); + r->nr_accesses_bp = 420000; + r->nr_accesses = 42; + r->last_nr_accesses = 15; damon_add_region(r, t); damon_split_region_at(t, r, 25); KUNIT_EXPECT_EQ(test, r->ar.start, 0ul); KUNIT_EXPECT_EQ(test, r->ar.end, 25ul); - r = damon_next_region(r); - KUNIT_EXPECT_EQ(test, r->ar.start, 25ul); - KUNIT_EXPECT_EQ(test, r->ar.end, 100ul); + r_new = damon_next_region(r); + KUNIT_EXPECT_EQ(test, r_new->ar.start, 25ul); + KUNIT_EXPECT_EQ(test, r_new->ar.end, 100ul); + + KUNIT_EXPECT_EQ(test, r->nr_accesses_bp, r_new->nr_accesses_bp); + KUNIT_EXPECT_EQ(test, r->nr_accesses, r_new->nr_accesses); + KUNIT_EXPECT_EQ(test, r->last_nr_accesses, r_new->last_nr_accesses); damon_free_target(t); damon_destroy_ctx(c);