* [PATCH -perfbook 1/6] toolsoftrade, count, SMPdesign: Break and capitalize after colon
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
@ 2021-07-08 10:41 ` Akira Yokosawa
2021-07-08 10:42 ` [PATCH -perfbook 2/6] locking: " Akira Yokosawa
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-08 10:41 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
SMPdesign/SMPdesign.tex | 23 +++++++------
SMPdesign/beyond.tex | 19 ++++++-----
count/count.tex | 64 ++++++++++++++++++++---------------
toolsoftrade/toolsoftrade.tex | 31 +++++++++--------
4 files changed, 76 insertions(+), 61 deletions(-)
diff --git a/SMPdesign/SMPdesign.tex b/SMPdesign/SMPdesign.tex
index e6b967f7..edfe556c 100644
--- a/SMPdesign/SMPdesign.tex
+++ b/SMPdesign/SMPdesign.tex
@@ -15,8 +15,8 @@ high-performance solutions, while poorly partitioned problems result
in slow and complex solutions.
This chapter will help you design partitioning into your code, with
some discussion of batching and weakening as well.
-The word ``design'' is very important: You should partition first,
-batch second, weaken third, and code fourth.
+The word ``design'' is very important:
+You should partition first, batch second, weaken third, and code fourth.
Changing this order often leads to poor performance and scalability
along with great frustration.\footnote{
That other great dodge around the Laws of Physics, read-only
@@ -705,8 +705,9 @@ The 512-by-512 matrix multiply's efficiency is measurably less
than 1.0 on as few as 10 threads, and even the 1024-by-1024 matrix
multiply deviates noticeably from perfection at a few tens of threads.
Nevertheless, this figure clearly demonstrates the performance and
-scalability benefits of batching: If you must incur synchronization
-overhead, you may as well get your money's worth.
+scalability benefits of batching:
+If you must incur synchronization overhead, you may as well get your
+money's worth.
\QuickQuiz{
How can a single-threaded 64-by-64 matrix multiple possibly
@@ -754,7 +755,8 @@ or the parallel-fastpath approach discussed in the next section.
scalability, but by that point GPGPUs become quite attractive,
especially from a price/performance viewpoint.
- Moral: If you have a parallel program with variable input,
+ Moral:
+ If you have a parallel program with variable input,
always include a check for the input size being too small to
be worth parallelizing.
And when it is not helpful to parallelize, it is not helpful
@@ -764,8 +766,8 @@ or the parallel-fastpath approach discussed in the next section.
\section{Parallel Fastpath}
\label{sec:SMPdesign:Parallel Fastpath}
%
-\epigraph{There are two ways of meeting difficulties: You alter the
- difficulties, or you alter yourself to meet them.}
+\epigraph{There are two ways of meeting difficulties:
+ You alter the difficulties, or you alter yourself to meet them.}
{\emph{Phyllis Bottome}}
Fine-grained (and therefore \emph{usually} higher-performance)
@@ -882,7 +884,7 @@ to acquire.
\Cref{lst:SMPdesign:Hierarchical-Locking Hash Table Search}
shows how our hash-table search might be adapted to do hierarchical
locking, but also shows the great weakness of this approach:
-we have paid the overhead of acquiring a second lock, but we only
+We have paid the overhead of acquiring a second lock, but we only
hold it for a short time.
In this case, the simpler data-locking approach would be simpler
and likely perform better.
@@ -989,7 +991,7 @@ we place a limit on the number of blocks that can be in each CPU's
cache.
In a two-CPU system, the flow of memory blocks will be as shown
in \cref{fig:SMPdesign:Allocator Cache Schematic}:
-when a given CPU is trying to free a block when its pool is full,
+When a given CPU is trying to free a block when its pool is full,
it sends blocks to the global pool, and, similarly, when that CPU
is trying to allocate a block when its pool is empty, it retrieves
blocks from the global pool.
@@ -1192,7 +1194,8 @@ this book.
where each thread repeatedly first allocates $m$ blocks of memory
and then frees those $m$ blocks, how large must the global pool
size be?
- \emph{Note:} Obtaining the correct answer will require you to
+ \emph{Note:}
+ Obtaining the correct answer will require you to
examine the \path{smpalloc.c} source code, and very likely
single-step it as well.
You have been warned!
diff --git a/SMPdesign/beyond.tex b/SMPdesign/beyond.tex
index 35bdd92f..60aeed12 100644
--- a/SMPdesign/beyond.tex
+++ b/SMPdesign/beyond.tex
@@ -393,7 +393,8 @@ Although the algorithms were in fact finding valid solutions, the
plot of CDFs in
\cref{fig:SMPdesign:CDF of Solution Times For SEQ; PWQ; and PART}
assumes independent data points.
-This is not the case: The performance tests randomly generate a maze,
+This is not the case:
+The performance tests randomly generate a maze,
and then run all solvers on that maze.
It therefore makes sense to plot the CDF of the ratios of
solution times for each generated maze,
@@ -407,9 +408,9 @@ two times faster than SEQ\@.
A forty-times speedup on two threads demands explanation.
After all, this is not merely embarrassingly parallel, where partitionability
means that adding threads does not increase the overall computational cost.
-It is instead \emph{\IX{humiliatingly parallel}}: Adding threads
-significantly reduces the overall computational cost, resulting in
-large algorithmic superlinear speedups.
+It is instead \emph{\IX{humiliatingly parallel}}:
+Adding threads significantly reduces the overall computational cost,
+resulting in large algorithmic superlinear speedups.
\begin{figure}
\centering
@@ -527,9 +528,9 @@ parallelism via co-routines, for example, manually switching context
between threads on each pass through the main do-while loop in
\cref{lst:SMPdesign:Partitioned Parallel Solver Pseudocode}.
This context switching is straightforward because the context
-consists only of the variables \co{c} and \co{vi}: Of the numerous
-ways to achieve the effect, this is a good tradeoff between
-context-switch overhead and visit percentage.
+consists only of the variables \co{c} and \co{vi}:
+Of the numerous ways to achieve the effect, this is a good tradeoff
+between context-switch overhead and visit percentage.
As can be seen in
\cref{fig:SMPdesign:Partitioned Coroutines},
this coroutine algorithm (COPART) is quite effective, with the performance
@@ -596,8 +597,8 @@ interval for seven and eight threads.
The reasons for the peak at two threads are (1) the lower complexity
of termination detection in the two-thread case and (2) the fact that
there is a lower probability of the third and subsequent threads making
-useful forward progress: Only the first two threads are guaranteed to start on
-the solution line.
+useful forward progress:
+Only the first two threads are guaranteed to start on the solution line.
This disappointing performance compared to results in
\cref{fig:SMPdesign:Varying Maze Size vs. COPART}
is due to the less-tightly integrated hardware available in the
diff --git a/count/count.tex b/count/count.tex
index ca20dbac..afe0539b 100644
--- a/count/count.tex
+++ b/count/count.tex
@@ -42,10 +42,10 @@ counting.
a systems-monitoring package reads the count every five seconds.
How would you implement this counter?
}\EQuickQuizAnswer{
- Hint: The act of updating the counter must be blazingly
- fast, but because the counter is read out only about once
- in five million updates, the act of reading out the counter can be
- quite slow.
+ Hint:
+ The act of updating the counter must be blazingly fast, but
+ because the counter is read out only about once in five million
+ updates, the act of reading out the counter can be quite slow.
In addition, the value read out normally need not be all that
accurate---after all, since the counter is updated a thousand
times per millisecond, we should be able to work with a value
@@ -71,7 +71,8 @@ counting.
limit is rarely exceeded, and a ``sloppy'' approximate limit
is acceptable.
}\EQuickQuizAnswer{
- Hint: The act of updating the counter must again be blazingly
+ Hint:
+ The act of updating the counter must again be blazingly
fast, but the counter is read out each time that the
counter is increased.
However, the value read out need not be accurate
@@ -97,7 +98,8 @@ counting.
that is not required unless there is at least one structure
in use.
}\EQuickQuizAnswer{
- Hint: The act of updating the counter must once again be blazingly
+ Hint:
+ The act of updating the counter must once again be blazingly
fast, but the counter is read out each time that the
counter is increased.
However, the value read out need not be accurate
@@ -118,7 +120,8 @@ counting.
As usual, the user indicates a desire to remove the device, and
the system tells the user when it is safe to do so.
}\EQuickQuizAnswer{
- Hint: Yet again, the act of updating the counter must be blazingly
+ Hint:
+ Yet again, the act of updating the counter must be blazingly
fast and scalable in order to avoid slowing down I/O operations,
but because the counter is read out only when the
user wishes to remove the device, the counter read-out
@@ -190,8 +193,8 @@ This approach has the additional advantage of being blazingly fast if
you are doing lots of reading and almost no incrementing, and on small
systems, the performance is excellent.
-There is just one large fly in the ointment: this approach can lose
-counts.
+There is just one large fly in the ointment:
+This approach can lose counts.
On my six-core x86 laptop, a short run invoked \co{inc_count()}
285,824,000 times, but the final value of the counter was only
35,385,525.
@@ -270,7 +273,8 @@ as shown in
\clnref{read} reads it out.
\end{fcvref}
Because this is atomic, it keeps perfect count.
-However, it is slower: on my six-core x86 laptop, it is more than
+However, it is slower:
+On my six-core x86 laptop, it is more than
twenty times slower than non-atomic increment, even
when only a single thread is incrementing.\footnote{
Interestingly enough, non-atomically incrementing a counter will
@@ -291,9 +295,9 @@ gets slower as the number of CPUs and threads increase, as shown in
\cref{fig:count:Atomic Increment Scalability on x86}.
In this figure, the horizontal dashed line resting on the x~axis
is the ideal performance that would be achieved
-by a perfectly scalable algorithm: with such an algorithm, a given
-increment would incur the same overhead that it would in a single-threaded
-program.
+by a perfectly scalable algorithm:
+With such an algorithm, a given increment would incur the same
+overhead that it would in a single-threaded program.
Atomic increment of a single global variable is clearly
decidedly non-ideal, and gets multiple orders of magnitude worse with
additional CPUs.
@@ -929,7 +933,8 @@ variables vanish when that thread exits.
Analysis of this code is left as an exercise to the reader,
however, please note that it requires tweaks in the
\path{counttorture.h} counter-evaluation scheme.
- (Hint: See \co{#ifndef KEEP_GCC_THREAD_LOCAL}.)
+ (Hint:
+ See \co{#ifndef KEEP_GCC_THREAD_LOCAL}.)
\Cref{chp:Deferred Processing} will introduce
synchronization mechanisms that handle this situation in a much
more graceful manner.
@@ -952,8 +957,8 @@ return a value between the value that an ideal counter would have
taken on near the beginning of \co{read_count()}'s execution and
that near the end of \co{read_count()}'s execution.
\emph{Eventual consistency}~\cite{WernerVogels:2009:EventuallyConsistent}
-provides a weaker
-guarantee: in absence of calls to \co{inc_count()}, calls to
+provides a weaker guarantee:
+In absence of calls to \co{inc_count()}, calls to
\co{read_count()} will eventually return an accurate count.
We exploit eventual consistency by maintaining a global counter.
@@ -1729,10 +1734,12 @@ thread~0 can once again increment the counter locally.
(again, one eighth) to come from the remaining count.
There are two purposes for taking this approach:
- (1)~To allow thread~0 to use the fastpath for decrements as
+ \begin{enumerate*}[(1)]
+ \item To allow thread~0 to use the fastpath for decrements as
well as increments, and
- (2)~To reduce the inaccuracies if all threads are monotonically
+ \item To reduce the inaccuracies if all threads are monotonically
incrementing up towards the limit.
+ \end{enumerate*}
To see this last point, step through the algorithm and watch
what it does.
}\QuickQuizEnd
@@ -1818,9 +1825,9 @@ with the addition of
\subsection{Approximate Limit Counter Discussion}
These changes greatly reduce the limit inaccuracy seen in the previous version,
-but present another problem: any given value of \co{MAX_COUNTERMAX}
-will cause a workload-dependent fraction of accesses to fall off the
-fastpath.
+but present another problem:
+Any given value of \co{MAX_COUNTERMAX} will cause a workload-dependent
+fraction of accesses to fall off the fastpath.
As the number of threads increase, non-fastpath execution will become both
a performance and a scalability problem.
However, we will defer this problem and turn instead to counters
@@ -2636,7 +2643,8 @@ systems, given their slow atomic instructions, but the old 80386-based
Sequent Symmetry systems would do much better with the shorter path
length of the atomic implementation.
However, this increased update-side performance comes at the
-prices of higher read-side overhead: Those POSIX signals are not free.
+prices of higher read-side overhead:
+Those POSIX signals are not free.
If ultimate performance is of the essence, you will need to measure
them both on the system that your application is to be deployed on.
@@ -2656,7 +2664,7 @@ them both on the system that your application is to be deployed on.
}\QuickQuizEnd
This is but one reason why high-quality APIs are so important:
-they permit implementations to be changed as required by ever-changing
+They permit implementations to be changed as required by ever-changing
hardware performance characteristics.
\QuickQuiz{
@@ -3174,8 +3182,8 @@ Summarizing the summary:
All the algorithms shown in
\cref{tab:count:Statistical/Limit Counter Performance on x86}
make heavy use of batching.
-\item Read-only code paths should remain read-only: Spurious
- synchronization writes to shared memory kill performance
+\item Read-only code paths should remain read-only:
+ Spurious synchronization writes to shared memory kill performance
and scalability, as seen in the \path{count_end.c} row of
\cref{tab:count:Statistical/Limit Counter Performance on x86}.
\item Judicious use of delay promotes performance and scalability, as
@@ -3190,9 +3198,9 @@ Summarizing the summary:
algorithm and data-structure design, as do a large number of
other factors.
\Cref{fig:count:Atomic Increment Scalability on x86}
- illustrates this point: Atomic increment might be completely
- acceptable for a two-CPU system, but be completely inadequate for an
- eight-CPU system.
+ illustrates this point:
+ Atomic increment might be completely acceptable for a two-CPU
+ system, but be completely inadequate for an eight-CPU system.
\end{enumerate}
\begin{figure}
diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
index 77c956f7..c011f5e2 100644
--- a/toolsoftrade/toolsoftrade.tex
+++ b/toolsoftrade/toolsoftrade.tex
@@ -68,7 +68,7 @@ shell to run the two instances of the program in the background.
\end{fcvref}
The resulting execution is as shown in
\cref{fig:toolsoftrade:Execution Diagram for Parallel Shell Execution}:
-the two instances of \co{compute_it} execute in parallel,
+The two instances of \co{compute_it} execute in parallel,
\co{wait} completes after both of them do, and then the two instances
of \co{cat} execute sequentially.
% @@@ Maui scheduler, load balancing, BOINC, and so on.
@@ -819,14 +819,15 @@ rights to assume that the value of \co{goflag} would never change.
}\QuickQuizAnswerM{
No, memory barriers are not needed and won't help here.
Memory barriers only enforce ordering among multiple memory
- references: They absolutely do not guarantee to expedite the
- propagation of data from one part of the system to another.\footnote{
+ references:
+ They absolutely do not guarantee to expedite the propagation
+ of data from one part of the system to another.\footnote{
There have been persistent rumors of hardware in which
memory barriers actually do expedite propagation of data,
but no confirmed sightings.}
- This leads to a quick rule of thumb: You do not need
- memory barriers unless you are using more than one
- variable to communicate between multiple threads.
+ This leads to a quick rule of thumb:
+ You do not need memory barriers unless you are using more
+ than one variable to communicate between multiple threads.
But what about \co{nreadersrunning}?
Isn't that a second variable used for communication?
@@ -1940,10 +1941,11 @@ This transforms the if-then-else into an if-then, saving one branch.
Thankfully, the answer is no.
This is because the compiler is forbidden from introducing data races.
The case of inventing a store just before a normal store is
- quite special: It is not possible for some other entity,
- be it CPU, thread, signal handler, or interrupt handler, to be
- able to see the invented store unless the code already has
- a data race, even without the invented store.
+ quite special:
+ It is not possible for some other entity, be it CPU, thread,
+ signal handler, or interrupt handler, to be able to see the
+ invented store unless the code already has a data race, even
+ without the invented store.
And if the code already has a data race, it already invokes
the dreaded spectre of undefined behavior, which allows the
compiler to generate pretty much whatever code it wants,
@@ -2035,9 +2037,9 @@ concurrent code to act in surprising ways.
Experience thus far indicates that relatively few such surprises will
be at all pleasant.
Elimination of store-only variables is especially dangerous in cases
-where external code locates the variable via symbol tables: The
-compiler is necessarily ignorant of such external-code accesses, and
-might thus eliminate a variable that the external code relies upon.
+where external code locates the variable via symbol tables:
+The compiler is necessarily ignorant of such external-code accesses,
+and might thus eliminate a variable that the external code relies upon.
Reliable concurrent code clearly needs a way to cause the compiler to
preserve the number, order, and type of important accesses to shared
@@ -2592,7 +2594,8 @@ but per-thread variables combine convenience and high performance,
as will be shown in more detail in
\cref{sec:count:Statistical Counters}.
-\section{The Right Tool for the Job: How to Choose?}
+\section{The Right Tool for the Job:
+ How to Choose?}
\label{sec:toolsoftrade:The Right Tool for the Job: How to Choose?}
%
\epigraph{If you get stuck, change your tools; it may free your thinking.}
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH -perfbook 2/6] locking: Break and capitalize after colon
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
2021-07-08 10:41 ` [PATCH -perfbook 1/6] toolsoftrade, count, SMPdesign: Break and capitalize after colon Akira Yokosawa
@ 2021-07-08 10:42 ` Akira Yokosawa
2021-07-08 10:43 ` [PATCH -perfbook 3/6] defer: " Akira Yokosawa
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-08 10:42 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
locking/locking-existence.tex | 4 +-
locking/locking.tex | 98 ++++++++++++++++++++---------------
2 files changed, 58 insertions(+), 44 deletions(-)
diff --git a/locking/locking-existence.tex b/locking/locking-existence.tex
index 86aeace7..feb18464 100644
--- a/locking/locking-existence.tex
+++ b/locking/locking-existence.tex
@@ -79,8 +79,8 @@ bugs involving implicit existence guarantees really can happen.
}\QuickQuizEnd
But the more interesting---and troublesome---guarantee involves
-heap memory: A dynamically allocated data structure will exist until it
-is freed.
+heap memory:
+A dynamically allocated data structure will exist until it is freed.
The problem to be solved is to synchronize the freeing of the structure
with concurrent accesses to that same structure.
One way to do this is with \emph{explicit guarantees}, such as locking.
diff --git a/locking/locking.tex b/locking/locking.tex
index 8f19797d..580d8766 100644
--- a/locking/locking.tex
+++ b/locking/locking.tex
@@ -80,14 +80,16 @@ more serious sins.
\begin{figure}
\centering
\resizebox{2in}{!}{\includegraphics{cartoons/r-2014-Locking-the-Slob}}
-\caption{Locking: Villain or Slob?}
+\caption{Locking:
+ Villain or Slob?}
\ContributedBy{Figure}{fig:locking:Locking: Villain or Slob?}{Melissa Broussard}
\end{figure}
\begin{figure}
\centering
\resizebox{2in}{!}{\includegraphics{cartoons/r-2014-Locking-the-Hero}}
-\caption{Locking: Workhorse or Hero?}
+\caption{Locking:
+ Workhorse or Hero?}
\ContributedBy{Figure}{fig:locking:Locking: Workhorse or Hero?}{Melissa Broussard}
\end{figure}
@@ -176,7 +178,7 @@ that one of the threads be killed or that a lock be forcibly stolen from
one of the threads.
This killing and forcible stealing works well for transactions,
but is often problematic for kernel and application-level use of locking:
-dealing with the resulting partially updated structures can be extremely
+Dealing with the resulting partially updated structures can be extremely
complex, hazardous, and error-prone.
Therefore, kernels and applications should instead avoid deadlocks.
@@ -397,8 +399,8 @@ the third containing Lock~D\@.
Please note that it is not typically possible to mechanically
change \co{cmp()} to use the new Lock~D\@.
-Quite the opposite: It is often necessary to make profound design-level
-modifications.
+Quite the opposite:
+It is often necessary to make profound design-level modifications.
Nevertheless, the effort required for such modifications is normally
a small price to pay in order to avoid deadlock.
More to the point, this potential deadlock should preferably be detected
@@ -666,10 +668,10 @@ In an important special case of conditional locking, all needed
locks are acquired before any processing is carried out, where
the needed locks might be identified by hashing the addresses
of the data structures involved.
-In this case, processing need not be idempotent: if it turns out
-to be impossible to acquire a given lock without first releasing
-one that was already acquired, just release all the locks and
-try again.
+In this case, processing need not be idempotent:
+If it turns out to be impossible to acquire a given lock without
+first releasing one that was already acquired, just release all
+the locks and try again.
Only once all needed locks are held will any processing be carried out.
However, this procedure can result in \emph{livelock}, which will
@@ -814,8 +816,9 @@ There are a large number of deadlock-avoidance strategies available to
the shared-memory parallel programmer, but there are sequential
programs for which none of them is a good fit.
This is one of the reasons that expert programmers have more than
-one tool in their toolbox: locking is a powerful concurrency
-tool, but there are jobs better addressed with other tools.
+one tool in their toolbox:
+Locking is a powerful concurrency tool, but there are jobs better
+addressed with other tools.
\QuickQuiz{
Given an object-oriented application that passes control freely
@@ -1035,8 +1038,8 @@ retry, as shown in
normally be in the microsecond or millisecond range.
\item The code does not check for overflow.
On the other hand, this bug is nullified
- by the previous bug: 32 bits worth of seconds is
- more than 50 years.
+ by the previous bug:
+ 32 bits worth of seconds is more than 50 years.
\end{enumerate}
}\QuickQuizEnd
@@ -1101,9 +1104,9 @@ and often involve cache misses.
As we saw in \cref{chp:Hardware and its Habits},
these instructions are quite expensive, roughly two
orders of magnitude greater overhead than simple instructions.
-This can be a serious problem for locking: If you protect a single
-instruction with a lock, you will increase the overhead by a factor
-of one hundred.
+This can be a serious problem for locking:
+If you protect a single instruction with a lock, you will increase
+the overhead by a factor of one hundred.
Even assuming perfect scalability, \emph{one hundred} CPUs would
be required to keep up with a single CPU executing the same code
without locking.
@@ -1158,8 +1161,8 @@ and scoped locking (\cref{sec:locking:Scoped Locking}).
\subsection{Exclusive Locks}
\label{sec:locking:Exclusive Locks}
-\IXhpl{Exclusive}{lock} are what they say they are: only one thread may hold
-the lock at a time.
+\IXhpl{Exclusive}{lock} are what they say they are:
+Only one thread may hold the lock at a time.
The holder of such a lock thus has exclusive access to all data protected
by that lock, hence the name.
@@ -1178,9 +1181,12 @@ when needed rests with the developer.
Empty lock-based critical sections are rarely used, but they
do have their uses.
The point is that the semantics of exclusive locks have two
- components: (1)~the familiar data-protection semantic and
- (2)~a messaging semantic, where releasing a given lock notifies
+ components:
+ \begin{enumerate*}[(1)]
+ \item The familiar data-protection semantic and
+ \item A messaging semantic, where releasing a given lock notifies
a waiting acquisition of that same lock.
+ \end{enumerate*}
An empty critical section uses the messaging component without
the data-protection component.
@@ -1218,9 +1224,9 @@ when needed rests with the developer.
For example, each thread might correspond to one user of the
application, and thus be removed when that user logs out or
otherwise disconnects.
- In many applications, threads cannot depart atomically: They must
- instead explicitly unravel themselves from various portions of
- the application using a specific sequence of actions.
+ In many applications, threads cannot depart atomically:
+ They must instead explicitly unravel themselves from various
+ portions of the application using a specific sequence of actions.
One specific action will be refusing to accept further requests
from other threads, and another specific action will be disposing
of any remaining units of work on its list, for example, by
@@ -1319,8 +1325,10 @@ when needed rests with the developer.
It is important to note that unconditionally acquiring an exclusive lock
has two effects:
-(1)~Waiting for all prior holders of that lock to release it, and
-(2)~Blocking any other acquisition attempts until the lock is released.
+\begin{enumerate*}[(1)]
+\item Waiting for all prior holders of that lock to release it, and
+\item Blocking any other acquisition attempts until the lock is released.
+\end{enumerate*}
As a result, at lock acquisition time, any concurrent acquisitions of
that lock must be partitioned into prior holders and subsequent
holders.
@@ -1369,8 +1377,8 @@ implementation.
The classic reader-writer lock implementation involves a set of
counters and flags that are manipulated atomically.
This type of implementation suffers from the same problem as does
-exclusive locking for short critical sections: The overhead of acquiring
-and releasing the lock
+exclusive locking for short critical sections:
+The overhead of acquiring and releasing the lock
is about two orders of magnitude greater than the overhead
of a simple instruction.
Of course, if the critical section is long enough, the overhead of
@@ -1478,9 +1486,9 @@ of scalable high-performance special-purpose alternatives to locking.
\label{tab:locking:VAX/VMS Distributed Lock Manager Policy}
\end{table}
-Reader-writer locks and exclusive locks differ in their admission
-policy: exclusive locks allow at most one holder, while reader-writer
-locks permit an arbitrary number of read-holders (but only one write-holder).
+Reader-writer locks and exclusive locks differ in their admission policy:
+Exclusive locks allow at most one holder, while reader-writer locks
+permit an arbitrary number of read-holders (but only one write-holder).
There is a very large number of possible admission policies, one of
which is that of the VAX/VMS distributed lock
manager (DLM)~\cite{Snaman87}, which is shown in
@@ -1892,9 +1900,9 @@ location, including both test-and-set locks and ticket locks,
suffer from performance problems at high contention levels.
The problem is that the thread releasing the lock must update the
value of the corresponding memory location.
-At low contention, this is not a problem: The corresponding cache line
-is very likely still local to and writeable by the thread holding
-the lock.
+At low contention, this is not a problem:
+The corresponding cache line is very likely still local to and
+writeable by the thread holding the lock.
In contrast, at high levels of contention, each thread attempting to
acquire the lock will have a read-only copy of the \IX{cache line}, and
the lock holder will need to invalidate all such copies before it
@@ -2083,7 +2091,8 @@ roll-your-own efforts is that the standard primitives are typically
\input{locking/locking-existence}
-\section{Locking: Hero or Villain?}
+\section{Locking:
+ Hero or Villain?}
\label{sec:locking:Locking: Hero or Villain?}
%
\epigraph{You either die a hero or you live long enough to see yourself
@@ -2098,7 +2107,8 @@ parallelizing existing sequential libraries are extremely unhappy.
The following sections discuss some reasons for these differences in
viewpoints.
-\subsection{Locking For Applications: Hero!}
+\subsection{Locking For Applications:
+ Hero!}
\label{sec:locking:Locking For Applications: Hero!}
When writing an entire application (or entire kernel), developers have
@@ -2128,7 +2138,8 @@ Given careful design, use of a good combination of synchronization
mechanisms, and good tooling, locking works quite well for applications
and kernels.
-\subsection{Locking For Parallel Libraries: Just Another Tool}
+\subsection{Locking For Parallel Libraries:
+ Just Another Tool}
\label{sec:locking:Locking For Parallel Libraries: Just Another Tool}
Unlike applications and kernels, the designer of a library cannot
@@ -2287,11 +2298,12 @@ yourself a favor by looking into alternative designs first.
\label{sec:locking:Explicitly Avoid Callback Deadlocks}
The basic rule behind this strategy was discussed in
-\cref{sec:locking:Local Locking Hierarchies}: ``Release all
-locks before invoking unknown code.''
+\cref{sec:locking:Local Locking Hierarchies}:
+``Release all locks before invoking unknown code.''
This is usually the best approach because it allows the application to
-ignore the library's locking hierarchy: the library remains a leaf or
-isolated subtree of the application's overall locking hierarchy.
+ignore the library's locking hierarchy:
+The library remains a leaf or isolated subtree of the application's
+overall locking hierarchy.
In cases where it is not possible to release all locks before invoking
unknown code, the layered locking hierarchies described in
@@ -2382,7 +2394,8 @@ in general.
The cases where \co{pthread_atfork()} works best are cases where the data structure
in question can simply be re-initialized by the child.
-\subsubsection{Parallel Libraries: Discussion}
+\subsubsection{Parallel Libraries:
+ Discussion}
\label{sec:locking:Parallel Libraries: Discussion}
Regardless of the strategy used, the description of the library's API
@@ -2391,7 +2404,8 @@ should interact with that strategy.
In short, constructing parallel libraries using locking is possible,
but not as easy as constructing a parallel application.
-\subsection{Locking For Parallelizing Sequential Libraries: Villain!}
+\subsection{Locking For Parallelizing Sequential Libraries:
+ Villain!}
\label{sec:locking:Locking For Parallelizing Sequential Libraries: Villain!}
With the advent of readily available low-cost multicore systems,
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH -perfbook 3/6] defer: Break and capitalize after colon
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
2021-07-08 10:41 ` [PATCH -perfbook 1/6] toolsoftrade, count, SMPdesign: Break and capitalize after colon Akira Yokosawa
2021-07-08 10:42 ` [PATCH -perfbook 2/6] locking: " Akira Yokosawa
@ 2021-07-08 10:43 ` Akira Yokosawa
2021-07-08 10:44 ` [PATCH -perfbook 4/6] count: Remove Oxford comma in two-item enumeration list Akira Yokosawa
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-08 10:43 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/hazptr.tex | 9 +++++----
defer/rcufundamental.tex | 29 ++++++++++++++++-------------
defer/rcuintro.tex | 6 ++++--
defer/rcuusage.tex | 34 +++++++++++++++++++++-------------
defer/seqlock.tex | 12 ++++++++----
defer/whichtochoose.tex | 19 ++++++++++++-------
6 files changed, 66 insertions(+), 43 deletions(-)
diff --git a/defer/hazptr.tex b/defer/hazptr.tex
index 47acb0ac..08e133dc 100644
--- a/defer/hazptr.tex
+++ b/defer/hazptr.tex
@@ -96,9 +96,9 @@ invocations, \clnref{htr:race2} indicates failure.
element.
}\QuickQuizEnd
-The \co{hp_record()} function is quite straightforward: It repeatedly
-invokes \co{hp_try_record()} until the return value is something other
-than \co{HAZPTR_POISON}.
+The \co{hp_record()} function is quite straightforward:
+It repeatedly invokes \co{hp_try_record()} until the return value
+is something other than \co{HAZPTR_POISON}.
\QuickQuiz{
Why bother with \co{hp_try_record()}?
@@ -361,7 +361,8 @@ and in other publications~\cite{ThomasEHart2007a,McKenney:2013:SDS:2483852.24838
}\QuickQuizEndB
%
\QuickQuizE{
- The paper ``Structured Deferral: Synchronization via
+ The paper ``Structured Deferral:
+ Synchronization via
Procrastination''~\cite{McKenney:2013:SDS:2483852.2483867}
shows that hazard pointers have near-ideal performance.
Whatever happened in
diff --git a/defer/rcufundamental.tex b/defer/rcufundamental.tex
index 7435b885..0378b673 100644
--- a/defer/rcufundamental.tex
+++ b/defer/rcufundamental.tex
@@ -94,9 +94,9 @@ mechanism will be required to mediate among multiple concurrent
In the Linux kernel, locking is the mechanism of choice, but pretty
much any synchronization mechanism may be used.
An example of a particularly lightweight synchronization mechanism is
-\cref{chp:Data Ownership}'s data ownership: If each pointer is
-owned by a particular thread, then that thread may execute
-\co{rcu_assign_pointer()} on that pointer with no additional
+\cref{chp:Data Ownership}'s data ownership:
+If each pointer is owned by a particular thread, then that thread may
+execute \co{rcu_assign_pointer()} on that pointer with no additional
synchronization overhead.
\QuickQuiz{
@@ -298,12 +298,14 @@ This would mean that an RCU read-side critical section had completely
overlapped a grace period, which is forbidden (or at the very least
constitutes a bug in RCU).
RCU's wait-for-readers guarantee therefore has two parts:
-(1)~If any part of a given RCU read-side critical section precedes
+\begin{enumerate*}[(1)]
+\item If any part of a given RCU read-side critical section precedes
the beginning of a given grace period, then the entirety of that
critical section precedes the end of that grace period.
-(2)~If any part of a given RCU read-side critical section follows
+\item If any part of a given RCU read-side critical section follows
the end of a given grace period, then the entirety of that
critical section follows the beginning of that grace period.
+\end{enumerate*}
This definition is sufficient for almost all RCU-based algorithms, but
for those wanting more,
simple executable formal models of RCU are available
@@ -434,8 +436,8 @@ way get a valid result.
Of course, a closer look at
\cref{fig:defer:Insertion With Concurrent Readers}
shows that calls to \co{ins_route()} can also result in concurrent
-readers seeing different versions: Either the initial empty list
-or the newly inserted \co{route} structure.
+readers seeing different versions:
+Either the initial empty list or the newly inserted \co{route} structure.
Note that both reference counting
(\cref{sec:defer:Reference Counting})
and hazard pointers
@@ -535,9 +537,10 @@ and with increasing use of hazard pointers in other projects, demonstrates
that tolerance for such inconsistencies is more common than one might
imagine.
This is especially the case given that single-item lookups are much more
-common than traversals: After all, (1)~concurrent updates are less likely
-to affect a single-item lookup than they are a full traversal, and
-(2)~an isolated single-item lookup cannot detect such inconsistencies.
+common than traversals:
+After all, (1)~concurrent updates are less likely to affect a single-item
+lookup than they are a full traversal, and (2)~an isolated single-item
+lookup cannot detect such inconsistencies.
From a more theoretical viewpoint, there are even some special cases where
RCU readers can be considered to be fully ordered with updaters, despite
@@ -661,13 +664,13 @@ This section has described the three fundamental components of RCU-based
algorithms:
\begin{enumerate}
-\item a publish-subscribe mechanism for adding new data,
+\item A publish-subscribe mechanism for adding new data,
-\item a way of waiting for pre-existing RCU readers to finish
+\item A way of waiting for pre-existing RCU readers to finish
(see \cref{sec:memorder:RCU} for more detail),
and
-\item a discipline of maintaining multiple versions to permit
+\item A discipline of maintaining multiple versions to permit
change without harming or unduly delaying concurrent RCU readers.
\end{enumerate}
diff --git a/defer/rcuintro.tex b/defer/rcuintro.tex
index a3c9cc58..9b327afa 100644
--- a/defer/rcuintro.tex
+++ b/defer/rcuintro.tex
@@ -302,7 +302,8 @@ This is a classic deadlock situation, and this \IX{deadlock} is avoided
by forbidding blocking while holding a spinlock.
Again, this same constraint is imposed on reader threads dereferencing
-\co{gptr}: such threads are not allowed to block until after
+\co{gptr}:
+Such threads are not allowed to block until after
they are done using the pointed-to data item.
Returning to the second row of
\cref{fig:defer:Deletion With Concurrent Readers},
@@ -322,7 +323,8 @@ state shown at the bottom of
\begin{figure}
\centering
\resizebox{3in}{!}{\includegraphics{defer/QSBRGracePeriod}}
-\caption{QSBR: Waiting for Pre-Existing Readers}
+\caption{QSBR\@:
+ Waiting for Pre-Existing Readers}
\label{fig:defer:QSBR: Waiting for Pre-Existing Readers}
\end{figure}
diff --git a/defer/rcuusage.tex b/defer/rcuusage.tex
index b3d79d13..0e5ad511 100644
--- a/defer/rcuusage.tex
+++ b/defer/rcuusage.tex
@@ -637,7 +637,8 @@ harmless, including use of the asynchronous interfaces where available
is a major reason for the rule of thumb that RCU be used in read-mostly
situations.
-\paragraph{Code: Reader-Writer Locking vs.\@ RCU Code}
+\paragraph{Code:
+ Reader-Writer Locking vs.\@ RCU Code}
In the best case, the conversion from reader-writer locking to RCU
is quite simple, as shown in
@@ -663,7 +664,8 @@ Wikipedia~\cite{WikipediaRCU}.
}
\hspace*{0.9in}\OneColumnHSpace{-0.5in}
\IfEbookSize{\hspace*{-1.05in}}{}\theverbbox
-\caption{Converting Reader-Writer Locking to RCU: Data}
+\caption{Converting Reader-Writer Locking to RCU\@:
+ Data}
\label{lst:defer:Converting Reader-Writer Locking to RCU: Data}
\end{listing*}
@@ -689,7 +691,8 @@ Wikipedia~\cite{WikipediaRCU}.
}
\hspace*{0.9in}\OneColumnHSpace{-0.5in}
\IfEbookSize{\hspace*{-1.05in}}{}\theverbbox
-\caption{Converting Reader-Writer Locking to RCU: Search}
+\caption{Converting Reader-Writer Locking to RCU\@:
+ Search}
\label{lst:defer:Converting Reader-Writer Locking to RCU: Search}
\end{listing*}
@@ -717,7 +720,8 @@ Wikipedia~\cite{WikipediaRCU}.
}
\hspace*{0.9in}\OneColumnHSpace{-0.5in}
\IfEbookSize{\hspace*{-1.05in}}{}\theverbbox
-\caption{Converting Reader-Writer Locking to RCU: Deletion}
+\caption{Converting Reader-Writer Locking to RCU\@:
+ Deletion}
\label{lst:defer:Converting Reader-Writer Locking to RCU: Deletion}
\end{listing*}
@@ -741,7 +745,8 @@ More-elaborate cases of replacing reader-writer locking with RCU
may be found
elsewhere~\cite{NeilBrown2015PathnameLookup,NeilBrown2015RCUwalk}.
-\paragraph{Semantics: Reader-Writer Locking vs.\@ RCU Semantics}
+\paragraph{Semantics:
+ Reader-Writer Locking vs.\@ RCU Semantics}
Reader-writer locking semantics can be roughly and informally summarized
by the following three temporal constraints:
@@ -937,7 +942,7 @@ waits for any previously acquired references to be released.
What gives?
}\QuickQuizAnswer{
This is an effect of the Law of Toy Examples:
- beyond a certain point, the code fragments look the same.
+ Beyond a certain point, the code fragments look the same.
The only difference is in how we think about the code.
However, this difference can be extremely important.
For but one example of the importance, consider that if we think
@@ -1049,10 +1054,13 @@ misleading.
Perhaps the best way to think of the relationship between RCU
and automatic garbage collectors (GCs) is that RCU resembles
a GC in that the \emph{timing} of collection is automatically
-determined, but that RCU differs from a GC in that: (1)~the programmer
-must manually indicate when a given data structure is eligible
-to be collected, and (2)~the programmer must manually mark the
-RCU read-side critical sections where references might be held.
+determined, but that RCU differs from a GC in that:
+\begin{enumerate*}[(1)]
+\item The programmer must manually indicate when a given data
+structure is eligible to be collected, and
+\item The programmer must manually mark the RCU read-side critical
+sections where references might be held.
+\end{enumerate*}
Despite these differences, the resemblance does go quite deep.
In fact, the first RCU-like mechanism I am aware of used a
@@ -1528,9 +1536,9 @@ was shown in the previous sections.
At its core, RCU is nothing more nor less than an API that provides:
\begin{enumerate}
-\item a publish-subscribe mechanism for adding new data,
-\item a way of waiting for pre-existing RCU readers to finish, and
-\item a discipline of maintaining multiple versions to permit change
+\item A publish-subscribe mechanism for adding new data,
+\item A way of waiting for pre-existing RCU readers to finish, and
+\item A discipline of maintaining multiple versions to permit change
without harming or unduly delaying concurrent RCU readers.
\end{enumerate}
diff --git a/defer/seqlock.tex b/defer/seqlock.tex
index 3eec7b2f..a2649b15 100644
--- a/defer/seqlock.tex
+++ b/defer/seqlock.tex
@@ -378,9 +378,12 @@ Both the read-side and write-side critical sections of a sequence lock
can be thought of as transactions, and sequence locking therefore
can be thought of as a limited form of transactional memory, which
will be discussed in \cref{sec:future:Transactional Memory}.
-The limitations of sequence locking are: (1)~Sequence locking restricts
-updates and (2)~sequence locking does not permit traversal of pointers
+The limitations of sequence locking are:
+\begin{enumerate*}[(1)]
+\item Sequence locking restricts updates and
+\item Sequence locking does not permit traversal of pointers
to objects that might be freed by updaters.
+\end{enumerate*}
These limitations are of course overcome by transactional memory, but
can also be overcome by combining other synchronization primitives
with sequence locking.
@@ -393,8 +396,9 @@ in writer-heavy workloads.\footnote{
\url{http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/improved-lock-free-seqlock}.}
On the other hand, in the absence of writers, sequence-lock readers are
reasonably fast and scale linearly.
-It is only human to want the best of both worlds: fast readers without
-the possibility of read-side failure, let alone starvation.
+It is only human to want the best of both worlds:
+Fast readers without the possibility of read-side failure,
+let alone starvation.
In addition, it would also be nice to overcome sequence locking's limitations
with pointers.
The following section presents a synchronization mechanism with exactly
diff --git a/defer/whichtochoose.tex b/defer/whichtochoose.tex
index 30e5bfa4..2f8a343b 100644
--- a/defer/whichtochoose.tex
+++ b/defer/whichtochoose.tex
@@ -25,7 +25,8 @@ hazard pointers, sequence locking, and RCU\@.
This discussion should help you to make an informed choice between
these techniques.
-\subsection{Which to Choose? (Overview)}
+\subsection{Which to Choose?
+ (Overview)}
\label{sec:defer:Which to Choose? (Overview)}
\begin{table*}
@@ -70,7 +71,8 @@ these techniques.
\bottomrule
\end{tabularx}
}
-\caption{Which Deferred Technique to Choose? (Overview)}
+\caption{Which Deferred Technique to Choose?
+ (Overview)}
\label{tab:defer:Which Deferred Technique to Choose? (Overview)}
\end{table*}
@@ -166,7 +168,8 @@ Nevertheless, this table should be of great help when choosing between
these techniques.
But those wishing more detail should continue on to the next section.
-\subsection{Which to Choose? (Details)}
+\subsection{Which to Choose?
+ (Details)}
\label{sec:defer:Which to Choose? (Details)}
\begin{table*}
@@ -248,7 +251,8 @@ But those wishing more detail should continue on to the next section.
\bottomrule
\end{tabularx}
}
-\caption{Which Deferred Technique to Choose? (Details)}
+\caption{Which Deferred Technique to Choose?
+ (Details)}
\label{tab:defer:Which Deferred Technique to Choose? (Details)}
\end{table*}
@@ -378,8 +382,8 @@ RCU grace periods can also be short, which limits the memory footprint.
For the few data elements that need longer-lived references, reference
counting is used.
This means that the complexity of reference-acquisition failure only
-needs to be dealt with for those few data elements: The bulk of
-the reference acquisitions are unconditional, courtesy of RCU\@.
+needs to be dealt with for those few data elements:
+The bulk of the reference acquisitions are unconditional, courtesy of RCU\@.
See \cref{sec:together:Refurbish Reference Counting}
for more information on combining reference counting with other
synchronization mechanisms.
@@ -419,7 +423,8 @@ and in combination, the rules of thumb laid out in this section will
need to be refined.
However, this section does reflect the current state of the art.
-\subsection{Which to Choose? (Production Use)}
+\subsection{Which to Choose?
+ (Production Use)}
\label{sec:defer:Which to Choose? (Production Use)}
This section points out a few publicly visible production uses of
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH -perfbook 4/6] count: Remove Oxford comma in two-item enumeration list
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
` (2 preceding siblings ...)
2021-07-08 10:43 ` [PATCH -perfbook 3/6] defer: " Akira Yokosawa
@ 2021-07-08 10:44 ` Akira Yokosawa
2021-07-08 10:45 ` [PATCH -perfbook 5/6] locking: Remove Oxford comma in two-item list Akira Yokosawa
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-08 10:44 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
count/count.tex | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/count/count.tex b/count/count.tex
index afe0539b..db4b1144 100644
--- a/count/count.tex
+++ b/count/count.tex
@@ -1736,7 +1736,7 @@ thread~0 can once again increment the counter locally.
There are two purposes for taking this approach:
\begin{enumerate*}[(1)]
\item To allow thread~0 to use the fastpath for decrements as
- well as increments, and
+ well as increments and
\item To reduce the inaccuracies if all threads are monotonically
incrementing up towards the limit.
\end{enumerate*}
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH -perfbook 5/6] locking: Remove Oxford comma in two-item list
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
` (3 preceding siblings ...)
2021-07-08 10:44 ` [PATCH -perfbook 4/6] count: Remove Oxford comma in two-item enumeration list Akira Yokosawa
@ 2021-07-08 10:45 ` Akira Yokosawa
2021-07-08 10:46 ` [PATCH -perfbook 6/6] defer: " Akira Yokosawa
2021-07-08 16:19 ` [PATCH -perfbook 0/6] Break and capitalize after colon, take two Paul E. McKenney
6 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-08 10:45 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
locking/locking.tex | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locking/locking.tex b/locking/locking.tex
index 580d8766..7ae9a115 100644
--- a/locking/locking.tex
+++ b/locking/locking.tex
@@ -1326,7 +1326,7 @@ when needed rests with the developer.
It is important to note that unconditionally acquiring an exclusive lock
has two effects:
\begin{enumerate*}[(1)]
-\item Waiting for all prior holders of that lock to release it, and
+\item Waiting for all prior holders of that lock to release it and
\item Blocking any other acquisition attempts until the lock is released.
\end{enumerate*}
As a result, at lock acquisition time, any concurrent acquisitions of
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH -perfbook 6/6] defer: Remove Oxford comma in two-item list
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
` (4 preceding siblings ...)
2021-07-08 10:45 ` [PATCH -perfbook 5/6] locking: Remove Oxford comma in two-item list Akira Yokosawa
@ 2021-07-08 10:46 ` Akira Yokosawa
2021-07-08 16:19 ` [PATCH -perfbook 0/6] Break and capitalize after colon, take two Paul E. McKenney
6 siblings, 0 replies; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-08 10:46 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/rcuusage.tex | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/defer/rcuusage.tex b/defer/rcuusage.tex
index 0e5ad511..b08a31d7 100644
--- a/defer/rcuusage.tex
+++ b/defer/rcuusage.tex
@@ -1057,7 +1057,7 @@ a GC in that the \emph{timing} of collection is automatically
determined, but that RCU differs from a GC in that:
\begin{enumerate*}[(1)]
\item The programmer must manually indicate when a given data
-structure is eligible to be collected, and
+structure is eligible to be collected and
\item The programmer must manually mark the RCU read-side critical
sections where references might be held.
\end{enumerate*}
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH -perfbook 0/6] Break and capitalize after colon, take two
2021-07-08 10:40 [PATCH -perfbook 0/6] Break and capitalize after colon, take two Akira Yokosawa
` (5 preceding siblings ...)
2021-07-08 10:46 ` [PATCH -perfbook 6/6] defer: " Akira Yokosawa
@ 2021-07-08 16:19 ` Paul E. McKenney
2021-07-09 0:01 ` Akira Yokosawa
6 siblings, 1 reply; 10+ messages in thread
From: Paul E. McKenney @ 2021-07-08 16:19 UTC (permalink / raw)
To: Akira Yokosawa; +Cc: perfbook
On Thu, Jul 08, 2021 at 07:40:16PM +0900, Akira Yokosawa wrote:
> Hi Paul,
>
> Here are colon related tweaks though Chapter 9.
>
> Patches 1/6 -- 3/6 don't change sentences/clauses/phrases except
> for capitalization.
> Patches 4/6 -- 6/6 remove redundant looking Oxford commas in
> two-item enumeration lists.
> However, I'm not sure Patches 4/6 -- 6/6 are the right fixes or not.
>
> Please pick whichever ones you'd like.
After some thought and web searching, I took them all. The missing
comma in the numbered list looks a bit strange to me, but the style
manuals don't differentiate between numbered and non-numbered lists,
so I am willing to have things look strange to avoid yet another
perfbook-specific composition rule. ;-)
> NOTE: There is a hunk in Patch 3/6:
>
> > @@ -535,9 +537,10 @@ and with increasing use of hazard pointers in other projects, demonstrates
> > that tolerance for such inconsistencies is more common than one might
> > imagine.
> > This is especially the case given that single-item lookups are much more
> > -common than traversals: After all, (1)~concurrent updates are less likely
> > -to affect a single-item lookup than they are a full traversal, and
> > -(2)~an isolated single-item lookup cannot detect such inconsistencies.
> > +common than traversals:
> > +After all, (1)~concurrent updates are less likely to affect a single-item
> > +lookup than they are a full traversal, and (2)~an isolated single-item
> > +lookup cannot detect such inconsistencies.
> >
> > From a more theoretical viewpoint, there are even some special cases where
> > RCU readers can be considered to be fully ordered with updaters, despite
>
> , where the inline enumerated list is not converted to the "enumerate*" list.
> This one is lead by "After all," not by a colon, and I kept the lowercase
> words following (1) and (2).
>
> This level of fluctuation is unavoidable in natural language text,
> I suppose.
I wordsmithed this passage to get rid of the list entirely.
I believe that it now reads better, in addition to avoiding another
perfbook-specific special case.
Thanx, Paul
> Thanks, Akira
>
> --
> Akira Yokosawa (6):
> toolsoftrade, count, SMPdesign: Break and capitalize after colon
> locking: Break and capitalize after colon
> defer: Break and capitalize after colon
> count: Remove Oxford comma in two-item enumeration list
> locking: Remove Oxford comma in two-item list
> defer: Remove Oxford comma in two-item list
>
> SMPdesign/SMPdesign.tex | 23 ++++----
> SMPdesign/beyond.tex | 19 +++----
> count/count.tex | 66 ++++++++++++-----------
> defer/hazptr.tex | 9 ++--
> defer/rcufundamental.tex | 29 ++++++-----
> defer/rcuintro.tex | 6 ++-
> defer/rcuusage.tex | 34 +++++++-----
> defer/seqlock.tex | 12 +++--
> defer/whichtochoose.tex | 19 ++++---
> locking/locking-existence.tex | 4 +-
> locking/locking.tex | 98 ++++++++++++++++++++---------------
> toolsoftrade/toolsoftrade.tex | 31 ++++++-----
> 12 files changed, 201 insertions(+), 149 deletions(-)
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH -perfbook 0/6] Break and capitalize after colon, take two
2021-07-08 16:19 ` [PATCH -perfbook 0/6] Break and capitalize after colon, take two Paul E. McKenney
@ 2021-07-09 0:01 ` Akira Yokosawa
2021-07-09 4:05 ` Paul E. McKenney
0 siblings, 1 reply; 10+ messages in thread
From: Akira Yokosawa @ 2021-07-09 0:01 UTC (permalink / raw)
To: paulmck; +Cc: perfbook, Akira Yokosawa
On Thu, 8 Jul 2021 09:19:14 -0700, Paul E. McKenney wrote:
> On Thu, Jul 08, 2021 at 07:40:16PM +0900, Akira Yokosawa wrote:
>> Hi Paul,
>>
>> Here are colon related tweaks though Chapter 9.
>>
>> Patches 1/6 -- 3/6 don't change sentences/clauses/phrases except
>> for capitalization.
>> Patches 4/6 -- 6/6 remove redundant looking Oxford commas in
>> two-item enumeration lists.
>> However, I'm not sure Patches 4/6 -- 6/6 are the right fixes or not.
>>
>> Please pick whichever ones you'd like.
>
> After some thought and web searching, I took them all. The missing
> comma in the numbered list looks a bit strange to me, but the style
> manuals don't differentiate between numbered and non-numbered lists,
> so I am willing to have things look strange to avoid yet another
> perfbook-specific composition rule. ;-)>
>> NOTE: There is a hunk in Patch 3/6:
>>
>>> @@ -535,9 +537,10 @@ and with increasing use of hazard pointers in other projects, demonstrates
>>> that tolerance for such inconsistencies is more common than one might
>>> imagine.
>>> This is especially the case given that single-item lookups are much more
>>> -common than traversals: After all, (1)~concurrent updates are less likely
>>> -to affect a single-item lookup than they are a full traversal, and
>>> -(2)~an isolated single-item lookup cannot detect such inconsistencies.
>>> +common than traversals:
>>> +After all, (1)~concurrent updates are less likely to affect a single-item
>>> +lookup than they are a full traversal, and (2)~an isolated single-item
>>> +lookup cannot detect such inconsistencies.
>>>
>>> From a more theoretical viewpoint, there are even some special cases where
>>> RCU readers can be considered to be fully ordered with updaters, despite
>>
>> , where the inline enumerated list is not converted to the "enumerate*" list.
>> This one is lead by "After all," not by a colon, and I kept the lowercase
>> words following (1) and (2).
>>
>> This level of fluctuation is unavoidable in natural language text,
>> I suppose.
>
> I wordsmithed this passage to get rid of the list entirely.
> I believe that it now reads better, in addition to avoiding another
> perfbook-specific special case.
There looks like a typo in the updated passage.
Please find a patch below.
Thanks, Akira
>
> Thanx, Paul
>
[...]
-------8<---------
From: Akira Yokosawa <akiyks@gmail.com>
Date: Fri, 9 Jul 2021 08:43:52 +0900
Subject: [PATCH] defer/rcufundamental: Fix typo
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/rcufundamental.tex | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/defer/rcufundamental.tex b/defer/rcufundamental.tex
index ff3c4bc1..66f9b702 100644
--- a/defer/rcufundamental.tex
+++ b/defer/rcufundamental.tex
@@ -543,7 +543,7 @@ full-data-structure traversals.
After all, full-data-structure traversals are much more expensive than
single-item lookups, so developers are motivated to avoid such traversals.
Not only are concurrent updates are less likely to affect a single-item
-lookup than they are a full traversal, but is is also the case that an
+lookup than they are a full traversal, but it is also the case that an
isolated single-item lookup has no way of detecting such inconsistencies.
As a result, in the common case, such inconsistencies are not just
tolerable, they are in fact invisible.
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH -perfbook 0/6] Break and capitalize after colon, take two
2021-07-09 0:01 ` Akira Yokosawa
@ 2021-07-09 4:05 ` Paul E. McKenney
0 siblings, 0 replies; 10+ messages in thread
From: Paul E. McKenney @ 2021-07-09 4:05 UTC (permalink / raw)
To: Akira Yokosawa; +Cc: perfbook
On Fri, Jul 09, 2021 at 09:01:02AM +0900, Akira Yokosawa wrote:
> On Thu, 8 Jul 2021 09:19:14 -0700, Paul E. McKenney wrote:
> > On Thu, Jul 08, 2021 at 07:40:16PM +0900, Akira Yokosawa wrote:
> >> Hi Paul,
> >>
> >> Here are colon related tweaks though Chapter 9.
> >>
> >> Patches 1/6 -- 3/6 don't change sentences/clauses/phrases except
> >> for capitalization.
> >> Patches 4/6 -- 6/6 remove redundant looking Oxford commas in
> >> two-item enumeration lists.
> >> However, I'm not sure Patches 4/6 -- 6/6 are the right fixes or not.
> >>
> >> Please pick whichever ones you'd like.
> >
> > After some thought and web searching, I took them all. The missing
> > comma in the numbered list looks a bit strange to me, but the style
> > manuals don't differentiate between numbered and non-numbered lists,
> > so I am willing to have things look strange to avoid yet another
> > perfbook-specific composition rule. ;-)>
> >> NOTE: There is a hunk in Patch 3/6:
> >>
> >>> @@ -535,9 +537,10 @@ and with increasing use of hazard pointers in other projects, demonstrates
> >>> that tolerance for such inconsistencies is more common than one might
> >>> imagine.
> >>> This is especially the case given that single-item lookups are much more
> >>> -common than traversals: After all, (1)~concurrent updates are less likely
> >>> -to affect a single-item lookup than they are a full traversal, and
> >>> -(2)~an isolated single-item lookup cannot detect such inconsistencies.
> >>> +common than traversals:
> >>> +After all, (1)~concurrent updates are less likely to affect a single-item
> >>> +lookup than they are a full traversal, and (2)~an isolated single-item
> >>> +lookup cannot detect such inconsistencies.
> >>>
> >>> From a more theoretical viewpoint, there are even some special cases where
> >>> RCU readers can be considered to be fully ordered with updaters, despite
> >>
> >> , where the inline enumerated list is not converted to the "enumerate*" list.
> >> This one is lead by "After all," not by a colon, and I kept the lowercase
> >> words following (1) and (2).
> >>
> >> This level of fluctuation is unavoidable in natural language text,
> >> I suppose.
> >
> > I wordsmithed this passage to get rid of the list entirely.
> > I believe that it now reads better, in addition to avoiding another
> > perfbook-specific special case.
>
> There looks like a typo in the updated passage.
> Please find a patch below.
Good eyes, queued and pushed, thank you!
Thanx, Paul
> Thanks, Akira
>
> >
> > Thanx, Paul
> >
> [...]
>
> -------8<---------
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Fri, 9 Jul 2021 08:43:52 +0900
> Subject: [PATCH] defer/rcufundamental: Fix typo
>
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> ---
> defer/rcufundamental.tex | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/defer/rcufundamental.tex b/defer/rcufundamental.tex
> index ff3c4bc1..66f9b702 100644
> --- a/defer/rcufundamental.tex
> +++ b/defer/rcufundamental.tex
> @@ -543,7 +543,7 @@ full-data-structure traversals.
> After all, full-data-structure traversals are much more expensive than
> single-item lookups, so developers are motivated to avoid such traversals.
> Not only are concurrent updates are less likely to affect a single-item
> -lookup than they are a full traversal, but is is also the case that an
> +lookup than they are a full traversal, but it is also the case that an
> isolated single-item lookup has no way of detecting such inconsistencies.
> As a result, in the common case, such inconsistencies are not just
> tolerable, they are in fact invisible.
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread