From mboxrd@z Thu Jan 1 00:00:00 1970 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 D619EC38159 for ; Thu, 19 Jan 2023 02:00:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A87B6B0072; Wed, 18 Jan 2023 21:00:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 158DD6B0073; Wed, 18 Jan 2023 21:00:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3BA26B0074; Wed, 18 Jan 2023 21:00:55 -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 E42186B0072 for ; Wed, 18 Jan 2023 21:00:55 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B08DA1C602D for ; Thu, 19 Jan 2023 02:00:55 +0000 (UTC) X-FDA: 80369895270.01.4A8497C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 1DF27140013 for ; Thu, 19 Jan 2023 02:00:53 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kkPS7iYm; spf=pass (imf23.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=1674093654; 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=yW2Biyqh9mI2KXYdTrhdJtfdo/G/iMESVck2Q/GhysM=; b=IJ70+sJQeeunKojXMR2URjraolX0Js+gYzyYNr2KXRqzZbmITnqExI2z7M3ZXAtBkqmpCt OURXOzwECwj1lzgKl5P7vN3OCRLyGybW3M8+/NdcspuEgFRHwF8rx8lWpw+oRfcfa1FJCC hIFk195TPCxgqTT1WV1m3FBJFZj93O8= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kkPS7iYm; spf=pass (imf23.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=1674093654; a=rsa-sha256; cv=none; b=kM6JKZcEgWnc+TFaZlDNec4Y8BuKdMnm6tPbhhSRw7ovEn/Cg4FhkllHu9ZpZp/Xz0KAdu lxSVQBZiHayvwlFBz7wi0IayEDTY5D2JTFC8uKg3Vn9cCFsIj8E0+5VkaY8S52DVH+wf1v jF96A+UEsGmUSlmcbjvY9G3TXGuuYOw= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 294E2601DB; Thu, 19 Jan 2023 02:00:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBBCBC433D2; Thu, 19 Jan 2023 02:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674093652; bh=9rGecye3A9HkDxj4QdN4bMjjPezDbh4TPWj5J+UblD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkPS7iYmiXYaAW5OuXRSyAewoWMJ2IJibKOY5fHSz96x73zwuAWt+FUjg0aYpZ9IB OYDI2zVKoIr2Cn2OobjNxGvxfe5B8q0j/0/6dkh4+Ae2Ck+wdMCl3hS0WA4yHFQsS7 d/57YfEPy32BRMpjS5CL9BVXeT0WNKhfFzfcapHfcobaHHBv/Xv/auDPqsNbnwtD7A BgtyQbHQNpOEPpasDEyE8Of9AvstYHHunN8XDfd2PBPZPHmYlZlqiAia/5Yi0eeboe QtAy+UxbjWiJ3tpj65/fsFlc92zx0jvDenEH7ruzWPKJD/m3hqF/RY+gV9jHxWHTsm cjeqyyBm4wcTg== From: SeongJae Park To: Liam Howlett Cc: Daniel Latypov , SeongJae Park , "brendanhiggins@google.com" , "kunit-dev@googlegroups.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , "maple-tree@lists.infradead.org" , "damon@lists.linux.dev" , kernel test robot Subject: Re: [PATCH v3 30/48] mm/damon: Stop using vma_mas_store() for maple tree store Date: Thu, 19 Jan 2023 02:00:50 +0000 Message-Id: <20230119020050.2156-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117224734.c4lo4spezufwsims@revolver> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1DF27140013 X-Stat-Signature: mtfokh4d7kzfrzkumzc93zfr48fw5hoo X-HE-Tag: 1674093653-787978 X-HE-Meta: U2FsdGVkX19atjbxbU9bcD79RvyLNit2Ye5m53OLs+otTDAGPokzYo9B3tSzC+lCtC5l3PdVX+I8QhAsoaYiTNIxgkUCAz2Pide2wD4ksQCTNss3ZOSWTQRLZZ7pfwt4qImF0gxl/WWYHB7IMMiUHLmBv4gI0U0zJxBgirNK8g6Y4h3iVzAIWYRZkMRfMrsSRCPW2EVS8h7io9Zw5jKJb1LXGHH1sOMP0zLJP9C+Nx+ElmKRRHGp2iKTfBYeiNoOyBU0OmpZ6X8YIYjMS6pFSgp5PhHUhIK06cx2ZdUq6Zbm6mp9dbKcSzEurBp8xGF3XVwJkEDN0MkmOaOjzY/UoZd5lFs7JqirruHuEg1CQy6xHArQwoai0brXGg7aq2LlFBKCyBRydJXqrE5cT0JDDFbBp5cfOc4RxHI1U5s+j9SO3WrotsqwysGQtuFtbxnyHkXeUn4qRllAVSbFYCRgIQsezwmiZq/RBvsRnW6fqTqS9XJqK+rPBx7T/2zBoepXFBVGZFDHU9tT0kzVWjV/uyAVFqUAiOpnKvizyoVzi8jsnZH66kCvpNBrmBEuJ5wAhZsED2RVFJHRpc4hUKq6u3owTWyARf4Bp7xIQ+yDk9eS7rLd7uAiWnt3KMvNELFj1gq6EbrHtB3IQcG+f6Gk++qcjUCQsyNV90Jwcr0BXmu5v5+KDBHN1wpV+6ksY1hRDiA2ac1bWJH5bLzJzeXGV4x8uSGNa6nvSj8Yj78v/oDDDHWUR0BrtMCmslYrvDJi1iA9DZW4L2/I6fLinnmyAdPIcdw9lYeY4IRD6TlAWMqmq3Taz3/JcseqeomzIZuJidRV9qB2ev4PFSO/rFHZJm246LDIV//6TQ5hdOBCJPd5V9m17BF5i7ZZMx7seo3Vyr6etUMCFMTSj3dPZkWdBpj7uHD/SeCEeNsUlWoqlsEwbedsn9Ko+ixBXh5O7Hk6zDWiTb7FI80rKJT335s w0Rt2Ovz DptyQiMNVBzD8dslYvrI+XFpaSuvkL/Ds3AZyqo5NS1hQGJc3L2yuUpMP2VyJXdE/30aXMRPGdzXn66NZ5W0cGuP1pGGQSWP4y5tA6S6z6AZxQ/K/bCABt/tJ/kujXevumTso8O6ZpU09iKBf8EraRy65j05JaUDWmjA1 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: Hello Daniel and Liam, Sorry for late reply. On Tue, 17 Jan 2023 22:47:36 +0000 Liam Howlett wrote: > * Daniel Latypov [230117 17:20]: > > On Tue, Jan 17, 2023 at 11:11 AM SeongJae Park wrote: > > > > > > Cc-ing kunit people. > > > > > > Hi Liam, > > > > > > > > > Could we put touching file name on the summary? > > > E.g., mm/damon/vaddr-test: Stop using ... > > > > > > On Tue, 17 Jan 2023 02:34:19 +0000 Liam Howlett wrote: > > > > > > > From: "Liam R. Howlett" > > > > > > > > Prepare for the removal of the vma_mas_store() function by open coding > > > > the maple tree store in this test code. Set the range of the maple > > > > state and call the store function directly. > > > > > > > > Cc: SeongJae Park > > > > Cc: damon@lists.linux.dev > > > > Reported-by: kernel test robot > > > > Signed-off-by: Liam R. Howlett > > > > --- > > > > mm/damon/vaddr-test.h | 19 +++++++++++++------ > > > > 1 file changed, 13 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/mm/damon/vaddr-test.h b/mm/damon/vaddr-test.h > > > > index bce37c487540..6098933d3272 100644 > > > > --- a/mm/damon/vaddr-test.h > > > > +++ b/mm/damon/vaddr-test.h > > > > @@ -14,19 +14,26 @@ > > > > > > > > #include > > > > > > > > -static void __link_vmas(struct maple_tree *mt, struct vm_area_struct *vmas, > > > > +static int __link_vmas(struct maple_tree *mt, struct vm_area_struct *vmas, > > > > ssize_t nr_vmas) > > > > { > > > > - int i; > > > > + int i, ret = -ENOMEM; > > > > MA_STATE(mas, mt, 0, 0); > > > > > > > > if (!nr_vmas) > > > > - return; > > > > + return -ENOENT; > > > > We could pass in the `test` object here and give more detailed info, e.g. > > (if !nr_vmas) > > kunit_skip(test, "..."); > > > > And below could be > > > > bool stored_all = false; // instead of ret > > ... > > for (...) { > > > > } > > stored_all = true; > > > > failed: > > mas_unlock(&mas); > > if (!stored_all) kunit_skip(test, "failed to..."); > > > > > > > > > > mas_lock(&mas); > > > > - for (i = 0; i < nr_vmas; i++) > > > > - vma_mas_store(&vmas[i], &mas); > > > > + for (i = 0; i < nr_vmas; i++) { > > > > + mas_set_range(&mas, vmas[i].vm_start, vmas[i].vm_end - 1); > > > > + if (mas_store_gfp(&mas, &vmas[i], GFP_KERNEL)) > > > > + goto failed; > > > > + } > > > > + ret = 0; > > > > + > > > > +failed: > > > > mas_unlock(&mas); > > > > + return ret; > > > > } > > > > > > > > /* > > > > @@ -71,7 +78,7 @@ static void damon_test_three_regions_in_vmas(struct kunit *test) > > > > }; > > > > > > > > mt_init_flags(&mm.mm_mt, MM_MT_FLAGS); > > > > - __link_vmas(&mm.mm_mt, vmas, ARRAY_SIZE(vmas)); > > > > + KUNIT_EXPECT_EQ(test, __link_vmas(&mm.mm_mt, vmas, ARRAY_SIZE(vmas)), 0); > > > > > > In case of the __link_vmas() failure, I think we should skip this test using > > > 'kunit_skip()', rather marking this test failed. > > > > As noted above, I'd suggest we also pass in the `test` object to > > __link_vmas() and call kunit_skip() from there. > > My thoughts were if we are testing adding nothing to the list, then > there is probably a problem with the test and so that should be > highlighted with a failure. > > I really don't mind either way. I didn't wrote '__link_vmas()' to test vma manipulation functions it internally uses, but just to offload test setup for 'damon_test_three_regions_in_vmas()'. I agree that the detailed failure reason could be helpful for better understanding as the function can now fail from 'mas_store_gfp()'s memory allocation failure. That said, I think we can get the detail from the return value of '__link_vmas()'. I'm further worrying if passing 'test' object to the function makes people think the function itself is for testing something inside it. Also, I don't think the function returning non-error for zero value 'nr_vmas' as a problem but just expected behavior, as previously commented[1]. So I'd prefer doing kunit_skip() here. If I'm missing something or wrong, please let me know. [1] https://lore.kernel.org/damon/20230117191614.116521-1-sj@kernel.org/ Thanks, SJ