From: Vlastimil Babka <vbabka@suse.cz>
To: Alexander Krabler <Alexander.Krabler@kuka.com>,
Mike Galbraith <efault@gmx.de>,
Frank van der Linden <fvdl@google.com>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Dennis Schimmel <Dennis.Schimmel@kuka.com>,
Daniel Braunwarth <Daniel.Braunwarth@kuka.com>
Subject: Re: Realtime threads delayed due to kcompactd0
Date: Fri, 1 Aug 2025 14:57:08 +0200 [thread overview]
Message-ID: <c48f2877-4d37-4310-995e-fc5c2ae9a366@suse.cz> (raw)
In-Reply-To: <DU0PR01MB103857873A56FD121984568148226A@DU0PR01MB10385.eurprd01.prod.exchangelabs.com>
On 8/1/25 13:23, Alexander Krabler wrote:
> On 7/31/25 20:35, Frank van der Linden wrote:
>> Not sure what the right thing to do would be. Either explicitly boost
>> the priority of a thread temporarily during migrate_pages_batch, or
>> mitigate the issue by dealing with 'busy' pages more quickly in
>> migrate_pages_batch.
>>
>> - Frank
>
> I think it would help if priority inheritance would kick in as soon as
> another thread is waiting due to the migration PTE.
>
>
> On 8/1/25 11:58, Vlastimil Babka wrote:
>> On 8/1/25 04:46, Mike Galbraith wrote:
>> > On Thu, 2025-07-31 at 20:41 +0200, Vlastimil Babka wrote:
>> >> On 7/31/25 20:34, Frank van der Linden wrote:
>> >> > Not sure what the right thing to do would be. Either explicitly boost
>> >> > the priority of a thread temporarily during migrate_pages_batch, or
>> >> > mitigate the issue by dealing with 'busy' pages more quickly in
>> >> > migrate_pages_batch.
>> >>
>> >> There's a workaround for realtime tasks. If you mlock[all]() their memory,
>> >> setting sysctl vm.compact_unevictable_allowed to 0 should exclude these
>> >> pages from migration by compaction.
>> >
>> > Hm, per documentation that's done automatically for PREEMPT_RT...
>>
>> Oh I see.
>
> Yes, vm.compact_unevictable_allowed is set to 0 in our setup
> (default as we have CONFIG_PREEMPT_RT).
>
>> > On CONFIG_PREEMPT_RT the default value is 0 in order to avoid a page fault, due
>> > to compaction, which would block the task from becoming active until the fault
>> > is resolved.
>>
>> So it's probably the mlock() part missing since that should otherwise apply
>> to kcompactd.
>
> We use mlockall() and I verified the pages have the lo flag set.
> Which means, that we have exactly the issue this sysctl flag should prevent us from.
Hm that means something isn't working as intended. Do the pages have also
the unevictable flag?
>>
>> > ...but rummaging, seems other stuff can step on it (contiguous alloc?).
>>
>> Yeah, there was time CMA was just something for mobile phone hardware. As
>> usage increases beyond that maybe we'll have to tackle it. Ideally by not
>> having mlock'd pages in CMA areas at all. And if contiguous alloc is
>> attempted outside of CMA areas, respect the sysctl there too.
>
> Yeah, we already thought CMA might somehow influcence our issue.
> We have 256 MiB of CMA, which our hardware probably uses.
If the problem is kcompactd, it should not be CMA related.
> Is there a way to tell a process to not allocate pages inside CMA area?
I think not at the moment.
next prev parent reply other threads:[~2025-08-01 12:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 5:30 Alexander Krabler
2025-07-31 18:34 ` Frank van der Linden
2025-07-31 18:41 ` Vlastimil Babka
2025-08-01 2:46 ` Mike Galbraith
2025-08-01 9:58 ` Vlastimil Babka
2025-08-01 11:23 ` Alexander Krabler
2025-08-01 12:57 ` Vlastimil Babka [this message]
2025-08-01 13:40 ` Alexander Krabler
2025-08-07 10:48 ` Vlastimil Babka
2025-08-07 12:21 ` Hugh Dickins
2025-08-07 15:49 ` Alexander Krabler
2025-08-08 7:37 ` Vlastimil Babka
2025-08-20 14:29 ` Sebastian Andrzej Siewior
2025-08-01 19:27 ` Frank van der Linden
2025-08-05 14:11 ` Alexander Krabler
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=c48f2877-4d37-4310-995e-fc5c2ae9a366@suse.cz \
--to=vbabka@suse.cz \
--cc=Alexander.Krabler@kuka.com \
--cc=Daniel.Braunwarth@kuka.com \
--cc=Dennis.Schimmel@kuka.com \
--cc=efault@gmx.de \
--cc=fvdl@google.com \
--cc=linux-mm@kvack.org \
--cc=linux-rt-users@vger.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