Skip to content

Conversation

@jlelli
Copy link
Contributor

@jlelli jlelli commented Aug 29, 2025

Move lockpages before setscheduler. Add additional information for lockpages and setscheduler. Reset t_first right before changing scheduling policy so that timers (and in-kernel accounting) is not skewed.

jlelli added 3 commits August 29, 2025 12:37
- Move page locking (mlockall) to execute before setting thread parameters
- Remove forced 'data->lock_pages = 0' override for SCHED_IDLE tasks, as
  locking pages and scheduling policies are orthogonal and should be
  configured separately by the user
- This ensures page locking happens early in thread initialization

The change ensures that when lock_pages is enabled, memory pages
are locked before any scheduling policy changes occur, which is
important for real-time applications that need deterministic
memory access patterns. Especially for SCHED_DEADLINE, locking pages
after starting the first iteration might cause deadline misses.

Fixes: 5890dd3 ("rt-app: Reorder page locking to properly skip it for SCHED_OTHER/IDLE")
Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
So it's easier to understand when a task is actually ready for entering
the first actual phase.

Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Otherwise timers might be skewed.

Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
@vingu-linaro
Copy link
Member

The mlock reordering modifies (5890dd3). Locking pages whatever the scheduling policy makes sense to me but I'd like to know what @jan-kiszka thinks about it if it was only because of the data->lock_pages = 0

@jan-kiszka
Copy link
Contributor

In general, you don't need to lock pages before you actually start your workload - which might be much later than setting scheduling parameters.

But the essence here is that, if you only have non-RT threads, you should not be bothered with page locking by default. In turn, if there is an RT thread, locking should be turned on by default. Everything that achieves this can also perform the locking at any desired point during setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants