[bootlin/training-materials updates] master: slides: change "int flags" to "gfp_t gfp_mask" (3c9fbcad)
Clément Léger
clement.leger at bootlin.com
Tue Mar 21 09:41:27 CET 2023
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/3c9fbcadf9d24b17a27fe2c8989e7b8274c9daf8
>---------------------------------------------------------------
commit 3c9fbcadf9d24b17a27fe2c8989e7b8274c9daf8
Author: Clément Léger <clement.leger at bootlin.com>
Date: Tue Mar 21 09:41:27 2023 +0100
slides: change "int flags" to "gfp_t gfp_mask"
Signed-off-by: Clément Léger <clement.leger at bootlin.com>
>---------------------------------------------------------------
3c9fbcadf9d24b17a27fe2c8989e7b8274c9daf8
.../debugging-linux-application-stack.tex | 8 ++++----
.../kernel-driver-development-memory.tex | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/slides/debugging-linux-application-stack/debugging-linux-application-stack.tex b/slides/debugging-linux-application-stack/debugging-linux-application-stack.tex
index cc0d9480..a23f1619 100644
--- a/slides/debugging-linux-application-stack/debugging-linux-application-stack.tex
+++ b/slides/debugging-linux-application-stack/debugging-linux-application-stack.tex
@@ -441,11 +441,11 @@ root 11 2 [rcu_tasks_kthread] TS
\begin{itemize}
\item Allocating memory in the kernel can be done using multiple functions:
\begin{itemize}
- \item \mint{c}+void *kmalloc(size_t size, int flags);+
- \item \mint{c}+void *kzalloc(size_t size, gfp_t flags);+
- \item \mint{c}+unsigned long __get_free_pages(int flags, unsigned int order)+
+ \item \mint{c}+void *kmalloc(size_t size, gfp_t gfp_mask);+
+ \item \mint{c}+void *kzalloc(size_t size, gfp_t gfp_mask);+
+ \item \mint{c}+unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order)+
\end{itemize}
- \item All allocation functions take a flags parameter which allows to
+ \item All allocation functions take a \code{gfp_mask} parameter which allows to
designate the kind of memory that is needed.
\begin{itemize}
\item \ksym{GFP_KERNEL}: Normal allocation, can sleep while allocating
diff --git a/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex b/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
index ca87fd2d..a3badc48 100644
--- a/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
+++ b/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
@@ -124,17 +124,17 @@
\begin{frame}[fragile]
\frametitle{Page allocator API: get free pages}
\begin{itemize}
- \item \mint{c}+unsigned long get_zeroed_page(int flags)+
+ \item \mint{c}+unsigned long get_zeroed_page(int gfp_mask)+
\begin{itemize}
\item Returns the virtual address of a free page, initialized to
zero
- \item \code{flags}: see the next pages for details.
+ \item \code{gfp_mask}: see the next pages for details.
\end{itemize}
- \item \mint{c}+unsigned long __get_free_page(int flags)+
+ \item \mint{c}+unsigned long __get_free_page(gfp_t gfp_mask)+
\begin{itemize}
\item Same, but doesn't initialize the contents
\end{itemize}
- \item \mint{c}+unsigned long __get_free_pages(int flags, unsigned int order)+
+ \item \mint{c}+unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order)+
\begin{itemize}
\item Returns the starting virtual address of an area of several
contiguous pages in physical RAM, with order being
@@ -265,7 +265,7 @@
\frametitle{kmalloc API 1/2}
\begin{itemize}
\item \mint{c}+#include <linux/slab.h>+
- \item \mint{c}+void *kmalloc(size_t size, int flags);+
+ \item \mint{c}+void *kmalloc(size_t size, gfp_t flags);+
\begin{itemize}
\item Allocate \code{size} bytes, and return a pointer to the area
(virtual address)
@@ -313,8 +313,8 @@ kfree(tprops);
Allocations with automatic freeing when the corresponding device or module is unprobed.
\begin{itemize}
\small
- \item \mint{c}+void *devm_kmalloc(struct device *dev, size_t size, int flags);+
- \item \mint{c}+void *devm_kzalloc(struct device *dev, size_t size, int flags);+
+ \item \mint{c}+void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);+
+ \item \mint{c}+void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);+
\item \mint{c}+void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_t flags);+
\item \mint{c}+void *devm_kfree(struct device *dev, void *p);+
Useful to immediately free an allocated buffer
More information about the training-materials-updates
mailing list