From: "Michał Cłapiński" <mclapinski@google.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nitin Gupta <nigupta@nvidia.com>,
Pasha Tatashin <tatashin@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/compaction: remove low watermark cap for proactive compaction
Date: Mon, 27 Jan 2025 14:31:00 +0100 [thread overview]
Message-ID: <CAAi7L5cjw2Dwanqta9BVmZbgE_jRo1r-SyxKpiMa=2T8PH+Qbg@mail.gmail.com> (raw)
In-Reply-To: <a5bcc8f6-11a4-42f5-b332-7f4d3079e7fb@suse.cz>
On Mon, Jan 27, 2025 at 11:38 AM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 1/24/25 19:21, Michal Clapinski wrote:
> > Previously a min cap of 5 has been set in the commit introducing
> > proactive compaction. This was to make sure users don't hurt themselves
> > by setting the proactiveness to 100 and making their system
> > unresponsive. But the compaction mechanism has a backoff mechanism that
> > will sleep for 30s if no progress is made, so I don't see a significant
> > risk here. My system (20GB of memory) has been perfectly fine with
> > proactiveness set to 100 and leeway set to 0.
> What if you don't set the leeway to 0?
When the fragmentation score (lower is better) gets larger than the
high watermark, proactive compaction kicks in. Compaction stops when
the score goes below the low watermark (or no progress is made and
backoff kicks in). Leeway is the difference between low and high
watermarks. So the bigger the leeway, the longer we have to wait for
proactive compaction to kick in. Memory usage on the host would also
look more like a sawtooth wave (slowly creeping up then sharp drop).
I set the leeway to 0 in this example because that's the most
aggressive configuration. My system can't reach a fragmentation score
of 0, so it tries to do compaction as often as possible.
> In other words, should we keep the cap in some sense but make it depend on the leeway?
I could do something like
wmark_low = max(100U - sysctl_compaction_proactiveness,
min(sysctl_compaction_proactiveness_leeway, 5U));
and it would have the benefit of not changing the behavior of
proactive compaction for current users. However, it would make it
impossible to have a small low watermark with the default leeway.
That's okay in my case but do we want to create those restrictions for
the future users?
>
>
> > Signed-off-by: Michal Clapinski <mclapinski@google.com>
> > ---
> > mm/compaction.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/compaction.c b/mm/compaction.c
> > index a2b16b08cbbff..29524242a16ef 100644
> > --- a/mm/compaction.c
> > +++ b/mm/compaction.c
> > @@ -2253,7 +2253,7 @@ static unsigned int fragmentation_score_wmark(bool low)
> > * activity in case a user sets the proactiveness tunable
> > * close to 100 (maximum).
> > */
> > - wmark_low = max(100U - sysctl_compaction_proactiveness, 5U);
> > + wmark_low = 100U - sysctl_compaction_proactiveness;
> > return low ? wmark_low : min(wmark_low + 10, 100U);
> > }
> >
>
next prev parent reply other threads:[~2025-01-27 13:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 18:21 [PATCH 0/2] mm/compaction: allow more aggressive " Michal Clapinski
2025-01-24 18:21 ` [PATCH 1/2] mm/compaction: remove low watermark cap for " Michal Clapinski
2025-01-25 16:03 ` Pasha Tatashin
2025-01-27 10:38 ` Vlastimil Babka
2025-01-27 13:31 ` Michał Cłapiński [this message]
2025-01-27 14:13 ` Vlastimil Babka
2025-01-24 18:21 ` [PATCH 2/2] mm/compaction: expose a new param " Michal Clapinski
2025-01-25 16:20 ` Pasha Tatashin
2025-01-27 10:40 ` Vlastimil Babka
2025-01-27 10:36 ` [PATCH 0/2] mm/compaction: allow more aggressive " Vlastimil Babka
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='CAAi7L5cjw2Dwanqta9BVmZbgE_jRo1r-SyxKpiMa=2T8PH+Qbg@mail.gmail.com' \
--to=mclapinski@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nigupta@nvidia.com \
--cc=tatashin@google.com \
--cc=vbabka@suse.cz \
/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