[bootlin/training-materials updates] master: kernel: memory: Update an example to use GFP_KERNEL instead of GFP_ATOMIC (0bd252de)
Miquel Raynal
miquel.raynal at bootlin.com
Tue Nov 16 17:20:56 CET 2021
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/0bd252de806ba7c0236ca360d08a44153043f1bd
>---------------------------------------------------------------
commit 0bd252de806ba7c0236ca360d08a44153043f1bd
Author: Miquel Raynal <miquel.raynal at bootlin.com>
Date: Tue Nov 16 17:20:51 2021 +0100
kernel: memory: Update an example to use GFP_KERNEL instead of GFP_ATOMIC
Most of the allocations should be done with GFP_KERNEL, unless there is
a real motivation to do them in some place where we cannot sleep so
let's change the example to show the most common situation.
Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
>---------------------------------------------------------------
0bd252de806ba7c0236ca360d08a44153043f1bd
.../kernel-driver-development-memory.tex | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 dff6a79f..9ea52e31 100644
--- a/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
+++ b/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
@@ -278,10 +278,10 @@
\end{itemize}
\item Example: (\kfile{drivers/infiniband/core/cache.c})
\begin{minted}{c}
-struct ib_update_work *work;
-work = kmalloc(sizeof(*work), GFP_ATOMIC);
+struct ib_port_attr *tprops;
+tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
...
-kfree(work);
+kfree(tprops);
\end{minted}
\end{itemize}
\end{frame}
More information about the training-materials-updates
mailing list