Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4712869rwb; Tue, 6 Sep 2022 11:25:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Bd5EWEJuPy2DhPVVswRSS4V4T/d5uZ3oW3M58LLVaitSNVqcjGN6XJ7WpvIJUqibzgQw8 X-Received: by 2002:a17:907:9484:b0:738:6f9f:6032 with SMTP id dm4-20020a170907948400b007386f9f6032mr40579275ejc.602.1662488742395; Tue, 06 Sep 2022 11:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662488742; cv=none; d=google.com; s=arc-20160816; b=I37mJKPalFReS82rLuz3LgiftDbQfMvP1IqApR0Td6NUCbv5L+cHgf96CKAuUClhy/ 89IU8mKZYV6WoMZ4u/BLBCpTkbmICUaGeghsbY0QT5TdWLUzZcBRcZDF1BrzGlkF5V5/ ul9YQ0CVjSNljtbgMBr/nlEPjFzan1uxFmHJ0mtozFv0gPntKY/h5mNeWV5qSeE9hTB/ qYDxx/Cdc60ADakv1FxB4YUSzBUP8yc94aRtCGv3fBZN8j2JDo3LCIkzSSyYdTne7gsz ltdwAz82VoNAl9OBcLtdWiuYmq2uaLvkI23TkVoCw3byNyfkgJJEpK6rj2S7YMkZb/jK j+dw== 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=t0bGhnR4nzh3S2s6TL6CYg7BlYWebzrFM9Ry5YNs2a0=; b=doeJvxhpECDVfCDBojAYPpV7c4e30HnEO6UUd/5fmu4rWsX6Y1b5IiUSdwue6BIcZ+ A7fV87+JFQuYlepdiEAB+nuyOBtiMTLZ5Hqpce5kLtaY9vc5PoHP/5So95EAPNWei77w +fc2Kg0dv/WD2fSqJWBhwDUnijg4A557mvRtxr4NLsyZt+AmFc9r7kenT+QMgRzN/Rkh igLF8+jNFQXasd8HX4g9SfoLWj+ZSm3o8AZc92hdAtDsjon92v/s6PhsJKOxBI0MFuoi hMPuWBGE2A4hyORofgPIIAlC5WlV79ioRF6xxPvVnoy2doX+/ze7kAUFKug5l3uDVN+h Fs/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="KBxn9Hm/"; 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 qc12-20020a170906d8ac00b0074853e69fbfsi8727665ejb.213.2022.09.06.11.25.15; Tue, 06 Sep 2022 11:25:42 -0700 (PDT) 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="KBxn9Hm/"; 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 S229608AbiIFSUN (ORCPT + 99 others); Tue, 6 Sep 2022 14:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbiIFSUL (ORCPT ); Tue, 6 Sep 2022 14:20:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 246C0647DD for ; Tue, 6 Sep 2022 11:20:11 -0700 (PDT) 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 C5382B819CB for ; Tue, 6 Sep 2022 18:20:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2692C433D6; Tue, 6 Sep 2022 18:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662488408; bh=GEJkql041XXCsjNgtcCyFYYz65fNAGYwfs5meFdVjWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBxn9Hm/BZ1H6OGeq5gyTeP5SB8glt+bMpRbFHQvBuKeJTYFnraod3Fsa1syirqGk 1Q1zyaVGYR8KZ0TPNq+f7xNnMgUAaDTocIJogGjT3HsnWTBXAiZl8hX36aAcFB6yXV s/zuxdvIShLJytiqyG7rYtt3IJgRpXoJe33ZIl5JWWJOVjzxE0vAMfIMbGgLDSDfoX rQiI/BKObHqA73TV86kC2MUuamKgBIL8XpB6uqEd/PmrlzslOkj0q94buhCm7yQzCo geVFa1I+rbuRpVhG45hs2UdFHrWD1k17zafVMfD87VeGLaXS8fd4FeIcomP9wUIH1t +iPVNd/SsxSNg== From: SeongJae Park To: xiakaixu1987@gmail.com Cc: sj@kernel.org, akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kaixu Xia Subject: Re: [PATCH] mm/damon/core: iterate the regions list from current point in damon_set_regions() Date: Tue, 6 Sep 2022 18:20:06 +0000 Message-Id: <20220906182006.50955-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1662477527-13003-1-git-send-email-kaixuxia@tencent.com> 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,T_SCC_BODY_TEXT_LINE 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 Hi Kaixu, On Tue, 6 Sep 2022 23:18:47 +0800 xiakaixu1987@gmail.com wrote: > From: Kaixu Xia > > We iterate the whole regions list every time to get the first/last regions > intersecting with the specific range in damon_set_regions(), in order to > add new region or resize existing regions to fit in the specific range. > Actually, it is unnecessary to iterate the new added regions and the > front regions that have been checked. Just iterate the regions list from > the current point using list_for_each_entry_from() every time to improve > performance. > The kunit tests passed: > [PASSED] damon_test_apply_three_regions1 > [PASSED] damon_test_apply_three_regions2 > [PASSED] damon_test_apply_three_regions3 > [PASSED] damon_test_apply_three_regions4 > > Signed-off-by: Kaixu Xia Reviewed-by: SeongJae Park Thanks, SJ [...]