Skip to content

Commit 42d1e00

Browse files
authored
Merge pull request #325 from EricccTaiwan/fix-grammer-and-typo
Fix grammar and typos
2 parents 9e54fe1 + 8c48bbb commit 42d1e00

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lkmpg.tex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ \section{System Calls}
15751575
In this case, thanks to Kprobes, a hook can be used instead on the system call entry to intercept the system call.
15761576

15771577
Note that all the related problems make syscall stealing unfeasible for production use.
1578-
In order to keep people from doing potential harmful things \cpp|sys_call_table| is no longer exported.
1578+
In order to keep people from doing potentially harmful things \cpp|sys_call_table| is no longer exported.
15791579
This means, if you want to do something more than a mere dry run of this example, you will have to patch your current kernel in order to have \cpp|sys_call_table| exported.
15801580

15811581
\samplec{examples/syscall-steal.c}
@@ -1745,7 +1745,7 @@ \subsection{Spinlocks}
17451745
Sometimes you may find comments in kernel source code stating that a function ``may sleep'', ``might sleep'', or more explicitly ``the caller should not hold a spinlock''.
17461746
Those comments are hints that a function may implicitly sleep and must not be called in atomic contexts.
17471747

1748-
Now, let's differentiate between a few types of spinlock functions in Linux kernel: \cpp|spin_lock()|, \cpp|spin_lock_irq()|, \cpp|spin_lock_irqsave()|, and \cpp|spin_lock_bh()|.
1748+
Now, let's differentiate between a few types of spinlock functions in the Linux kernel: \cpp|spin_lock()|, \cpp|spin_lock_irq()|, \cpp|spin_lock_irqsave()|, and \cpp|spin_lock_bh()|.
17491749

17501750
\cpp|spin_lock()| does not allow the CPU to sleep while waiting for the lock, which makes it suitable for most use cases where the critical section is short.
17511751
However, this is problematic for real-time Linux because spinlocks in this configuration behave as sleeping locks.
@@ -1783,8 +1783,8 @@ \subsection{Atomic operations}
17831783

17841784
\samplec{examples/example_atomic.c}
17851785

1786-
Before the C11 standard adopts the built-in atomic types, the kernel already provided a small set of atomic types by using a bunch of tricky architecture-specific codes.
1787-
Implementing the atomic types by C11 atomics may allow the kernel to throw away the architecture-specific codes and letting the kernel code be more friendly to the people who understand the standard.
1786+
Before the C11 standard adopted the built-in atomic types, the kernel already provided a small set of atomic types by using a bunch of tricky architecture-specific codes.
1787+
Implementing the atomic types by C11 atomics may allow the kernel to throw away the architecture-specific codes and make the kernel code be more friendly to the people who understand the standard.
17881788
But there are some problems, such as the memory model of the kernel doesn't match the model formed by the C11 atomics.
17891789
For further details, see:
17901790
\begin{itemize}
@@ -2252,7 +2252,8 @@ \subsection{Likely and Unlikely conditions}
22522252

22532253
\subsection{Static keys}
22542254
\label{sec:static_keys}
2255-
Static keys allow us to enable or disable kernel code paths based on the runtime state of key. Its APIs have been available since 2010 (most architectures are already supported), use self-modifying code to eliminate the overhead of cache and branch prediction.
2255+
Static keys allow us to enable or disable kernel code paths based on the runtime state of a key.
2256+
Their APIs have been available since 2010 (most architectures are already supported) and use self-modifying code to eliminate the overhead of cache and branch prediction.
22562257
The most typical use case of static keys is for performance-sensitive kernel code, such as tracepoints, context switching, networking, etc. These hot paths of the kernel often contain branches and can be optimized easily using this technique.
22572258
Before we can use static keys in the kernel, we need to make sure that gcc supports \cpp|asm goto| inline assembly, and the following kernel configurations are set:
22582259

@@ -2305,7 +2306,7 @@ \subsection{Static keys}
23052306
For more information, see \href{https://www.kernel.org/doc/Documentation/static-keys.txt}{Static keys}
23062307

23072308
\section{Common Pitfalls}
2308-
\label{sec:opitfall}
2309+
\label{sec:pitfall}
23092310

23102311
\subsection{Using standard libraries}
23112312
\label{sec:using_stdlib}

0 commit comments

Comments
 (0)