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 447CBC00140 for ; Fri, 19 Aug 2022 02:28:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AC968D0003; Thu, 18 Aug 2022 22:28:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 634A28D0002; Thu, 18 Aug 2022 22:28:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D5248D0003; Thu, 18 Aug 2022 22:28:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 380E98D0002 for ; Thu, 18 Aug 2022 22:28:57 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0A87B1C690D for ; Fri, 19 Aug 2022 02:28:57 +0000 (UTC) X-FDA: 79814759514.19.BB78F4A Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id 69A2B180008 for ; Fri, 19 Aug 2022 02:28:56 +0000 (UTC) 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 B2279B8255D; Fri, 19 Aug 2022 02:28:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D861FC433D6; Fri, 19 Aug 2022 02:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660876133; bh=hlzfkU+1Cauv3f2NrQO+riFDY79o2Wb/uGUduVuAY/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yjo4zowxmdjgkvQnUobmcF0qq6ZHfoWfro2F+gk0qdsPU2NHlMWoEhEVvcIZTIwI6 KbycYs+9f4m0S+0h89mtUtOk3QnELuayoie+6fzss1zM/H8w6yslRJkv7gOw8tCO9B ncBTKScfc5rNG+3F8tyBYN3R1AxvF3pad2xbMh7ry9QDfEm8PIrgf80chxBv4BzFjk 73Cc6OIWiwQ1rrou6JCWsKfL7ohkyRWGInSE/VHoCyzgfI4MTBer4YHTE9dJln0fUI +L4MRrWSEtaRI7++wBzA5jQEfJJIJv6wTzJsSspO86LLTl3ojIOR7ou7NaXNyWJM1Z 0eh2t5vXOnEdw== From: SeongJae Park To: xhao@linux.alibaba.com Cc: SeongJae Park , akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 1/2] mm/damon/lru_sort: Move target memory region check to head of func Date: Fri, 19 Aug 2022 02:28:50 +0000 Message-Id: <20220819022850.52236-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <5c1c4b01-5ada-5c25-7181-a6f6c2c1f6ed@linux.alibaba.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660876136; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=d3Ql8liW8qjQ/G0ayzt93p2uF8XE56LqzCrUMcPwTZ8=; b=aGsALi/bj8rVd9dJoySgBFv/oiAMmjiLP7u8BpXGwyr47vqew133wd7mdLccNkO+kZTiiT VIWHlsqt69ZVCysOZhrMV4yFFF2hXFCAgVm38hrzK+fUlT8zsOKvWWs4uDP5d2w3ewA2Vs DX/uTAoFowKwwk3gBUZNhBKV7vQvWag= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Yjo4zowx; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1660876136; a=rsa-sha256; cv=none; b=jF7eVMz4qXEpwRDA28z2lIE4DEcD29S7Jx7Nf+vzIa9L2K5RIjnP66waJyEiPMPwV7VRFh ZMjTN9q4BPEEHhYJe8rPJTroNxdfvar0frEF+BNTvC+Ydr/YDmGhb8LdH9Z/p93pzmqhEG IcN3hBWWpRAanEdSqDX8mdRYUoXlHH4= X-Stat-Signature: ch8xok3oj8w1npd9ysnrui6medf6jkat X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Yjo4zowx; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 69A2B180008 X-HE-Tag: 1660876136-944741 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: Hi Xin, > > 在 2022/8/19 上午1:11, SeongJae Park 写道: > > Hi Xin, > > > > > > On Thu, 18 Aug 2022 18:57:31 +0800 Xin Hao wrote: > > > >> In damon_lru_sort_apply_parameters(), if "monitor_region_start" > >> and "monitor_region_end" is not a valid physical address range, > >> There no need to run the remainder codes in it. > > The function, 'damon_lru_sort_apply_parameters()', checks validity of > > parameters and construct the DAMON context one by one. For example, > > 'damon_set_attrs()' returns an error if the parameters are invalid. So the > > intended flow is, > > > > 1. check DAMON attributes parameters, > > 2. apply DAMON attributes parameters, > > 3. check scheme parameters, > > 4. apply scheme parameters, > > 5. check target region parameters, and > > 6. apply target region parameters. > > > > Therefore what this patch does is making the target regions validity check to > > be done earlier than validity checks of other parameters. There is no special > > reason to check the region earlier than others. Also, this change makes the > > flow of the function a little bit weird in my humble opinion, as the flow will > > be > > > > 1. check target region parameters, > > 2. check DAMON attributes parameters, > > 3. apply DAMON attributes parameters, > > 4. check scheme parameters, > > 5. apply scheme parameters, and > > 6. apply target region parameters. > > Ok, understand what you mean, my fix looks ugly, buy any apply above > are not not necessary if one of them checks failed, why not check all > fisrt and then apply them, like this: > > 1. check target region parameters, > > 2. check DAMON attributes parameters, > > 3. check scheme parameters, The parameter values could be changed by users after the check, so we should cache those somewhere anyway. In other words, we cache those in the DAMON context. Therefore I think the above works were not totally waste of the time. Also, because the parameters applying functions like 'damon_set_attrs()' does the check and applying of the parameters together, I feel like current flow is natural. If I'm missing something, please let me know. Thanks, SJ > > > > > So I'd argue this patch seems not really needed, sorry. > > > > > > Thanks, > > SJ > > > > [...] >