Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp319779rwb; Wed, 18 Jan 2023 18:20:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXtPp554KDN8g1mChX+vyNiR6oknDku6LT+abaA6h2XfTUaqI9ZecUHtwM74va6JGaEcAF9F X-Received: by 2002:a17:906:8d08:b0:86f:e30c:72c1 with SMTP id rv8-20020a1709068d0800b0086fe30c72c1mr10479037ejc.8.1674094814715; Wed, 18 Jan 2023 18:20:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674094814; cv=none; d=google.com; s=arc-20160816; b=dZuw4JU7NkvMfcL3ZPfO08RV0F1+q67OF9blSg8+L0yVRCkzwMkn+Ly66zCCQAcd+Q ok22r13cqnrIKIuTb0HmMU20k4+/bvcSY3dR2O6GkaR0cvjU9GKfyoGvj7q6Py/SXg5e MdK7U1mLP39NS0ahpzZ0m8PF4mfT4hPXE653EYRbQ7dj76oFDD3hL9Va1WOL7ARCfs2T kBr2gPeg3WKjzDfytazDYniv2YjodUyShbVC0C7NuLycAY8fpYw7uw6hJJWmip2G79dZ lrrrzPTqyXI/NRj6Je8LUbp77/uhctTVS1tr9X+lzIWBnDfdO3BYlMh/9j8B4VFQPbyO zl2Q== 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=yW2Biyqh9mI2KXYdTrhdJtfdo/G/iMESVck2Q/GhysM=; b=KzTtR1jtcsMM+vD5eGDs7y7iBCx9g5QnWliGnLZk7YxHivwE4amR+WQkDl5dZVTk9Y rKOMMvjITAIlZAK73rTO66VVvVScTqc1EcLqvPprZIHUVVueZ9FCV/jM4fqfokccUy2m d2OqC8yZp8XKsqfJnOrsppnHq4GBtj8zcMe7gl3kfRP28dOMNA5pYB+KG0gtVB1pzF64 vtC2RLPf53m8wUxg5yWeM+yNIKei9eqfkxMDnfYmHHu/OtWczHPhSmx5w6w16v9Ke+9w sYAjJi2dACi0xBrCVshF0KqZ8ZajHUX9XkltmPlbOg7MjVj23Oe9BNNoASVhUm1VepVE sa0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kkPS7iYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc28-20020a1709078a1c00b00872236c2754si9119919ejc.223.2023.01.18.18.20.04; Wed, 18 Jan 2023 18:20:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kkPS7iYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbjASCA6 (ORCPT + 44 others); Wed, 18 Jan 2023 21:00:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbjASCA4 (ORCPT ); Wed, 18 Jan 2023 21:00:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3014C768B for ; Wed, 18 Jan 2023 18:00:55 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id DD6A6B81D66 for ; 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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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