[bootlin/training-materials updates] master: preempt-rt: More changes to the slides (a504bbdb)
Maxime Chevallier
maxime.chevallier at bootlin.com
Wed Jan 18 18:52:05 CET 2023
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/a504bbdbc84e6a50ff0bc2d5c89a55dd2455f5f5
>---------------------------------------------------------------
commit a504bbdbc84e6a50ff0bc2d5c89a55dd2455f5f5
Author: Maxime Chevallier <maxime.chevallier at bootlin.com>
Date: Wed Jan 18 18:51:12 2023 +0100
preempt-rt: More changes to the slides
Signed-off-by: Maxime Chevallier <maxime.chevallier at bootlin.com>
>---------------------------------------------------------------
a504bbdbc84e6a50ff0bc2d5c89a55dd2455f5f5
.../realtime-linux-application-development.tex | 3 ++-
.../realtime-linux-configuration.tex | 27 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/slides/realtime-linux-application-development/realtime-linux-application-development.tex b/slides/realtime-linux-application-development/realtime-linux-application-development.tex
index 18a05573..7670adee 100644
--- a/slides/realtime-linux-application-development/realtime-linux-application-development.tex
+++ b/slides/realtime-linux-application-development/realtime-linux-application-development.tex
@@ -192,11 +192,12 @@ pthread_attr_setschedparam(&attr, &parm);
\begin{frame}
\frametitle{Memory management}
\begin{itemize}
- \item Call \code{mlockall()} at init to lock all memory regions
+ \item Call \code{mlockall(MCL_CURRENT | MCL_FUTURE)} at init to lock all memory regions
\item Allocate all memory and access it at initialization
\item Don't call \code{fork()}, since the child will copy-on-write pages
\item Avoid using mmap'd memory, since ranges aren't reused after free
\item malloc's behaviour can be tuned not to use mmap : \code{mallopt(M_MMAP_MAX, 0)}
+ \item We also must configure malloc not to trim the allocated space : \code{mallopt(M_TRIM_THRESHOLD, -1)}
\end{itemize}
\end{frame}
diff --git a/slides/realtime-linux-configuration/realtime-linux-configuration.tex b/slides/realtime-linux-configuration/realtime-linux-configuration.tex
index 58b578e6..ff5f683b 100644
--- a/slides/realtime-linux-configuration/realtime-linux-configuration.tex
+++ b/slides/realtime-linux-configuration/realtime-linux-configuration.tex
@@ -48,6 +48,32 @@
\code{isolcpus=0,2,3}
\end{frame}
+\begin{frame}
+ \frametitle{CPU Isolation - cpusets}
+ \begin{itemize}
+ \item \code{cpuset} is a mechanism allowing to subdivide the CPU scheduling pool
+ \item They are created at runtime, through the \code{cpusetfs}
+ \begin{itemize}
+ \item \code{mount -t cpuset none /dev/cpuset}
+ \end{itemize}
+ \item cpusets are created at will in the cpuset main directory
+ \begin{itemize}
+ \item \code{mkdir /dev/cpuset/rt-set}
+ \item \code{mkdir /dev/cpuset/non-rt-set}
+ \end{itemize}
+ \item Each cpuset is assigned a pool of cpu cores
+ \begin{itemize}
+ \item \code{/bin/echo 2,3 > /dev/cpuset/rt-set}
+ \item \code{/bin/echo 0,1 > /dev/cpuset/non-rt-set}
+ \end{itemize}
+ \item We can then select which task gets to run in each cpuset
+ \begin{itemize}
+ \item \code{while read i; do /bin/echo $i; done < /dev/cpuset/tasks > /dev/cpuset/nontrt-set/tasks}
+ \item \code{/bin/echo $$ > /dev/cpuset/rt-set/tasks}
+ \end{itemize}
+ \end{itemize}
+\end{frame}
+
% irq assignment
\begin{frame}
\frametitle{IRQ affinity}
@@ -74,6 +100,7 @@
\item \code{/proc/sys/kernel/sched_rt_period_us} defines a window in microseconds that the scheduler will share between RT and non-RT tasks
\item \code{/proc/sys/kernel/sched_rt_runtime_us} defines how-much of that window is going to be dedicated to RT tasks.
\item The default values allocates 95\% of the CPU time to RT tasks
+ \item This mechanism is also called \textbf{RT Throttling}
\end{itemize}
\end{frame}
More information about the training-materials-updates
mailing list