linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: haoxin <xhao@linux.alibaba.com>
To: SeongJae Park <sj@kernel.org>
Cc: 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 10:47:58 +0800	[thread overview]
Message-ID: <c0c5c013-9355-c394-afff-ed25b0c456b8@linux.alibaba.com> (raw)
In-Reply-To: <20220819022850.52236-1-sj@kernel.org>


在 2022/8/19 上午10:28, SeongJae Park 写道:
> Hi Xin,
>
>> 在 2022/8/19 上午1:11, SeongJae Park 写道:
>>> Hi Xin,
>>>
>>>
>>> On Thu, 18 Aug 2022 18:57:31 +0800 Xin Hao <xhao@linux.alibaba.com> 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.

Ok,  Thank you for your detailed  explain, just keep it. but there still 
a problem in damon_lru_sort_apply_parameters

if (!monitor_region_start && !monitor_region_end &&
		!get_monitoring_region(&monitor_region_start,
			&monitor_region_end))

if (!monitor_region_start || !monitor_region_end ||
		!get_monitoring_region(&monitor_region_start,
			&monitor_region_end))

the '&&' should fix to '||',  anyone checks fail, it should return ?






>


  reply	other threads:[~2022-08-19  2:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 10:57 [PATCH V2 0/2] mm/damon: A few fixup with lru_sort Xin Hao
2022-08-18 10:57 ` [PATCH V2 1/2] mm/damon/lru_sort: Move target memory region check to head of func Xin Hao
2022-08-18 17:11   ` SeongJae Park
2022-08-19  2:12     ` haoxin
2022-08-19  2:28       ` SeongJae Park
2022-08-19  2:47         ` haoxin [this message]
2022-08-19  4:52           ` SeongJae Park
2022-08-18 10:57 ` [PATCH V2 2/2] mm/damon/lru_sort: Remove struct of damon_lru_sort_ram_walk_arg Xin Hao
2022-08-18 17:23   ` SeongJae Park
2022-08-19  1:56     ` haoxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0c5c013-9355-c394-afff-ed25b0c456b8@linux.alibaba.com \
    --to=xhao@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox