Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1765418rdb; Sun, 19 Nov 2023 09:16:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiIAgFMPfLtcsLtp/3PS8LyLHHEnQnzqBBuo/K7oPKK9+xwucpERdFSkbGaHRBLYgh6f/C X-Received: by 2002:a17:902:ef89:b0:1cc:2bd9:1b2d with SMTP id iz9-20020a170902ef8900b001cc2bd91b2dmr3709884plb.43.1700414162794; Sun, 19 Nov 2023 09:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700414162; cv=none; d=google.com; s=arc-20160816; b=uxWJ9s1Hfxm4bDS7azgY4vH2nVGdp1aJGEVk+mUTK8BFPqIYqMTphZ/c/16E4SZlrO rsMx9HVze/jEGcv+FUpl80vAFeRbpictfs0+6iVsmVroN8xpPtRy9YQzBAXf852fxPpG XnzJF+UCblKdZQMGdQ35VdSQ1xnwI4EsPkA44j7wE7SHoyZHZ0xQaGIzN1ZibCI4ABRQ v4cBXFXtZrhw3Mu7m4nb1CxK/rcjUs40cJTwffidCLWzrYwYnoDo8ehPsVdRf+PqI72k Ygatup/l0tJVEIRzkaRjTsTdkwQHcyniJ08auwaEU5Fi0qHdQjyXLNE01Mq6L0hp/Skg jWKA== 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 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k5-20020a170902ce0500b001cc45fcb81fsi7020825plg.334.2023.11.19.09.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 09:16:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; 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 2620:137:e000::3:5 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 6669380620BE; Sun, 19 Nov 2023 09:16:00 -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 Content-Transfer-Encoding: 8bit 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:16:00 -0800 (PST) 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); -- 2.34.1