[bootlin/training-materials updates] master: kernel: locking: Enhance the description of atomic ops (15c8e03e)

Miquel Raynal miquel.raynal at bootlin.com
Thu Jun 2 10:54:21 CEST 2022


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/15c8e03ef31dd51b03fc620515ee113a55956f77

>---------------------------------------------------------------

commit 15c8e03ef31dd51b03fc620515ee113a55956f77
Author: Miquel Raynal <miquel.raynal at bootlin.com>
Date:   Wed Jun 1 18:00:47 2022 +0200

    kernel: locking: Enhance the description of atomic ops
    
    Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>


>---------------------------------------------------------------

15c8e03ef31dd51b03fc620515ee113a55956f77
 .../kernel-driver-development-concurrency.tex              | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/slides/kernel-driver-development-concurrency/kernel-driver-development-concurrency.tex b/slides/kernel-driver-development-concurrency/kernel-driver-development-concurrency.tex
index 4011157f..9254bd67 100644
--- a/slides/kernel-driver-development-concurrency/kernel-driver-development-concurrency.tex
+++ b/slides/kernel-driver-development-concurrency/kernel-driver-development-concurrency.tex
@@ -262,19 +262,14 @@ static unsigned int ulite_tx_empty(struct uart_port *port) {
 
 \begin{frame}[fragile]
   \frametitle{Atomic variables 1/2}
+  \mint{c}+#include <linux/atomic.h>+
   \begin{itemize}
   \item Useful when the shared resource is an integer value
   \item Even an instruction like \code{n++} is not guaranteed to be
     atomic on all processors!
-  \item Atomic operations definitions
-    \begin{itemize}
-    \item \mint{c}+#include <asm/atomic.h>+
-    \end{itemize}
-  \item \ksym{atomic_t}
-    \begin{itemize}
-    \item Contains a signed integer (at least 24 bits)
-    \end{itemize}
-  \item Atomic operations (main ones)
+  \item Ideal for RMW (Read-Modify-Write) operations
+  \item Main atomic operations on \ksym{atomic_t} (signed integer, at
+    least 24 bits):
     \begin{itemize}
     \item Set or read the counter:
       \begin{itemize}
@@ -317,6 +312,7 @@ static unsigned int ulite_tx_empty(struct uart_port *port) {
   \item Supply very fast, atomic operations
   \item On most platforms, apply to an \code{unsigned long *} type.
   \item Apply to a \code{void *} type on a few others.
+  \item Ideal for bitmaps or non-RMW counters
   \item Set, clear, toggle a given bit:
     \begin{itemize}
     \item \mint{c}+void set_bit(int nr, unsigned long *addr);+




More information about the training-materials-updates mailing list