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 V3] mm/damon: simplify scheme create in lru_sort.c
Date: Thu, 15 Sep 2022 22:03:34 +0800 [thread overview]
Message-ID: <fa354d0a-c997-7e21-2b35-22554a33ecdc@linux.alibaba.com> (raw)
In-Reply-To: <20220915132506.65586-1-sj@kernel.org>
在 2022/9/15 下午9:25, SeongJae Park 写道:
> Hi Xin,
>
> On Thu, 15 Sep 2022 10:36:55 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
>
>> In damon_lru_sort_new_hot_scheme() and damon_lru_sort_new_cold_scheme(),
>> they have so much in common, so we can combine them into a single
>> function, and we just need to distinguish their differences.
>>
>> Suggested-by: SeongJae Park <sj@kernel.org>
>> Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
>> Changes from v2
>> (https://lore.kernel.org/linux-mm/20220914113859.37637-1-xhao@linux.alibaba.com/)
>> - Add static global 'struct damos_access_pattern' stub variable
> Chagelog should not be in the commit message area,
>
>> ---
> but here.
>
>> mm/damon/lru_sort.c | 41 +++++++++++++++++++----------------------
>> 1 file changed, 19 insertions(+), 22 deletions(-)
>>
>> diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
>> index 07a0908963fd..6a26c5822286 100644
>> --- a/mm/damon/lru_sort.c
>> +++ b/mm/damon/lru_sort.c
>> @@ -132,6 +132,18 @@ DEFINE_DAMON_MODULES_DAMOS_STATS_PARAMS(damon_lru_sort_cold_stat,
>> lru_sort_tried_cold_regions, lru_sorted_cold_regions,
>> cold_quota_exceeds);
>>
>> +struct damos_access_pattern damon_lru_sort_stub_access_pattern = {
>> + /* Find regions having PAGE_SIZE or larger size */
>> + .min_sz_region = PAGE_SIZE,
>> + .max_sz_region = ULONG_MAX,
>> + /* and accessed for more than the threshold */
> This comment looks inappropriate. How about 'no matter its access frequency'?
>
>> + .min_nr_accesses = 0,
>> + .max_nr_accesses = UINT_MAX,
>> + /* no matter its age */
>> + .min_age_region = 0,
>> + .max_age_region = UINT_MAX,
>> +};
>> +
>> static struct damon_ctx *ctx;
>> static struct damon_target *target;
>>
>> @@ -157,17 +169,9 @@ static struct damos *damon_lru_sort_new_scheme(
>> /* Create a DAMON-based operation scheme for hot memory regions */
>> static struct damos *damon_lru_sort_new_hot_scheme(unsigned int hot_thres)
>> {
>> - struct damos_access_pattern pattern = {
>> - /* Find regions having PAGE_SIZE or larger size */
>> - .min_sz_region = PAGE_SIZE,
>> - .max_sz_region = ULONG_MAX,
>> - /* and accessed for more than the threshold */
>> - .min_nr_accesses = hot_thres,
>> - .max_nr_accesses = UINT_MAX,
>> - /* no matter its age */
>> - .min_age_region = 0,
>> - .max_age_region = UINT_MAX,
>> - };
>> + struct damos_access_pattern pattern = damon_lru_sort_stub_access_pattern;
> More than 80 columns. Renaming stub_access_pattern into stub_pattern might
> make sense.
>
>> +
>> + pattern.min_nr_accesses = hot_thres;
>>
>> return damon_lru_sort_new_scheme(&pattern, DAMOS_LRU_PRIO);
>> }
>> @@ -175,17 +179,10 @@ static struct damos *damon_lru_sort_new_hot_scheme(unsigned int hot_thres)
>> /* Create a DAMON-based operation scheme for cold memory regions */
>> static struct damos *damon_lru_sort_new_cold_scheme(unsigned int cold_thres)
>> {
>> - struct damos_access_pattern pattern = {
>> - /* Find regions having PAGE_SIZE or larger size */
>> - .min_sz_region = PAGE_SIZE,
>> - .max_sz_region = ULONG_MAX,
>> - /* and not accessed at all */
>> - .min_nr_accesses = 0,
>> - .max_nr_accesses = 0,
>> - /* for min_age or more micro-seconds */
>> - .min_age_region = cold_thres,
>> - .max_age_region = UINT_MAX,
>> - };
>> + struct damos_access_pattern pattern = damon_lru_sort_stub_access_pattern;
> More than 80 columns.
>
>> +
>> + pattern.max_nr_accesses = 0;
>> + pattern.min_age_region = cold_thres;
>>
>> return damon_lru_sort_new_scheme(&pattern, DAMOS_LRU_DEPRIO);
>> }
>> --
>> 2.31.0
> Other than the trivial things, look good. As my comments are only for trivial
> cosmetic things, I will make the change and post v4 on my own.
Ok, thank you very much for such a detailed review.
>
> Thanks,
> SJ
prev parent reply other threads:[~2022-09-15 14:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 2:36 Xin Hao
2022-09-15 13:25 ` SeongJae Park
2022-09-15 14:03 ` haoxin [this message]
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=fa354d0a-c997-7e21-2b35-22554a33ecdc@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