From: Andrew Morton <akpm@linux-foundation.org>
To: SeongJae Park <sj@kernel.org>
Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH mm-unstable] mm/damon/core: increase regions merge aggressiveness while respecting min_nr_regions
Date: Wed, 26 Jun 2024 15:05:16 -0700 [thread overview]
Message-ID: <20240626150516.fb14ba5e65ae9d59ece0d390@linux-foundation.org> (raw)
In-Reply-To: <20240626214954.46143-1-sj@kernel.org>
On Wed, 26 Jun 2024 14:49:54 -0700 SeongJae Park <sj@kernel.org> wrote:
> > @@ -1716,8 +1717,8 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold,
> > nr_regions += damon_nr_regions(t);
> > }
> > threshold = max(1, threshold * 2);
> > - sz_limit = max(1, sz_limit * 2);
> > - } while (nr_regions > c->attrs.max_nr_regions);
> > + } while (nr_regions > c->attrs.max_nr_regions &&
> > + threshold <= max_thres);
>
> This code means that kdamond_merge_regions() stops this repeated merge attempt
> if the merge threshold that increased for next attempt is higher than the
> possible maximum threshold. And because the increase of the threshold is made
> by picking a maximum value between one and the last-used threshold multiplying
> two, the merge attempt with maximum threshold will not be made unless both the
> maximum threshold and the threshold to increase are powers of two. In maximum
> situation (e.g., region 1 has 100% access frequency, region 2 has 0% access
> frequency, so on), this means the max_nr_regions violation cannot be recovered
> by the attempts.
>
> This can be fixed by changing it to stop repeated attempt if the last-used
> threshold is same to or higher than the maximum possible threshold, like below.
>
> I'll send the fix of the fix as a formal patch soon.
>
> FYI, the original fix is definitely better to be merged in stable kernels, but
> not urgent in my opinion, since the problematic case is not common and the
> behavior was same since the beginning of DAMON. Andrew, if you feel the
> original fix is not stable yet, please feel free to delay moving it to
> hotfix-stable for one week or two.
That's fine - we can merge cc:stable patches any time, really - they
will still get backported. There's only a hurry to get fixes merged up
if they're security-related or if the issue is causing people problems.
In this case I'll await your -fix-2.patch and we can merge the patch
next week.
next prev parent reply other threads:[~2024-06-26 22:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 16:47 SeongJae Park
2024-06-26 21:49 ` SeongJae Park
2024-06-26 22:05 ` Andrew Morton [this message]
2024-06-27 16:33 ` SeongJae Park
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=20240626150516.fb14ba5e65ae9d59ece0d390@linux-foundation.org \
--to=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