Add script to check period spacing
v2 cover Add script to check period spacing
Hi Paul,
This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.
Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.
After Patch 9/9 is applied, "make periodcheck" will be clean.
I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.
Thanks, Akira
--
Akira Yokosawa (9):
Annotate mid-sentence and end-of-sentence periods
periodcheck: Add script to check missing annotation of period
periodcheck: Add check of nbsp in front of \cite{}
periodcheck: Improve label string matching
periodcheck: Replace escaped percent symbol first
treewide: Make end-of-sentence periods be at end of lines
styleguide: Make end-of-sentence periods be at the end of lines
treewide: Fix space in front of \cite{}
treewide: Substitute ';' for ',' in label strings
Makefile | 5 +- SMPdesign/SMPdesign.tex | 36 ++-- SMPdesign/beyond.tex | 15 +- SMPdesign/criteria.tex | 4 +- SMPdesign/partexercises.tex | 12 +- ack.tex | 2 +- advsync/rt.tex | 7 +- appendix/styleguide/styleguide.tex | 237 +++++++++++++++------------ appendix/whymb/whymemorybarriers.tex | 71 ++++---- count/count.tex | 11 +- cpu/hwfreelunch.tex | 2 +- datastruct/datastruct.tex | 55 ++++--- debugging/debugging.tex | 16 +- defer/defer.tex | 4 +- defer/hazptr.tex | 7 +- defer/rcuapi.tex | 4 +- defer/rcufundamental.tex | 5 +- defer/refcnt.tex | 4 +- easy/easy.tex | 3 +- formal/dyntickrcu.tex | 15 +- formal/ppcmem.tex | 184 +++++++++++---------- formal/spinhint.tex | 148 +++++++++-------- glossary.tex | 9 +- howto/howto.tex | 2 +- intro/intro.tex | 33 ++-- legal.tex | 9 +- locking/locking.tex | 5 +- memorder/memorder.tex | 12 +- owned/owned.tex | 5 +- together/refcnt.tex | 4 +- toolsoftrade/toolsoftrade.tex | 9 +- utilities/periodcheck.pl | 87 ++++++++++ utilities/periodcheck.sh | 23 +++ 33 files changed, 627 insertions(+), 418 deletions(-) create mode 100755 utilities/periodcheck.pl create mode 100755 utilities/periodcheck.sh
Signature · 1 line
2.17.1
PATCH v2 1/9 Annotate mid-sentence and end-of-sentence periods
These were caught by the check script to be added in the following updates.
--- ack.tex | 2 +- advsync/rt.tex | 2 +- howto/howto.tex | 2 +- locking/locking.tex | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
ack.tex +1 -1
@@ -126,4 +126,4 @@ organizations that keep Internet and the World Wide Web up and running, and this one is no exception. Portions of this material are based upon work supported by the National -Science Foundation under Grant No. CNS-0719851. +Science Foundation under Grant No.\@ CNS-0719851.
advsync/rt.tex +1 -1
@@ -573,7 +573,7 @@ as depicted in \cref{fig:advsync:Real-Time Reflexes}. The hard real-time reflexes, which read from sensors and control actuators, run real-time on a single CPU or on special-purpose hardware -such as an FPGA. +such as an FPGA\@. The non-real-time strategy and planning portion of the application runs on the remaining CPUs. Strategy and planning activities might include statistical analysis,
howto/howto.tex +1 -1
@@ -304,7 +304,7 @@ Fortunately, there are many alternatives available to you: \pplsur{Victor}{Luchangco}, and \pplsur{Michael}{Spear} did catch up in their second edition by adding short sections on hazard pointers and on \acr{rcu}, with the latter in the guise - of \acr{ebr}. + of \acr{ebr}\@. They also include a brief history of both, albeit with an abbreviated history of \acr{rcu} that picks up almost a year after it was accepted into the Linux kernel and more than 20~years
locking/locking.tex +1 -1
@@ -713,7 +713,7 @@ outside of a signal handler without blocking signals. handler without blocking signals, a signal might be handled while holding this lock. The corresponding signal handler might then acquire - Lock~B, so that Lock~B is acquired while holding Lock~A. + Lock~B, so that Lock~B is acquired while holding Lock~A\@. Therefore, if we also acquire Lock~A while holding Lock~B, we will have a deadlock cycle. Note that this problem exists even if signals are blocked while
Signature · 1 line
2.17.1
PATCH v2 2/9 periodcheck: Add script to check missing annotation of period
In reply to Akira Yokosawa"make periodcheck" will do the check.
NOTE: Possible false negative/positive as of this commit:
o A mid-sentence period is ignored when the line matches "\label{"
or "\*ref{" pattern. It should be caught when it is outside a macro.
o \cref{} can have comma-separated multiple labels as an argument.
When one of the labels has a mid-sentence period and on a subsequent line in the input, it is not ignored.
o \crefrange{}{} can also have a label string on a subsequent line.
--- Makefile | 5 ++- utilities/periodcheck.pl | 76 ++++++++++++++++++++++++++++++++++++++++ utilities/periodcheck.sh | 20 +++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100755 utilities/periodcheck.pl create mode 100755 utilities/periodcheck.sh
Makefile +4 -1
@@ -192,7 +192,7 @@ BASE_DEPENDS := perfbook.tex $(foreach v,tcb 1c msns mss mstx msr msn msnt sf nq .PHONY: qq perfbook-qq.pdf qqmsg .PHONY: help help-official help-full help-semiofficial help-paper help-draft .PHONY: help-experimental help-prefixed -.PHONY: paper-clean +.PHONY: paper-clean periodcheck all: $(targ)
@@ -611,5 +611,8 @@ ls-unused: neatfreak: distclean find . -name '*.pdf' | xargs rm -f +periodcheck: + utilities/periodcheck.sh + .SECONDEXPANSION: $(ABBREVTARGETS): %: [email protected]
utilities/periodcheck.pl new file +76 -0
76 lines not on this page · raw message
utilities/periodcheck.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh + +tex_sources_all=`find . -name "*.tex" -print` +tex_sources="" + +for f in $tex_sources_all +do + case $f in + ./perfbook*) ;; + ./qqz*) ;; + ./future/HTMtable*) ;; + ./appendix/styleguide*) ;; + *) tex_sources="$tex_sources $f" ;; + esac +done + +for g in $tex_sources +do + utilities/periodcheck.pl $g +done
Signature · 1 line
2.17.1
PATCH v2 3/9 periodcheck: Add check of nbsp in front of \cite{}
In reply to Akira YokosawaAlso use /usr/bin/env in shebang.
--- utilities/periodcheck.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
utilities/periodcheck.pl +7 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # SPDX-License-Identifier: GPL-2.0-or-later # # Check LaTeX source of mid-sentence and end-of-sentence period
@@ -53,6 +53,12 @@ sub check_line { $safe = 1; } } + if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) { + $safe = 0; + if ($line =~ /^(?=[\s]*+[^%])[^%]*~\(\\cite/) { + $safe = 1; + } + } unless ($safe) { print $ARGV[0], ':', $line_num, ':', $line; }
Signature · 1 line
2.17.1
PATCH v2 4/9 periodcheck: Improve label string matching
In reply to Akira YokosawaInstead of patterns "\label" and "ref{", use a regex pattern to match "foo:bar:Label String" and do checks after removing label strings.
There still remains an assumption that each label string completes within an input line.
--- utilities/periodcheck.pl | 13 +++++++++---- utilities/periodcheck.sh | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-)
utilities/periodcheck.pl +9 -4
@@ -28,8 +28,16 @@ my $Verbatim_begin = qr/\\begin\{Verbatim/ ; my $Verbatim_end = qr/\\end\{Verbatim/ ; my $tabular_begin = qr/\\begin\{tabula/ ; my $tabular_end = qr/\\end\{tabula/ ; +my $label_ptn = qr/(^|\{)(,?[a-z]{3}:[a-zMPS]+:[^\},]+)(\}|,)/ ; sub check_line { + my $line_raw = $line; + if ($line =~ /$label_ptn/) { + while ($line && $line =~ /$label_ptn/) { + my $quoted_2 = quotemeta $2; + $line =~ s/$quoted_2//; + } + } if ($line =~ /$Verbatim_begin/ || $line =~ /$tabular_begin/) { $skip = 1;
@@ -49,9 +57,6 @@ sub check_line { } if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z\}]\.\s[^\\]+/) { $safe = 0; - if ($line =~ /ref\{/ || $line =~ /label\{/) { - $safe = 1; - } } if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) { $safe = 0;
@@ -60,7 +65,7 @@ sub check_line { } } unless ($safe) { - print $ARGV[0], ':', $line_num, ':', $line; + print $ARGV[0], ':', $line_num, ':', $line_raw; } } if ($line =~ /$Verbatim_end/ ||
utilities/periodcheck.sh +3 -0
@@ -8,6 +8,9 @@ do case $f in ./perfbook*) ;; ./qqz*) ;; + ./glsdict.tex) ;; + ./origpub.tex) ;; + ./contrib.tex) ;; ./future/HTMtable*) ;; ./appendix/styleguide*) ;; *) tex_sources="$tex_sources $f" ;;
Signature · 1 line
2.17.1
PATCH v2 5/9 periodcheck: Replace escaped percent symbol first
In reply to Akira YokosawaTo prevent "\%" from being treated as a symbol of comment, replace it with "pct" at the beginning of pattern matching. (Source .tex files are not modified.)
Also improve regex of label string to cache "chp:foo bar".
Add some comments and do a couple of refactoring by using (xxx|yyy) and "?" patterns.
--- utilities/periodcheck.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
utilities/periodcheck.pl +7 -7
@@ -28,30 +28,30 @@ my $Verbatim_begin = qr/\\begin\{Verbatim/ ; my $Verbatim_end = qr/\\end\{Verbatim/ ; my $tabular_begin = qr/\\begin\{tabula/ ; my $tabular_end = qr/\\end\{tabula/ ; -my $label_ptn = qr/(^|\{)(,?[a-z]{3}:[a-zMPS]+:[^\},]+)(\}|,)/ ; +my $label_ptn = qr/(^\s*|\{)(,?[a-z]{3,4}:([a-zMPS]+:)?[^\},]+)(\}|,)/ ; sub check_line { my $line_raw = $line; - if ($line =~ /$label_ptn/) { + $line =~ s/\\%/pct/g ; # replace \% to prevent false negative + if ($line =~ /$label_ptn/) {# remove label string while ($line && $line =~ /$label_ptn/) { my $quoted_2 = quotemeta $2; $line =~ s/$quoted_2//; } } if ($line =~ /$Verbatim_begin/ || - $line =~ /$tabular_begin/) { + $line =~ /$tabular_begin/) { # exception (verbatim and tabular) $skip = 1; } unless ($skip) { $safe = 1; if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z]\.$/ || $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z]\.\\footnote/ || - $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]cr\{.+\}\.$/ || - $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm\{.+\}\.$/) { + $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?\{.+\}\.$/ ) { $safe = 0; if ($next_line =~ /^\s*$/ || $next_line =~ /^\s*%/ || - $next_line =~ /\\item/ || $next_line =~ /\\end\{quot/ || - $next_line =~ /\\end\{enum/ || $next_line =~ /\\end\{item/) { + $next_line =~ /\\item/ || + $next_line =~ /\\end\{(quot|enum|item|sequ)/ ) { $safe = 1; } }
Signature · 1 line
2.17.1
PATCH v2 6/9 treewide: Make end-of-sentence periods be at end of lines
In reply to Akira Yokosawa--- SMPdesign/SMPdesign.tex | 36 +++--- SMPdesign/beyond.tex | 3 +- SMPdesign/criteria.tex | 4 +- advsync/rt.tex | 5 +- appendix/whymb/whymemorybarriers.tex | 71 ++++++----- count/count.tex | 11 +- datastruct/datastruct.tex | 15 ++- debugging/debugging.tex | 12 +- defer/defer.tex | 4 +- defer/hazptr.tex | 7 +- defer/rcufundamental.tex | 5 +- easy/easy.tex | 3 +- formal/dyntickrcu.tex | 15 ++- formal/ppcmem.tex | 180 ++++++++++++++------------- formal/spinhint.tex | 148 ++++++++++++---------- glossary.tex | 9 +- intro/intro.tex | 27 ++-- legal.tex | 9 +- locking/locking.tex | 3 +- memorder/memorder.tex | 12 +- owned/owned.tex | 5 +- together/refcnt.tex | 4 +- toolsoftrade/toolsoftrade.tex | 3 +- 23 files changed, 332 insertions(+), 259 deletions(-)
SMPdesign/SMPdesign.tex +20 -16
@@ -174,9 +174,9 @@ global locks.\footnote{ in Section~\ref{sec:SMPdesign:Data Locking}.} It is especially easy to retrofit an existing program to use code locking in -order to run it on a multiprocessor. If the program has -only a single shared resource, code locking will even give -optimal performance. +order to run it on a multiprocessor. +If the program has only a single shared resource, code locking +will even give optimal performance. However, many of the larger and more complex programs require much of the execution to occur in \IXpl{critical section}, which in turn causes code locking
@@ -184,9 +184,9 @@ to sharply limits their scalability. Therefore, you should use code locking on programs that spend only a small fraction of their execution time in critical sections or -from which only modest scaling is required. In these cases, -code locking will provide a relatively simple program that is -very similar to its sequential counterpart, +from which only modest scaling is required. +In these cases, code locking will provide a relatively simple +program that is very similar to its sequential counterpart, as can be seen in Listing~\ref{lst:SMPdesign:Code-Locking Hash Table Search}. However, note that the simple return of the comparison in
@@ -498,11 +498,13 @@ Data ownership might seem arcane, but it is used very frequently: (such as {\tt auto} variables in C and C++) are owned by that CPU or process. \item An instance of a user interface owns the corresponding - user's context. It is very common for applications - interacting with parallel database engines to be - written as if they were entirely sequential programs. + user's context. + It is very common for applications interacting with parallel + database engines to be written as if they were entirely + sequential programs. Such applications own the user interface and his current - action. Explicit parallelism is thus confined to the + action. + Explicit parallelism is thus confined to the database engine itself. \item Parametric simulations are often trivially parallelized by granting each thread ownership of a particular region
@@ -777,8 +779,9 @@ parallelize the common-case code path without incurring the complexity that would be required to aggressively parallelize the entire algorithm. You must understand not only the specific algorithm you wish to parallelize, but also the workload that the algorithm will -be subjected to. Great creativity and design -effort is often required to construct a parallel fastpath. +be subjected to. +Great creativity and design effort is often required to construct +a parallel fastpath. Parallel fastpath combines different patterns (one for the fastpath, one elsewhere) and is therefore a template pattern.
@@ -1200,8 +1203,8 @@ this book. \begin{description} \item[$g$] Number of blocks globally available. \item[$i$] Number of blocks left in the initializing thread's - per-thread pool. (This is one reason you needed - to look at the code!) + per-thread pool. + (This is one reason you needed to look at the code!) \item[$m$] Allocation/free run length. \item[$n$] Number of threads, excluding the initialization thread. \item[$p$] Per-thread maximum block consumption, including
@@ -1209,8 +1212,9 @@ this book. remaining in the per-thread pool. \end{description} - The values $g$, $m$, and $n$ are given. The value for $p$ is - $m$ rounded up to the next multiple of $s$, as follows: + The values $g$, $m$, and $n$ are given. + The value for $p$ is $m$ rounded up to the next multiple of $s$, + as follows: \begin{equation} p = s \left \lceil \frac{m}{s} \right \rceil
SMPdesign/beyond.tex +2 -1
@@ -159,7 +159,8 @@ line~\lnref{recordnext} records this cell in the next slot of the \co{->visited[]} array, line~\lnref{next:visited} indicates that this slot is now full, and line~\lnref{mark:visited} marks this cell as visited and also records -the distance from the maze start. Line~\lnref{ret:success} then returns success. +the distance from the maze start. +Line~\lnref{ret:success} then returns success. \end{fcvref} \begin{fcvref}[ln:SMPdesign:SEQ Helper Pseudocode:find]
SMPdesign/criteria.tex +2 -2
@@ -141,8 +141,8 @@ parallel program. most-restrictive exclusive-lock critical section. \item Contention effects consume the excess CPU and/or wallclock time when the actual speedup is less than - the number of available CPUs. The - larger the gap between the number of CPUs + the number of available CPUs. + The larger the gap between the number of CPUs and the actual speedup, the less efficiently the CPUs will be used. Similarly, the greater the desired efficiency, the smaller
advsync/rt.tex +3 -2
@@ -1149,8 +1149,9 @@ priority-inversion conundrum: \begin{enumerate} \item Only allow one read-acquisition of a given reader-writer lock - at a time. (This is the approach traditionally taken by - the Linux kernel's \rt\ patchset.) + at a time. + (This is the approach traditionally taken by the Linux + kernel's \rt\ patchset.) \item Only allow $N$ read-acquisitions of a given reader-writer lock at a time, where $N$ is the number of CPUs. \item Only allow $N$ read-acquisitions of a given reader-writer lock
appendix/whymb/whymemorybarriers.tex +40 -31
124 lines not on this page · raw message
count/count.tex +6 -5
@@ -33,7 +33,7 @@ counting. }\EQuickQuizEnd \EQuickQuiz{ - { \bfseries Network-packet counting problem. } + {\bfseries Network-packet counting problem.} Suppose that you need to collect statistics on the number of networking packets transmitted and received. Packets might be transmitted or received by any CPU on the system.
@@ -62,7 +62,7 @@ counting. \QuickQuizLabel{\QcountQstatcnt} \EQuickQuiz{ - { \bfseries Approximate structure-allocation limit problem. } + {\bfseries Approximate structure-allocation limit problem.} Suppose that you need to maintain a count of the number of structures allocated in order to fail any allocations once the number of structures in use exceeds a limit
@@ -84,7 +84,7 @@ counting. \QuickQuizLabel{\QcountQapproxcnt} \EQuickQuiz{ - { \bfseries Exact structure-allocation limit problem. } + {\bfseries Exact structure-allocation limit problem.} Suppose that you need to maintain a count of the number of structures allocated in order to fail any allocations once the number of structures in use exceeds an exact limit
@@ -111,7 +111,7 @@ counting. \QuickQuizLabel{\QcountQexactcnt} \EQuickQuiz{ - { \bfseries Removable I/O device access-count problem. } + {\bfseries Removable I/O device access-count problem.} Suppose that you need to maintain a reference count on a heavily used removable mass-storage device, so that you can tell the user when it is safe to remove the device.
@@ -1829,7 +1829,8 @@ with exact limits. \section{Exact Limit Counters} \label{sec:count:Exact Limit Counters} % -\epigraph{Exactitude can be expensive. Spend wisely.}{\emph{Unknown}} +\epigraph{Exactitude can be expensive. + Spend wisely.}{\emph{Unknown}} To solve the exact structure-allocation limit problem noted in \QuickQuizRef{\QcountQexactcnt},
datastruct/datastruct.tex +9 -6
@@ -4,8 +4,9 @@ \QuickQuizChapter{chp:Data Structures}{Data Structures}{qqzdatastruct} % -\Epigraph{Bad programmers worry about the code. Good programmers worry - about data structures and their relationships.} +\Epigraph{Bad programmers worry about the code. + Good programmers worry about data structures and their + relationships.} {\emph{Linus Torvalds}} Serious discussions of algorithms include time complexity of their
@@ -124,9 +125,10 @@ permitting a hash table to access its elements extremely efficiently. In addition, each bucket has its own lock, so that elements in different buckets of the hash table may be added, deleted, and looked up completely -independently. A large hash table with a large number of buckets (and -thus locks), with each bucket containing a small number of elements -should therefore provide excellent scalability. +independently. +A large hash table with a large number of buckets (and thus locks), with +each bucket containing a small number of elements should therefore provide +excellent scalability. \subsection{Hash-Table Implementation} \label{sec:datastruct:Hash-Table Implementation}
@@ -1806,7 +1808,8 @@ library~\cite{MathieuDesnoyers2009URCU}. \section{Other Data Structures} \label{sec:datastruct:Other Data Structures} % -\epigraph{All life is an experiment. The more experiments you make the better.} +\epigraph{All life is an experiment. + The more experiments you make the better.} {\emph{Ralph Waldo Emerson}} The preceding sections have focused on data structures that enhance
debugging/debugging.tex +7 -5
@@ -635,7 +635,8 @@ you already have a good test suite. \section{Tracing} \label{sec:debugging:Tracing} % -\epigraph{The machine knows what is wrong. Make it tell you.}{\emph{Unknown}} +\epigraph{The machine knows what is wrong. + Make it tell you.}{\emph{Unknown}} When all else fails, add a \co{printk()}! Or a \co{printf()}, if you are working with user-mode C-language applications.
@@ -2524,9 +2525,9 @@ This script takes three optional arguments as follows: into, for example, a divisor of four means that the first quarter of the data elements will be assumed to be good. This defaults to three. -\item [\lopt{relerr}\nf{:}] Relative measurement error. The script - assumes that values that differ by less than this error are for all - intents and purposes equal. +\item [\lopt{relerr}\nf{:}] Relative measurement error. + The script assumes that values that differ by less than this + error are for all intents and purposes equal. This defaults to 0.01, which is equivalent to 1\,\%. \item [\lopt{trendbreak}\nf{:}] Ratio of inter-element spacing constituting a break in the trend of the data.
@@ -2720,7 +2721,8 @@ In short, validation always will require some measure of the behavior of the system. To be at all useful, this measure must be a severe summarization of the system, which in turn means that it can be misleading. -So as the saying goes, ``Be careful. It is a real world out there.'' +So as the saying goes, ``Be careful. +It is a real world out there.'' But what if you are working on the Linux kernel, which as of 2017 was estimated to have more than 20 billion instances running throughout
defer/defer.tex +2 -2
@@ -7,8 +7,8 @@ \Epigraph{All things come to those who wait.}{\emph{Violet Fane}} The strategy of deferring work goes back before the dawn of recorded -history. It has occasionally been derided as procrastination or -even as sheer laziness. +history. +It has occasionally been derided as procrastination or even as sheer laziness. However, in the last few decades workers have recognized this strategy's value in simplifying and streamlining parallel algorithms~\cite{Kung80,HMassalinPhD}. Believe it or not, ``laziness'' in parallel programming often outperforms and
defer/hazptr.tex +4 -3
@@ -214,9 +214,10 @@ Otherwise, the element's \co{->iface} field is returned to the caller. Note that line~\lnref{tryrecord} invokes \co{hp_try_record()} rather than the easier-to-use \co{hp_record()}, restarting the full search upon \co{hp_try_record()} failure. -And such restarting is absolutely required for correctness. To see this, -consider a hazard-pointer-protected linked list containing elements~A, -B, and~C that is subjected to the following sequence of events: +And such restarting is absolutely required for correctness. +To see this, consider a hazard-pointer-protected linked list +containing elements~A, B, and~C that is subjected to the following +sequence of events: \end{fcvref} \begin{enumerate}
defer/rcufundamental.tex +3 -2
@@ -265,8 +265,9 @@ In the figure, \co{P0()}'s access to \co{y} follows \co{P1()}'s access to this same variable, and thus follows the grace period generated by \co{P1()}'s call to \co{synchronize_rcu()}. It is therefore guaranteed that \co{P0()}'s access to \co{x} will follow -\co{P1()}'s access. In this case, if \co{r2}'s final value is 1, then -\co{r1}'s final value is guaranteed to also be 1. +\co{P1()}'s access. +In this case, if \co{r2}'s final value is 1, then \co{r1}'s final value +is guaranteed to also be 1. \QuickQuiz{ What would happen if the order of \co{P0()}'s two accesses was
easy/easy.tex +2 -1
@@ -60,7 +60,8 @@ things are covered in the next section. \label{sec:easy:Rusty Scale for API Design} % \epigraph{Finding the appropriate measurement is thus not a mathematical - exercise. It is a risk-taking judgment.} + exercise. + It is a risk-taking judgment.} {\emph{Peter Drucker}} % http://billhennessy.com/simple-strategies/2015/09/09/i-wish-drucker-never-said-it % Rusty is OK with this: July 19, 2006.
formal/dyntickrcu.tex +9 -6
@@ -731,8 +731,9 @@ for the first condition: and didn't take any interrupts, NMIs, SMIs, or whatever, then it cannot be in the middle of an \co{rcu_read_lock()}, so the next \co{rcu_read_lock()} it executes must use the new value - of the counter. So we can safely pretend that this CPU - already acknowledged the counter. + of the counter. + So we can safely pretend that this CPU already acknowledged + the counter. \end{quote} The first condition does match this, because if \qco{curr == snap}
@@ -1104,7 +1105,8 @@ states, passing without errors. \begin{quote} Debugging is twice as hard as writing the code in the first - place. Therefore, if you write the code as cleverly as possible, + place. + Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. \end{quote}
@@ -1161,9 +1163,10 @@ This effort provided some lessons (re)learned: \item {\bf Always verify your verification code.} The usual way to do this is to insert a deliberate bug - and verify that the verification code catches it. Of course, - if the verification code fails to catch this bug, you may also - need to verify the bug itself, and so on, recursing infinitely. + and verify that the verification code catches it. + Of course, if the verification code fails to catch this bug, + you may also need to verify the bug itself, and so on, + recursing infinitely. However, if you find yourself in this position, getting a good night's sleep can be an extremely effective debugging technique.
formal/ppcmem.tex +96 -84
257 lines not on this page · raw message
formal/spinhint.tex +82 -66
227 lines not on this page · raw message
glossary.tex +5 -4
@@ -284,10 +284,11 @@ set of critical sections guarded by that lock, while a ``reader-writer lock'' permits any number of reading threads, or but one writing thread, into the set of critical - sections guarded by that lock. (Just to be clear, the presence - of a writer thread in any of a given reader-writer lock's - critical sections will prevent any reader from entering - any of that lock's critical sections and vice versa.) + sections guarded by that lock. + (Just to be clear, the presence of a writer thread in any of + a given reader-writer lock's critical sections will prevent + any reader from entering any of that lock's critical sections + and vice versa.) \item[\IX{Lock Contention}:] A lock is said to be suffering contention when it is being used so heavily that there is often a CPU waiting on it.
intro/intro.tex +18 -9
@@ -572,7 +572,8 @@ programming environments: Its productivity is believed by many to be even lower than that of C/C++ ``locking plus threads'' environments. \item[OpenMP:] This set of compiler directives can be used - to parallelize loops. It is thus quite specific to this + to parallelize loops. + It is thus quite specific to this task, and this specificity often limits its performance. It is, however, much easier to use than MPI or C/C++ ``locking plus threads.''
@@ -834,17 +835,21 @@ reduce the amount of data that must be read. }\QuickQuizAnswer{ There are any number of potential bottlenecks: \begin{enumerate} - \item Main memory. If a single thread consumes all available + \item Main memory. + If a single thread consumes all available memory, additional threads will simply page themselves silly. - \item Cache. If a single thread's cache footprint completely + \item Cache. + If a single thread's cache footprint completely fills any shared CPU cache(s), then adding more threads will simply thrash those affected caches, as will be seen in \cref{chp:Data Structures}. - \item Memory bandwidth. If a single thread consumes all available + \item Memory bandwidth. + If a single thread consumes all available memory bandwidth, additional threads will simply result in additional queuing on the system interconnect. - \item I/O bandwidth. If a single thread is I/O bound, + \item I/O bandwidth. + If a single thread is I/O bound, adding more threads will simply result in them all waiting in line for the affected I/O resource. \end{enumerate}
@@ -960,11 +965,13 @@ overlap computation and I/O so as to fully utilize I/O devices. There are any number of potential limits on the number of threads: \begin{enumerate} - \item Main memory. Each thread consumes some memory + \item Main memory. + Each thread consumes some memory (for its stack if nothing else), so that excessive numbers of threads can exhaust memory, resulting in excessive paging or memory-allocation failures. - \item I/O bandwidth. If each thread initiates a given + \item I/O bandwidth. + If each thread initiates a given amount of mass-storage I/O or networking traffic, excessive numbers of threads can result in excessive I/O queuing delays, again degrading performance.
@@ -1239,8 +1246,10 @@ monograph~\cite{AndrewDBirrell1989Threads} is especially telling: \begin{quote} Writing concurrent programs has a reputation for being exotic - and difficult. I~believe it is neither. You need a system - that provides you with good primitives and suitable libraries, + and difficult. + I~believe it is neither. + You need a system that provides you with good primitives + and suitable libraries, you need a basic caution and carefulness, you need an armory of useful techniques, and you need to know of the common pitfalls. I~hope that this paper has helped you towards sharing my belief.
legal.tex +5 -4
@@ -31,10 +31,11 @@ States license.\footnote{ \url{https://creativecommons.org/licenses/by-sa/3.0/us/}} In brief, you may use the contents of this document for any purpose, personal, commercial, or otherwise, so long as attribution to the -authors is maintained. Likewise, the document may be modified, -and derivative works and translations made available, so long as -such modifications and derivations are offered to the public on equal -terms as the non-source-code text and images in the original document. +authors is maintained. +Likewise, the document may be modified, and derivative works and +translations made available, so long as such modifications and +derivations are offered to the public on equal terms as the +non-source-code text and images in the original document. Source code is covered by various versions of the GPL\@.\footnote{ \url{https://www.gnu.org/licenses/gpl-2.0.html}}
locking/locking.tex +2 -1
@@ -1710,7 +1710,8 @@ be required for the foreseeable future. \label{sec:locking:Locking Implementation Issues} % \epigraph{When you translate a dream into reality, it's never a full - implementation. It is easier to dream than to do.} + implementation. + It is easier to dream than to do.} {\emph{Shai Agassi}} Developers are almost always best-served by using whatever locking
memorder/memorder.tex +7 -5
@@ -2136,7 +2136,8 @@ page~\pageref{fig:memorder:A Variable With More Simultaneous Values}. (\path{C-2+2W+o-o+o-o.litmus}). }\QuickQuizEnd -But sometimes time really is on our side. Read on! +But sometimes time really is on our side. +Read on! \subsubsection{Happens-Before} \label{sec:memorder:Happens-Before}
@@ -3158,8 +3159,9 @@ The following list of rules summarizes the lessons of this section: \end{enumerate} Again, many popular languages were designed with single-threaded use -in mind. Successful multithreaded use of these languages requires you -to pay special attention to your memory references and dependencies. +in mind. +Successful multithreaded use of these languages requires you to pay +special attention to your memory references and dependencies. \section{Higher-Level Primitives} \label{sec:memorder:Higher-Level Primitives}
@@ -3868,8 +3870,8 @@ can make portability a challenge, as indicated by In fact, some software environments simply prohibit direct use of memory-ordering operations, restricting the programmer to mutual-exclusion primitives that incorporate them to the extent that -they are required. Please note that this section is not intended to be -a reference manual +they are required. +Please note that this section is not intended to be a reference manual covering all (or even most) aspects of each CPU family, but rather a high-level overview providing a rough comparison. For full details, see the reference manual for the CPU of interest.
owned/owned.tex +4 -1
@@ -4,7 +4,10 @@ \QuickQuizChapter{chp:Data Ownership}{Data Ownership}{qqzowned} % -\Epigraph{It is mine, I tell you. My own. My precious. Yes, my precious.} +\Epigraph{It is mine, I tell you. + My own. + My precious. + Yes, my precious.} {\emph{Gollum in ``The Fellowship of the Ring'', J.R.R.~Tolkien}} One of the simplest ways to avoid the synchronization overhead that
together/refcnt.tex +2 -2
@@ -5,8 +5,8 @@ \section{Refurbish Reference Counting} \label{sec:together:Refurbish Reference Counting} % -\epigraph{Counting is the religion of this generation. It is its - hope and its salvation.} +\epigraph{Counting is the religion of this generation. + It is its hope and its salvation.} {\emph{Gertrude Stein}} Although reference counting is a conceptually simple technique,
toolsoftrade/toolsoftrade.tex +2 -1
@@ -289,7 +289,8 @@ in which the child sets a global variable \co{x} to 1 on line~\lnref{setx}, prints a message on line~\lnref{print:c}, and exits on line~\lnref{exit:s}. The parent continues at line~\lnref{waitall}, where it waits on the child, and on line~\lnref{print:p} finds that its copy of the variable \co{x} is -still zero. The output is thus as follows: +still zero. +The output is thus as follows: \end{fcvref} \begin{VerbatimU}
Signature · 1 line
2.17.1
PATCH v2 7/9 styleguide: Make end-of-sentence periods be at the end of lines
In reply to Akira Yokosawa--- appendix/styleguide/styleguide.tex | 237 ++++++++++++++++------------- 1 file changed, 130 insertions(+), 107 deletions(-)
appendix/styleguide/styleguide.tex +130 -107
@@ -8,8 +8,8 @@ \Epigraph{De gustibus non est disputandum.}{\emph{Latin maxim}} This appendix is a collection of style guides which is intended -as a reference to improve consistency in perfbook. It also contains -several suggestions and their experimental examples. +as a reference to improve consistency in perfbook. +It also contains several suggestions and their experimental examples. \Cref{sec:app:styleguide:Paul's Conventions} describes basic punctuation and spelling rules.
@@ -40,16 +40,18 @@ answers to Akira's questions regarding perfbook's punctuation policy. \end{quote} \item American English spelling: ``color'' rather than ``colour''. \item Oxford comma: ``a, b, and~c'' rather than ``a, b and~c''. - This is arbitrary. Cases where the Oxford comma results in ambiguity - should be reworded, for example, by introducing numbering: ``a, - b, and c and~d'' should be ``(1)~a, (2)~b, and (3)~c and~d''. -\item Italic for emphasis. Use sparingly. + This is arbitrary. + Cases where the Oxford comma results in ambiguity should be reworded, + for example, by introducing numbering: ``a, b, and c and~d'' should + be ``(1)~a, (2)~b, and (3)~c and~d''. +\item Italic for emphasis. + Use sparingly. \item \verb|\co{}| for identifiers, \verb|\url{}| for URLs, \verb|\path{}| for filenames. -\item Dates should use an unambiguous format. Never ``mm/dd/yy'' - or ``dd/mm/yy'', but rather ``July 26, 2016'' or ``26 July 2016'' - or ``26-Jul-2016'' or ``2016/07/26''. I tend to use - \path{yyyy.mm.ddA} for filenames, for example. +\item Dates should use an unambiguous format. + Never ``mm/dd/yy'' or ``dd/mm/yy'', but rather ``July 26, 2016'' + or ``26 July 2016'' or ``26-Jul-2016'' or ``2016/07/26''. + I tend to use \path{yyyy.mm.ddA} for filenames, for example. \item North American rules on periods and abbreviations. For example neither of the following can reasonably be interpreted as two sentences:
@@ -74,8 +76,8 @@ answers to Akira's questions regarding perfbook's punctuation policy. \end{quote} \item I don't like ampersand (``\&'') in headings, but will sometimes use it if doing so prevents a line break in that heading. -\item When mentioning words, I use quotations. When introducing - a new word, I use \verb|\emph{}|. +\item When mentioning words, I use quotations. + When introducing a new word, I use \verb|\emph{}|. \end{itemize} Following is a convention regarding punctuation in \LaTeX\ sources.
@@ -106,15 +108,15 @@ states the following rules (rephrased for perfbook). are used behind numerical values, narrow spaces should be placed between the values and the symbols. -A narrow space can be coded in \LaTeX{} by the sequence of -\qco{\\,}. +A narrow space can be coded in \LaTeX{} by the sequence of \qco{\\,}. For example, \begin{quote} ``2.4\,GHz'', rather then ``2.4GHz''. \end{quote} \item Even when the value is used in adjectival sense, a narrow space -should be placed. For example, + should be placed. + For example, \begin{quote} ``a~10\,ms interval'', rather than ``a~10\=/ms interval'' nor ``a~10ms interval''.
@@ -123,15 +125,17 @@ should be placed. For example, The symbol of micro (\micro :$10^{-6}$) can be typeset easily by the help of ``gensymb'' \LaTeX\ package. -A macro \qco{\\micro} can be used in both text and -math modes. To typeset the symbol of ``microsecond'', you can do -so by \qco{\\micro s}. For example, +A macro \qco{\\micro} can be used in both text and math modes. +To typeset the symbol of ``microsecond'', you can do +so by \qco{\\micro s}. +For example, \begin{quote} 10\,\micro s \end{quote} Note that math mode \qco{\\mu} is italic by default and should not -be used as a prefix. An improper example: +be used as a prefix. +An improper example: \begin{quote} 10\,$\mu $s (math mode \qco{\\mu}) \end{quote}
@@ -161,8 +165,9 @@ An acceptable example: \end{quote} Also, it is acceptable to use just ``K'', ``M'', or ``G'' as abbreviations -appended to a numerical value, e.g., ``4K~entries''. In such cases, no space -before an abbreviation is required. For example, +appended to a numerical value, e.g., ``4K~entries''. +In such cases, no space before an abbreviation is required. +For example, \begin{quote} ``8K entries'', rather than ``8\,K entries''.
@@ -172,14 +177,15 @@ If you put a space in between, the symbol looks like a unit symbol and is confusing. Note that ``K'' and ``k'' represent $2^{10}$ and $10^3$, respectively. ``M'' can represent either $2^{20}$ or $10^6$, and ``G'' can represent -either $2^{30}$ or $10^9$. These ambiguities should not be confusing -in discussing approximate order. +either $2^{30}$ or $10^9$. +These ambiguities should not be confusing in discussing approximate order. \subsubsection{Degree Symbol} \label{sec:app:styleguide:Degree Symbol} The angular-degree symbol (\degree) does not require any space in front -of it. NIST style guide clearly states so. +of it. +NIST style guide clearly states so. The symbol of degree can also be typeset easily by the help of gensymb package.
@@ -209,10 +215,11 @@ Quote from NIST check list:\footnote{ } \begin{quote} - Variables and quantity symbols are in italic type. Unit symbols - are in roman type. Numbers should generally be written in roman - type. These rules apply irrespective of the typeface used in - the surrounding text. + Variables and quantity symbols are in italic type. + Unit symbols are in roman type. + Numbers should generally be written in roman type. + These rules apply irrespective of the typeface used in the surrounding + text. \end{quote} For example,
@@ -251,7 +258,8 @@ Quote from NIST checklist:\footnote{ The digits of numerical values having more than four digits on either side of the decimal marker are separated into groups of three using a thin, fixed space counting from both the left and right of the decimal - marker. Commas are not used to separate digits into groups of three. + marker. + Commas are not used to separate digits into groups of three. \end{quote} \begin{quote}
@@ -262,8 +270,9 @@ Quote from NIST checklist:\footnote{ \end{quote} In \LaTeX\ coding, it is cumbersome to place thin spaces as are recommended -in NIST guide. The \verb|\num{}| command provided by the ``siunitx'' -package would be of help for us to follow this rule. +in NIST guide. +The \verb|\num{}| command provided by the ``siunitx'' package would be +of help for us to follow this rule. It would also help us overcome different conventions. We can select a specific digit-grouping style as a default in preamble, or specify an option to each \verb|\num{}|
@@ -358,8 +367,9 @@ but those line numbers cannot be referenced within the \LaTeX\ sources. Let's start by looking at how code snippets are coded in the current scheme. There are three customized environments of \qco{Verbatim}. \qco{VerbatimL} is for floating snippets within the \qco{listing} -environment. \qco{VerbatimN} is for inline snippets with line count -enabled. \qco{VerbatimU} is for inline snippets without line count. +environment. +\qco{VerbatimN} is for inline snippets with line count enabled. +\qco{VerbatimU} is for inline snippets without line count. They are defined in the preamble as shown below: \begin{VerbatimU}
@@ -398,11 +408,12 @@ The \LaTeX\ source of a sample code snippet is shown in and is typeset as shown in \cref{lst:app:styleguide:Sample Code Snippet}. -Labels to lines are specified in \qco{$lnlbl[]} command. The characters -specified by \qco{commandchars} option to \co{VarbatimL} environment are -used by the \co{fancyvrb} package to substitute \qco{\\lnlbl\{\}} -for \qco{$lnlbl[]}. Those characters should be selected so that they -don't appear elsewhere in the code snippet. +Labels to lines are specified in \qco{$lnlbl[]} command. +The characters specified by \qco{commandchars} option to \co{VarbatimL} +environment are used by the \co{fancyvrb} package to substitute +\qco{\\lnlbl\{\}} for \qco{$lnlbl[]}. +Those characters should be selected so that they don't appear +elsewhere in the code snippet. Labels \qco{printf} and \qco{return} in \cref{lst:app:styleguide:Sample Code Snippet}
@@ -453,9 +464,10 @@ The main part of \LaTeX\ source shown on \cref{lst:app:styleguide:LaTeX Source of Sample Code Snippet (Current)} can be extracted from a code sample of \cref{lst:app:styleguide:Source of Code Sample} by a perl script -\path{utilities/fcvextract.pl}. All the relevant rules of extraction -are described as recipes in the top level \path{Makefile} and -a script to generate dependencies (\path{utilities/gen_snippet_d.pl}). +\path{utilities/fcvextract.pl}. +All the relevant rules of extraction are described as recipes in the +top level \path{Makefile} and a script to generate dependencies +(\path{utilities/gen_snippet_d.pl}). \end{fcvref} \begin{listing*}
@@ -467,9 +479,10 @@ a script to generate dependencies (\path{utilities/gen_snippet_d.pl}). \end{listing*} As you can see, \cref{lst:app:styleguide:Source of Code Sample} -has meta commands in comments of C (C++ style). Those meta commands -are interpreted by \path{utilities/fcvextract.pl}, which distinguishes -the type of comment style by the suffix of code sample's file name. +has meta commands in comments of C (C++ style). +Those meta commands are interpreted by \path{utilities/fcvextract.pl}, +which distinguishes the type of comment style by the suffix of code +sample's file name. Meta commands which can be used in code samples are listed below:
@@ -502,8 +515,9 @@ Otherwise, comment blocks in C source code will be omitted. The \qco{gobbleblank=yes} option will remove empty or blank lines in the resulting snippet. The \qco{commandchars} option is given to the \co{VerbatimL} environment -as is. At the moment, it is also mandatory -and must come at the end of options listed above. +as is. +At the moment, it is also mandatory and must come at the end of options +listed above. Other types of options, if any, are also passed to the \co{VerbatimL} environment.
@@ -534,18 +548,18 @@ They also forbid a couple of tokens to appear in comments. For example, the first token in a litmus test must be one of \qco{C}, \qco{PPC}, \qco{X86}, \qco{LISA}, etc., which indicates -the flavor of the test. This means no comment is allowed -at the beginning of a litmus test. +the flavor of the test. +This means no comment is allowed at the beginning of a litmus test. Similarly, several tokens such as \qco{exists}, \qco{filter}, and~\qco{locations} indicate the end of litmus test's body. Once one of them appears in a litmus test, comments should be of -OCaml style (\qco{(* ... *)}). Those tokens keep the same meaning -even when they appear in comments! +OCaml style (\qco{(* ... *)}). +Those tokens keep the same meaning even when they appear in comments! The pair of characters \qco{\{} and \qco{\}} also have special -meaning in the C flavour tests. They are used to separate portions -in a litmus test. +meaning in the C flavour tests. +They are used to separate portions in a litmus test. First pair of \qco{\{} and \qco{\}} encloses initialization part. Comments in this part should also be in the ocaml form.
@@ -686,9 +700,9 @@ as follows: \end{VerbatimU} The \qco{verbatim} environment is used for listings with too many lines -to fit in a column. It is also used to avoid overwhelming -\LaTeX\ with a lot of floating objects. They are being converted to the -scheme using the \co{VerbatimN} environment. +to fit in a column. +It is also used to avoid overwhelming \LaTeX\ with a lot of floating objects. +They are being converted to the scheme using the \co{VerbatimN} environment. \subsubsection{Identifier} \label{sec:app:styleguide:Identifier}
@@ -697,12 +711,13 @@ We use ``\verb|\co{}|'' macro for inline identifiers. (``co'' stands for ``code''.) By putting them into \verb|\co{}|, underscore characters in -their names are free of escaping in \LaTeX\ source. It is convenient -to search them in source files. Also, \verb|\co{}| -macro has a capability to permit line breaks at particular -sequences of letters. Current definition permits a line break at -an underscore (\tco{_}), two consecutive underscores (\tco{__}), -a white space, or an operator \tco{->}. +their names are free of escaping in \LaTeX\ source. +It is convenient to search them in source files. +Also, \verb|\co{}| macro has a capability to permit line breaks +at particular sequences of letters. +Current definition permits a line break at an underscore (\tco{_}), +two consecutive underscores (\tco{__}), a white space, or an +operator \tco{->}. \subsubsection{Identifier inside Table and Heading} \label{sec:app:styleguide:Identifier inside Table and Heading}
@@ -716,9 +731,9 @@ Furthermore, \verb|\co{}| can not be safely used in section headings nor description headings. As a workaround, we use ``\verb|\tco{}|'' command -inside tables and headings. It has no capability of line break -at particular sequences, but still frees us from escaping -underscores. +inside tables and headings. +It has no capability of line break at particular sequences, but +still frees us from escaping underscores. When used in text, \verb|\tco{}| permits line breaks at white spaces.
@@ -727,11 +742,11 @@ white spaces. \label{sec:app:styleguide:Other Use Cases of Monospace Font} For URLs, we use ``\verb|\url{}|'' command provided by the -\qco{hyperref} package. It will generate hyper references to the -URLs. +\qco{hyperref} package. +It will generate hyper references to the URLs. -For path names, we use ``\verb|\path{}|'' command. It won't -generate hyper references. +For path names, we use ``\verb|\path{}|'' command. +It won't generate hyper references. Both \verb|\url{}| and \verb|\path{}| permit line breaks at \qco{/}, \qco{-}, and \qco{.}.\footnote{
@@ -787,7 +802,7 @@ many characters to escape.\footnote{ Cross-references to \namecrefs{chp:Introduction}, \namecrefs{sec:intro:Parallel Programming Goals}, -\namecrefs{lst:app:styleguide:Source of Code Sample}, etc.\ have +\namecrefs{lst:app:styleguide:Source of Code Sample}, etc.\@ have been expressed by combinations of names and bare \verb|\ref{}| commands in the following way:
@@ -843,9 +858,10 @@ info on its cleverness. \label{sec:app:styleguide:Non Breakable Spaces} In \LaTeX\ conventions, proper use of non-breakable white spaces -is highly recommended. They can prevent widowing and orphaning -of single digit numbers or short variable names, which would -cause the text to be confusing at first glance. +is highly recommended. +They can prevent widowing and orphaning of single digit numbers +or short variable names, which would cause the text to be confusing +at first glance. The thin space mentioned earlier to be placed in front of a unit symbol is non breakable.
@@ -877,8 +893,9 @@ are the following (inexhaustive). \label{sec:app:styleguide:Hyphenation in Compound Word} In plain \LaTeX, compound words such as ``high-frequency'' -can be hyphenated only at the hyphen. This sometimes results -in poor typesetting. For example: +can be hyphenated only at the hyphen. +This sometimes results in poor typesetting. +For example: \begin{center}\begin{minipage}{2.6in}\vspace{0.6\baselineskip} High-frequency radio wave, high-frequency radio wave,
@@ -906,7 +923,7 @@ Example with \qco{\\-/}: \label{sec:app:styleguide:Non Breakable Hyphen} We want hyphenated compound terms such as ``x\=/coordinate'', -``y\=/coordinate'', etc.\ not to be broken at the hyphen +``y\=/coordinate'', etc.\@ not to be broken at the hyphen following a single letter. To make a hyphen unbreakable, we can use a short cut
@@ -942,9 +959,9 @@ of compound words as the same as \qco{\\-/} does. \subsubsection{Em Dash} \label{sec:app:styleguide:Em Dash} -Em dashes are used to indicate parenthetic expression. In perfbook, -em dashes are placed without spaces around it. In \LaTeX\ source, -an em dash is represented by \qco{---}. +Em dashes are used to indicate parenthetic expression. +In perfbook, em dashes are placed without spaces around it. +In \LaTeX\ source, an em dash is represented by \qco{---}. Example (quote from \cref{sec:app:whymb:Cache Structure}): \begin{quote}
@@ -972,8 +989,8 @@ Example with a simple dash: \begin{fcvref}[ln:app:styleguide:samplecodesnippetlstlbl] Lines~\lnref{b}\=/\lnref{e} in \cref{lst:app:styleguide:LaTeX Source of Sample Code Snippet (Obsolete)} - are the contents of the verbbox environment. The box is output - by the \co{\\theverbbox} macro on \clnref{theverbbox}. + are the contents of the verbbox environment. + The box is output by the \co{\\theverbbox} macro on \clnref{theverbbox}. \end{fcvref} \end{quote}
@@ -983,8 +1000,8 @@ Example with an en dash: \begin{fcvref}[ln:app:styleguide:samplecodesnippetlstlbl] Lines~\lnref{b}\==\lnref{e} in \cref{lst:app:styleguide:LaTeX Source of Sample Code Snippet (Obsolete)} - are the contents of the verbbox environment. The box is output - by the \co{\\theverbbox} macro on \clnref{theverbbox}. + are the contents of the verbbox environment. + The box is output by the \co{\\theverbbox} macro on \clnref{theverbbox}. \end{fcvref} \end{quote}
@@ -993,8 +1010,8 @@ Example with an en dash: Numerical minus signs should be coded as math mode minus signs, namely \qco{$-$}.\footnote{This rule assumes that math mode uses the - same upright glyph as text mode. Our default font choice meets - the assumption. + same upright glyph as text mode. + Our default font choice meets the assumption. \IfSansSerif{ One of the experimental targets ``1csf'' \emph{does} use a differnt font for math mode figures as of October 2017.}{}
@@ -1011,8 +1028,8 @@ For example, \subsubsection{Ellipsis} \label{sec:app:styleguide:Ellipsis} -In monospace fonts, ellipses can be expressed by -series of periods. For example: +In monospace fonts, ellipses can be expressed by series of periods. +For example: \begin{quote} \verb|Great ... So how do I fix it?|
@@ -1029,9 +1046,10 @@ Standard \LaTeX\ defines the \verb|\dots| macro for this purpose. However, it has a kludge in the evenness of spaces. The ``ellipsis'' package redefines the \verb|\dots| macro to fix the issue.\footnote{To be exact, it is the \co{\\textellipsis} macro - that is redefined. The behavior of \co{\\dots} macro in math - mode is not affected. The ``amsmath'' package has another definition - of \co{\\dots}. It is not used in perfbook at the moment.} + that is redefined. + The behavior of \co{\\dots} macro in math mode is not affected. + The ``amsmath'' package has another definition of \co{\\dots}. + It is not used in perfbook at the moment.} By using \verb|\dots|, the above example is typeset as the following: \begin{quote}
@@ -1149,7 +1167,8 @@ is drawn by using the features of ``booktabs'' and ``xcolor'' packages. Note that ruled lines of booktabs can not be mixed with vertical lines in a table.\footnote{ There is another package named ``arydshln'' which provides dashed lines - to be used in tables. A couple of experimental examples are presented in + to be used in tables. + A couple of experimental examples are presented in \cref{sec:app:styleguide:Table Layout Experiment}. }
@@ -1190,10 +1209,11 @@ IBM~Q & $0.015$ \label{sec:app:styleguide:Position of Caption} In \LaTeX\ conventions, captions of tables are usually placed -above them. The reason is the flow of your eye movement -when you look at them. Most tables have a row of heading at the -top. You naturally look at the top of a table at first. Captions at -the bottom of tables disturb this flow. +above them. +The reason is the flow of your eye movement when you look at them. +Most tables have a row of heading at the top. +You naturally look at the top of a table at first. +Captions at the bottom of tables disturb this flow. The same can be said of code snippets, which are read from top to bottom.
@@ -1351,10 +1371,10 @@ and a \verb|\subref{}| macro, for example, It can also be cited by a \verb|\ref{}| macro, for example, ``\cref{sublst:app:styleguide:Enforcing Order}''. -Note the difference in the resulting format. For the citing by -a \verb|\ref{}| to work, you need to place the \verb|\label{}| -macro of the combined floating object ahead of the definition of -subfloats. +Note the difference in the resulting format. +For the citing by a \verb|\ref{}| to work, you need to place +the \verb|\label{}| macro of the combined floating object +ahead of the definition of subfloats. Otherwise, the resulting caption number would be off by one from the actual number.
@@ -1364,8 +1384,9 @@ from the actual number. This section presents some experimental tables using booktabs, xcolors, and arydshln packages. The corresponding tables in the text have been converted using one of -the format shown here. The source of this section can be regarded -as a reference to be consulted when new tables are added in the text. +the format shown here. +The source of this section can be regarded as a reference to be +consulted when new tables are added in the text. \begin{table} \rowcolors{1}{}{lightgray}
@@ -1415,7 +1436,8 @@ In the gap in the mid-rule corresponds to the distinction which had been represented by double vertical rules before the conversion. The legends in the frame box appended here explain the abbreviations used -in the matrix. Two types of memory barrier are denoted by subscripts here. +in the matrix. +Two types of memory barrier are denoted by subscripts here. The legends and subscripts are not present in \cref{tab:together:Synchronizing Reference Counting} since they are redundant there.
@@ -1508,15 +1530,16 @@ is a tweaked version of \cref{tab:defer:RCU Publish-Subscribe and Version Maintenance APIs}. Here, the ``Category'' column in the original is removed and the categories are indicated in rows of bold-face font -just below the mid-rules. This change makes it easier for -\verb|\rowcolors{}| command of ``xcolor'' package to work -properly. +just below the mid-rules. +This change makes it easier for \verb|\rowcolors{}| command of +``xcolor'' package to work properly. \Cref{tab:app:styleguide:RCU Publish-Subscribe and Version Maintenance APIs (colortbl)} is another version which keeps original columns and colors rows only where -a category has multiple rows. This is done by combining \verb|\rowcolors{}| -of ``xcolor'' and \verb|\cellcolor{}| commands of the ``colortbl'' -package (\verb|\cellcolor{}| overrides \verb|\rowcolors{}|). +a category has multiple rows. +This is done by combining \verb|\rowcolors{}| of ``xcolor'' and +\verb|\cellcolor{}| commands of the ``colortbl'' package +(\verb|\cellcolor{}| overrides \verb|\rowcolors{}|). In \cref{tab:defer:RCU Publish-Subscribe and Version Maintenance APIs},
Signature · 1 line
2.17.1
PATCH v2 8/9 treewide: Fix space in front of \cite{}
In reply to Akira Yokosawa--- debugging/debugging.tex | 4 ++-- formal/ppcmem.tex | 4 ++-- intro/intro.tex | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
debugging/debugging.tex +2 -2
@@ -760,8 +760,8 @@ viewpoint of developers thinking in terms of C as assembly language with additional syntax. KCSAN therefore provides a \co{data_race()} construct to forgive known-benign \IXpl{data race}, and also the \co{ASSERT_EXCLUSIVE_ACCESS()} -and \co{ASSERT_EXCLUSIVE_WRITER()} assertions to explicitly check -for data races\cite{MarcoElver2020FearDataRaceDetector1,MarcoElver2020FearDataRaceDetector2}. +and \co{ASSERT_EXCLUSIVE_WRITER()} assertions to explicitly check for data +races~\cite{MarcoElver2020FearDataRaceDetector1,MarcoElver2020FearDataRaceDetector2}. So what can be done in cases where checking is necessary, but where the overhead of runtime checking cannot be tolerated?
formal/ppcmem.tex +2 -2
@@ -356,8 +356,8 @@ cannot happen. on both sides. The ordering provided by \co{lwsync} is insufficient for this purpose, and so \co{sync} should be used instead. - This change has since been made~% - \cite{BoqunFeng2015:powerpc:value-returning-atomics} + This change has since been + made~\cite{BoqunFeng2015:powerpc:value-returning-atomics} in response to an email thread discussing a couple of other litmus tests~\cite{Paulmck2015:powerpc:value-returning-atomics}. Finding any other bugs that the Linux kernel might have is left
intro/intro.tex +1 -1
@@ -41,7 +41,7 @@ social-networking tools. As recently as 1968, such content creation was a far-out research project~\cite{DouglasEngelbart1968}, described at the time as -``like a UFO landing on the White House lawn''\cite{ScottGriffen2000}. +``like a UFO landing on the White House lawn''~\cite{ScottGriffen2000}. % http://www.ibiblio.org/pioneers/engelbart.html % http://www.histech.rwth-aachen.de/www/quellen/engelbart/ahi62index.html
Signature · 1 line
2.17.1
PATCH v2 9/9 treewide: Substitute ';' for ',' in label strings
In reply to Akira Yokosawaperiodcheck.pl relies on this change for "vs." within label strings to be ignored.
This change is also required for treewide conversion to \cref{}/\Cref{} and their variants.
"," is a delimiter of label strings in those cleveref macros.
--- SMPdesign/beyond.tex | 12 +++++------ SMPdesign/partexercises.tex | 12 +++++------ cpu/hwfreelunch.tex | 2 +- datastruct/datastruct.tex | 40 +++++++++++++++++------------------ defer/rcuapi.tex | 4 ++-- defer/refcnt.tex | 4 ++-- intro/intro.tex | 4 ++-- toolsoftrade/toolsoftrade.tex | 6 +++--- 8 files changed, 42 insertions(+), 42 deletions(-)
SMPdesign/beyond.tex +6 -6
@@ -370,11 +370,11 @@ array, and line~\lnref{ret:success} returns success. \centering \resizebox{2.2in}{!}{\includegraphics{SMPdesign/500-ms_seq_fg_part-cdf}} \caption{CDF of Solution Times For SEQ, PWQ, and PART} -\label{fig:SMPdesign:CDF of Solution Times For SEQ, PWQ, and PART} +\label{fig:SMPdesign:CDF of Solution Times For SEQ; PWQ; and PART} \end{figure} Performance testing revealed a surprising anomaly, shown in -Figure~\ref{fig:SMPdesign:CDF of Solution Times For SEQ, PWQ, and PART}. +Figure~\ref{fig:SMPdesign:CDF of Solution Times For SEQ; PWQ; and PART}. The median solution time for PART (17 milliseconds) is more than four times faster than that of SEQ (79 milliseconds), despite running on only two threads.
@@ -393,7 +393,7 @@ The next section analyzes this anomaly. The first reaction to a performance anomaly is to check for bugs. Although the algorithms were in fact finding valid solutions, the plot of CDFs in -Figure~\ref{fig:SMPdesign:CDF of Solution Times For SEQ, PWQ, and PART} +Figure~\ref{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, and then run all solvers on that maze.
@@ -577,10 +577,10 @@ were generated using -O3. \centering \resizebox{2.2in}{!}{\includegraphics{SMPdesign/1000-ms_2seqO3VfgO3_partO3-mean}} \caption{Mean Speedup vs.\@ Number of Threads, 1000x1000 Maze} -\label{fig:SMPdesign:Mean Speedup vs. Number of Threads, 1000x1000 Maze} +\label{fig:SMPdesign:Mean Speedup vs. Number of Threads; 1000x1000 Maze} \end{figure} -Figure~\ref{fig:SMPdesign:Mean Speedup vs. Number of Threads, 1000x1000 Maze} +Figure~\ref{fig:SMPdesign:Mean Speedup vs. Number of Threads; 1000x1000 Maze} shows the performance of PWQ and PART relative to COPART\@. For PART runs with more than two threads, the additional threads were started evenly spaced along the diagonal connecting the starting and
@@ -650,7 +650,7 @@ rather than as a grossly suboptimal after-the-fact micro-optimization to be retrofitted into existing programs. \section{Partitioning, Parallelism, and Optimization} -\label{sec:SMPdesign:Partitioning, Parallelism, and Optimization} +\label{sec:SMPdesign:Partitioning; Parallelism; and Optimization} % \epigraph{Knowledge is of no value unless you put it into practice.} {\emph{Anton Chekhov}}
SMPdesign/partexercises.tex +6 -6
@@ -64,7 +64,7 @@ shows, starvation of even a few of the philosophers is to be avoided. \centering \includegraphics[scale=.7]{SMPdesign/DiningPhilosopher5TB} \caption{Dining Philosophers Problem, Textbook Solution} -\ContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem, Textbook Solution}{Kornilios Kourtis} +\ContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem; Textbook Solution}{Kornilios Kourtis} \end{figure} \pplsur{Edsger W.}{Dijkstra}'s solution used a global semaphore,
@@ -77,7 +77,7 @@ in the late 1980s or early 1990s.\footnote{ is to publish something, wait 50 years, and then see how well \emph{your} ideas stood the test of time.} More recent solutions number the forks as shown in -Figure~\ref{fig:SMPdesign:Dining Philosophers Problem, Textbook Solution}. +Figure~\ref{fig:SMPdesign:Dining Philosophers Problem; Textbook Solution}. Each philosopher picks up the lowest-numbered fork next to his or her plate, then picks up the other fork. The philosopher sitting in the uppermost position in the diagram thus
@@ -114,11 +114,11 @@ It should be possible to do better than this! \centering \includegraphics[scale=.7]{SMPdesign/DiningPhilosopher4part-b} \caption{Dining Philosophers Problem, Partitioned} -\ContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem, Partitioned}{Kornilios Kourtis} +\ContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem; Partitioned}{Kornilios Kourtis} \end{figure} One approach is shown in -Figure~\ref{fig:SMPdesign:Dining Philosophers Problem, Partitioned}, +Figure~\ref{fig:SMPdesign:Dining Philosophers Problem; Partitioned}, which includes four philosophers rather than five to better illustrate the partition technique. Here the upper and rightmost philosophers share a pair of forks,
@@ -134,7 +134,7 @@ the acquisition and release algorithms. Philosophers Problem? }\QuickQuizAnswer{ One such improved solution is shown in - Figure~\ref{fig:SMPdesign:Dining Philosophers Problem, Fully Partitioned}, + Figure~\ref{fig:SMPdesign:Dining Philosophers Problem; Fully Partitioned}, where the philosophers are simply provided with an additional five forks. All five philosophers may now eat simultaneously, and there
@@ -145,7 +145,7 @@ the acquisition and release algorithms. \centering \includegraphics[scale=.7]{SMPdesign/DiningPhilosopher5PEM} \caption{Dining Philosophers Problem, Fully Partitioned} -\QContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem, Fully Partitioned}{Kornilios Kourtis} +\QContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem; Fully Partitioned}{Kornilios Kourtis} \end{figure} This solution might seem like cheating to some, but such
cpu/hwfreelunch.tex +1 -1
@@ -196,7 +196,7 @@ atoms on each of the billions of devices on a chip will have most excellent bragging rights, if nothing else! \subsection{Light, Not Electrons} -\label{sec:cpu:Light, Not Electrons} +\label{sec:cpu:Light; Not Electrons} Although the speed of light would be a hard limit, the fact is that semiconductor devices are limited by the speed of electricity rather
datastruct/datastruct.tex +20 -20
@@ -345,11 +345,11 @@ We can test this by increasing the number of hash buckets. \centering \resizebox{2.5in}{!}{\includegraphics{CodeSamples/datastruct/hash/data/hps.perf.2020.11.26a/zoocpubktsizelin}} \caption{Read-Only Hash-Table Performance For Schr\"odinger's Zoo, Varying Buckets} -\label{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo, Varying Buckets} +\label{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; Varying Buckets} \end{figure} However, as can be seen in -Figure~\ref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo, Varying Buckets}, +Figure~\ref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; Varying Buckets}, changing the number of buckets has almost no effect: Scalability is still abysmal. In particular, we still see a sharp dropoff at 29~CPUs and beyond.
@@ -584,10 +584,10 @@ RCU does slightly better than hazard pointers. \centering \resizebox{2.5in}{!}{\includegraphics{CodeSamples/datastruct/hash/data/hps.perf.2020.11.26a/zoocpulin}} \caption{Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo, Linear Scale} -\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo, Linear Scale} +\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo; Linear Scale} \end{figure} -Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo, Linear Scale} +Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo; Linear Scale} shows the same data on a linear scale. This drops the global-locking trace into the x-axis, but allows the non-ideal performance of RCU and hazard pointers to be more readily
@@ -615,13 +615,13 @@ advantage depends on the workload. \centering \resizebox{2.5in}{!}{\includegraphics{CodeSamples/datastruct/hash/data/hps.perf.2020.11.26a/zoocpulinqsbr}} \caption{Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo including QSBR, Linear Scale} -\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR, Linear Scale} +\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR; Linear Scale} \end{figure} But why is RCU's performance a factor of five less than ideal? One possibility is that the per-thread counters manipulated by \co{rcu_read_lock()} and \co{rcu_read_unlock()} are slowing things down. -Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR, Linear Scale} +Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR; Linear Scale} therefore adds the results for the QSBR variant of RCU, whose read-side primitives do nothing. And although QSBR does perform slightly better than does RCU, it is still
@@ -631,10 +631,10 @@ about a factor of five short of ideal. \centering \resizebox{2.5in}{!}{\includegraphics{CodeSamples/datastruct/hash/data/hps.perf.2020.11.26a/zoocpulinqsbrunsync}} \caption{Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo including QSBR and Unsynchronized, Linear Scale} -\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR and Unsynchronized, Linear Scale} +\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR and Unsynchronized; Linear Scale} \end{figure} -Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR and Unsynchronized, Linear Scale} +Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR and Unsynchronized; Linear Scale} adds completely unsynchronized results, which works because this is a read-only benchmark with nothing to synchronize. Even with no synchronization whatsoever, performance still falls far
@@ -647,7 +647,7 @@ on page~\pageref{tab:cpu:Cache Geometry for 8-Socket System With Intel Xeon Plat Each hash bucket (\co{struct ht_bucket}) occupies 56~bytes and each element (\co{struct zoo_he}) occupies 72~bytes for the RCU and QSBR runs. The benchmark generating -Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR and Unsynchronized, Linear Scale} +Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schroedinger's Zoo including QSBR and Unsynchronized; Linear Scale} used 262,144 buckets and up to 262,144 elements, for a total of 33,554,448~bytes, which not only overflows the 1,048,576-byte L2 caches by more than a factor of thirty, but is also uncomfortably close to the
@@ -681,8 +681,8 @@ to about half again faster than that of either QSBR or RCU\@. \QuickQuiz{ How can we be so sure that the hash-table size is at fault here, especially given that - Figure~\ref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo, Varying Buckets} - on page~\pageref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo, Varying Buckets} + Figure~\ref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; Varying Buckets} + on page~\pageref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; Varying Buckets} shows that varying hash-table size has almost no effect? Might the problem instead be something like false sharing?
@@ -698,12 +698,12 @@ to about half again faster than that of either QSBR or RCU\@. \centering \resizebox{3in}{!}{\includegraphics{CodeSamples/datastruct/hash/data/hps.perf-hashsize.2020.12.29a/zoohashsize}} \caption{Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo at 448 CPUs, Varying Table Size} -\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo at 448 CPUs, Varying Table Size} +\label{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo at 448 CPUs; Varying Table Size} \end{figure} Still unconvinced? Then look at the log-log plot in - Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo at 448 CPUs, Varying Table Size}, + Figure~\ref{fig:datastruct:Read-Only RCU-Protected Hash-Table Performance For Schr\"odinger's Zoo at 448 CPUs; Varying Table Size}, which shows performance for 448 CPUs as a function of the hash-table size, that is, number of buckets and maximum number of elements.
@@ -734,8 +734,8 @@ to about half again faster than that of either QSBR or RCU\@. a factor of 25. The reason that - Figure~\ref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo, Varying Buckets} - on page~\pageref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo, Varying Buckets} + Figure~\ref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; Varying Buckets} + on page~\pageref{fig:datastruct:Read-Only Hash-Table Performance For Schroedinger's Zoo; Varying Buckets} shows little effect is that its data was gathered from bucket-locked hash tables, where locking overhead and contention drowned out cache-capacity effects.
@@ -1514,11 +1514,11 @@ the old hash table, and finally line~\lnref{ret_success} returns success. \centering \resizebox{2.7in}{!}{\includegraphics{datastruct/perftestresize}} \caption{Overhead of Resizing Hash Tables Between 262,144 and 524,288 Buckets vs.\@ Total Number of Elements} -\label{fig:datastruct:Overhead of Resizing Hash Tables Between 262,144 and 524,288 Buckets vs. Total Number of Elements} +\label{fig:datastruct:Overhead of Resizing Hash Tables Between 262;144 and 524;288 Buckets vs. Total Number of Elements} \end{figure} % Data from CodeSamples/datastruct/hash/data/hps.resize.2020.09.05a -Figure~\ref{fig:datastruct:Overhead of Resizing Hash Tables Between 262,144 and 524,288 Buckets vs. Total Number of Elements} +Figure~\ref{fig:datastruct:Overhead of Resizing Hash Tables Between 262;144 and 524;288 Buckets vs. Total Number of Elements} compares resizing hash tables to their fixed-sized counterparts for 262,144 and 2,097,152 elements in the hash table. The figure shows three traces for each element count, one
@@ -1558,7 +1558,7 @@ bottleneck. \QuickQuiz{ How much of the difference in performance between the large and small hash tables shown in - Figure~\ref{fig:datastruct:Overhead of Resizing Hash Tables Between 262,144 and 524,288 Buckets vs. Total Number of Elements} + Figure~\ref{fig:datastruct:Overhead of Resizing Hash Tables Between 262;144 and 524;288 Buckets vs. Total Number of Elements} was due to long hash chains and how much was due to memory-system bottlenecks? }\QuickQuizAnswer{
@@ -1579,8 +1579,8 @@ bottleneck. the middle of \cref{fig:datastruct:Effect of Memory-System Bottlenecks on Hash Tables}. The other six traces are identical to their counterparts in - Figure~\ref{fig:datastruct:Overhead of Resizing Hash Tables Between 262,144 and 524,288 Buckets vs. Total Number of Elements} - on page~\pageref{fig:datastruct:Overhead of Resizing Hash Tables Between 262,144 and 524,288 Buckets vs. Total Number of Elements}. + Figure~\ref{fig:datastruct:Overhead of Resizing Hash Tables Between 262;144 and 524;288 Buckets vs. Total Number of Elements} + on page~\pageref{fig:datastruct:Overhead of Resizing Hash Tables Between 262;144 and 524;288 Buckets vs. Total Number of Elements}. The gap between this new trace and the lower set of three traces is a rough measure of how much of the difference in performance was due to hash-chain length, and the gap between
defer/rcuapi.tex +2 -2
@@ -20,7 +20,7 @@ presents RCU's diagnostic APIs, and Section~\ref{sec:defer:Where Can RCU's APIs Be Used?} describes in which contexts RCU's various APIs may be used. Finally, -Section~\ref{sec:defer:So, What is RCU Really?} +Section~\ref{sec:defer:So; What is RCU Really?} presents concluding remarks. Readers who are not excited about kernel internals may wish to skip
@@ -1097,7 +1097,7 @@ for example, \co{srcu_read_lock()} may be used in any context in which \co{rcu_read_lock()} may be used. \subsubsection{So, What \emph{is} RCU Really?} -\label{sec:defer:So, What is RCU Really?} +\label{sec:defer:So; What is RCU Really?} At its core, RCU is nothing more nor less than an API that supports publication and subscription for insertions, waiting for all RCU readers
defer/refcnt.tex +2 -2
@@ -182,10 +182,10 @@ the atoms used in modern digital electronics. \centering \resizebox{2.5in}{!}{\includegraphics{CodeSamples/defer/perf-refcnt-logscale}} \caption{Pre-BSD Routing Table Protected by Reference Counting, Log Scale} -\label{fig:defer:Pre-BSD Routing Table Protected by Reference Counting, Log Scale} +\label{fig:defer:Pre-BSD Routing Table Protected by Reference Counting; Log Scale} \end{figure} - Figure~\ref{fig:defer:Pre-BSD Routing Table Protected by Reference Counting, Log Scale} + Figure~\ref{fig:defer:Pre-BSD Routing Table Protected by Reference Counting; Log Scale} shows the same data, but on a log-log plot. As you can see, the refcnt line drops below 5,000 at two CPUs. This means that the refcnt performance at two CPUs is more than
intro/intro.tex +2 -2
@@ -592,7 +592,7 @@ programming environments: \centering \resizebox{2.5in}{!}{\includegraphics{intro/PPGrelation}} \caption{Software Layers and Performance, Productivity, and Generality} -\label{fig:intro:Software Layers and Performance, Productivity, and Generality} +\label{fig:intro:Software Layers and Performance; Productivity; and Generality} \end{figure} The nirvana of parallel programming environments, one that offers
@@ -601,7 +601,7 @@ not yet exist. Until such a nirvana appears, it will be necessary to make engineering tradeoffs among performance, productivity, and generality. One such tradeoff is shown in -Figure~\ref{fig:intro:Software Layers and Performance, Productivity, and Generality}, +Figure~\ref{fig:intro:Software Layers and Performance; Productivity; and Generality}, which shows how productivity becomes increasingly important at the upper layers of the system stack, while performance and generality become increasingly important at the
toolsoftrade/toolsoftrade.tex +3 -3
@@ -1231,7 +1231,7 @@ code or whether the kernel's boot-time code is in fact the required initialization code. \subsection{Thread Creation, Destruction, and Control} -\label{sec:toolsoftrade:Thread Creation, Destruction, and Control} +\label{sec:toolsoftrade:Thread Creation; Destruction; and Control} The Linux kernel uses \apik{struct task_struct} pointers to track kthreads,
@@ -2135,7 +2135,7 @@ if (ptr != NULL && ptr < high_address) \end{VerbatimL} \end{fcvlabel} \caption{Avoiding Danger, 2018 Style} -\label{lst:toolsoftrade:Avoiding Danger, 2018 Style} +\label{lst:toolsoftrade:Avoiding Danger; 2018 Style} \end{listing} Using \apik{READ_ONCE()} on
@@ -2143,7 +2143,7 @@ line~\ref{ln:toolsoftrade:Living Dangerously Early 1990s Style:temp} of Listing~\ref{lst:toolsoftrade:Living Dangerously Early 1990s Style} avoids invented loads, resulting in the code shown in -Listing~\ref{lst:toolsoftrade:Avoiding Danger, 2018 Style}. +Listing~\ref{lst:toolsoftrade:Avoiding Danger; 2018 Style}. \begin{listing} \begin{fcvlabel}[ln:toolsoftrade:Preventing Load Fusing]
Signature · 1 line
2.17.1
Paul E. McKenney
AppliedQuoted 13 lines · Akira Yokosawa
Hi Paul,
This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.
Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.
Quoted 5 lines
After Patch 9/9 is applied, "make periodcheck" will be clean.
I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.
Queued and pushed, thank you!
Would it make sense at some point to have "make periodcheck" happen automatically during a normal build to catch addition of issues with new content?
Thanx, Paul
Quoted 54 lines
Thanks, Akira
--
Akira Yokosawa (9):
Annotate mid-sentence and end-of-sentence periods
periodcheck: Add script to check missing annotation of period
periodcheck: Add check of nbsp in front of \cite{}
periodcheck: Improve label string matching
periodcheck: Replace escaped percent symbol first
treewide: Make end-of-sentence periods be at end of lines
styleguide: Make end-of-sentence periods be at the end of lines
treewide: Fix space in front of \cite{}
treewide: Substitute ';' for ',' in label stringsMakefile | 5 +- SMPdesign/SMPdesign.tex | 36 ++-- SMPdesign/beyond.tex | 15 +- SMPdesign/criteria.tex | 4 +- SMPdesign/partexercises.tex | 12 +- ack.tex | 2 +- advsync/rt.tex | 7 +- appendix/styleguide/styleguide.tex | 237 +++++++++++++++------------ appendix/whymb/whymemorybarriers.tex | 71 ++++---- count/count.tex | 11 +- cpu/hwfreelunch.tex | 2 +- datastruct/datastruct.tex | 55 ++++--- debugging/debugging.tex | 16 +- defer/defer.tex | 4 +- defer/hazptr.tex | 7 +- defer/rcuapi.tex | 4 +- defer/rcufundamental.tex | 5 +- defer/refcnt.tex | 4 +- easy/easy.tex | 3 +- formal/dyntickrcu.tex | 15 +- formal/ppcmem.tex | 184 +++++++++++---------- formal/spinhint.tex | 148 +++++++++-------- glossary.tex | 9 +- howto/howto.tex | 2 +- intro/intro.tex | 33 ++-- legal.tex | 9 +- locking/locking.tex | 5 +- memorder/memorder.tex | 12 +- owned/owned.tex | 5 +- together/refcnt.tex | 4 +- toolsoftrade/toolsoftrade.tex | 9 +- utilities/periodcheck.pl | 87 ++++++++++ utilities/periodcheck.sh | 23 +++ 33 files changed, 627 insertions(+), 418 deletions(-) create mode 100755 utilities/periodcheck.pl create mode 100755 utilities/periodcheck.shSignature · 1 line
2.17.1
Quoted 20 lines · Paul E. McKenney
Quoted 13 lines · Akira Yokosawa
Hi Paul,
This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.
Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.Quoted 5 lines
After Patch 9/9 is applied, "make periodcheck" will be clean.
I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.
Quoted 7 lines
Queued and pushed, thank you!
Would it make sense at some point to have "make periodcheck" happen automatically during a normal build to catch addition of issues with new content?
Thanx, Paul
Like this?
Note that positive periodcheck doesn't cause a make error. It can be promoted to a real error later when we feel confident of the script.
"make 2c" (or any explicit target) doesn't run the script.
Thanks, Akira
--------8<--------------------------
From: Akira Yokosawa <[email protected]>
Date: Wed, 28 Apr 2021 07:26:05 +0900
Subject: [PATCH] Auto run periodcheck on 'make'
Run periodcheck on "make" and "make all".
Now they are the same as "make periodcheck".
"make periodcheck" builds your default target before the check.
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -194,7 +194,7 @@ BASE_DEPENDS := perfbook.tex $(foreach v,tcb 1c msns mss mstx msr msn msnt sf nq .PHONY: help-experimental help-prefixed .PHONY: paper-clean periodcheck -all: $(targ) +all: periodcheck ifeq ($(MAKECMDGOALS),clean) else ifeq ($(MAKECMDGOALS),distclean)
@@ -611,7 +611,7 @@ ls-unused: neatfreak: distclean find . -name '*.pdf' | xargs rm -f -periodcheck: +periodcheck: $(targ) utilities/periodcheck.sh .SECONDEXPANSION:
Signature · 1 line
2.17.1
Quoted 27 lines · Akira Yokosawa
Quoted 26 lines · Paul E. McKenney
Quoted 13 lines · Akira Yokosawa
Hi Paul,
This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.
Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.Quoted 5 lines
After Patch 9/9 is applied, "make periodcheck" will be clean.
I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.
Queued and pushed, thank you!
Would it make sense at some point to have "make periodcheck" happen automatically during a normal build to catch addition of issues with new content?
Quoted 8 lines
Quoted 1 line
Thanx, Paul
Like this?
Note that positive periodcheck doesn't cause a make error. It can be promoted to a real error later when we feel confident of the script."make 2c" (or any explicit target) doesn't run the script.
This does work!
But I feel compelled to expose the ancient nature of my Makefile knowledge and ask why not this single change?
all: $(targ) periodcheck
Thanx, Paul
Quoted 44 lines
Thanks, Akira
--------8<--------------------------
From: Akira Yokosawa <[email protected]>
Date: Wed, 28 Apr 2021 07:26:05 +0900
Subject: [PATCH] Auto run periodcheck on 'make'Run periodcheck on "make" and "make all".
Now they are the same as "make periodcheck".
"make periodcheck" builds your default target before the check.Suggested-by Paul E. McKenney <[email protected]>Signed-off-by Akira Yokosawa <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -194,7 +194,7 @@ BASE_DEPENDS := perfbook.tex $(foreach v,tcb 1c msns mss mstx msr msn msnt sf nq .PHONY: help-experimental help-prefixed .PHONY: paper-clean periodcheck -all: $(targ) +all: periodcheck ifeq ($(MAKECMDGOALS),clean) else ifeq ($(MAKECMDGOALS),distclean)@@ -611,7 +611,7 @@ ls-unused: neatfreak: distclean find . -name '*.pdf' | xargs rm -f -periodcheck: +periodcheck: $(targ) utilities/periodcheck.sh .SECONDEXPANSION:Signature · 1 line
2.17.1
Quoted 35 lines · Paul E. McKenney
Quoted 34 lines · Akira Yokosawa
Quoted 20 lines · Paul E. McKenney
Quoted 13 lines · Akira Yokosawa
Hi Paul,
This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.
Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.Quoted 5 lines
After Patch 9/9 is applied, "make periodcheck" will be clean.
I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.
Quoted 7 lines
Queued and pushed, thank you!
Would it make sense at some point to have "make periodcheck" happen automatically during a normal build to catch addition of issues with new content?
Thanx, Paul
Like this?
Note that positive periodcheck doesn't cause a make error. It can be promoted to a real error later when we feel confident of the script.
Quoted 8 lines
Quoted 1 line
"make 2c" (or any explicit target) doesn't run the script.
This does work!
But I feel compelled to expose the ancient nature of my
Makefileknowledge and ask why not this single change?all: $(targ) periodcheck
You might miss the output from periodcheck if you do
"make -jN"
, without the dependency of "periodcheck: $(targ)".
Thanks, Akira
Quoted 47 lines
Thanx, Paul
Quoted 44 lines
Thanks, Akira
--------8<--------------------------
From: Akira Yokosawa <[email protected]>
Date: Wed, 28 Apr 2021 07:26:05 +0900
Subject: [PATCH] Auto run periodcheck on 'make'Run periodcheck on "make" and "make all".
Now they are the same as "make periodcheck".
"make periodcheck" builds your default target before the check.Suggested-by Paul E. McKenney <[email protected]>Signed-off-by Akira Yokosawa <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -194,7 +194,7 @@ BASE_DEPENDS := perfbook.tex $(foreach v,tcb 1c msns mss mstx msr msn msnt sf nq .PHONY: help-experimental help-prefixed .PHONY: paper-clean periodcheck -all: $(targ) +all: periodcheck ifeq ($(MAKECMDGOALS),clean) else ifeq ($(MAKECMDGOALS),distclean)@@ -611,7 +611,7 @@ ls-unused: neatfreak: distclean find . -name '*.pdf' | xargs rm -f -periodcheck: +periodcheck: $(targ) utilities/periodcheck.sh .SECONDEXPANSION:Signature · 1 line
2.17.1
Quoted 43 lines · Akira Yokosawa
Quoted 42 lines · Paul E. McKenney
Quoted 27 lines · Akira Yokosawa
Quoted 26 lines · Paul E. McKenney
Quoted 13 lines · Akira Yokosawa
Hi Paul,
This patch set adds a set of scripts to check proper annotation of periods to distinguish single and double spacing.
Patch 1/9 adds a couple of annotations in-development version of the script had caught.
Patches 2/9--5/9 add and improve the set of scripts. They are kept separate patches to show the history. Patches 6/9--9/9 are fixes in LaTeX sources to satisfy the script. There are quite a few sentences which end in the middle of input lines.Quoted 5 lines
After Patch 9/9 is applied, "make periodcheck" will be clean.
I'm not saying the perl script is complete. There can still be false negatives I'm not aware of. False positives can happen when you add new contents.
Queued and pushed, thank you!
Would it make sense at some point to have "make periodcheck" happen automatically during a normal build to catch addition of issues with new content?
Quoted 8 lines
Quoted 1 line
Thanx, Paul
Like this?
Note that positive periodcheck doesn't cause a make error. It can be promoted to a real error later when we feel confident of the script."make 2c" (or any explicit target) doesn't run the script.
This does work!
But I feel compelled to expose the ancient nature of my
Makefileknowledge and ask why not this single change?
Quoted 7 lines
Quoted 1 line
all: $(targ) periodcheck
You might miss the output from periodcheck if you do
"make -jN", without the dependency of "periodcheck: $(targ)".
Excellent point, thank you!
Thanx, Paul
Quoted 49 lines
Thanks, Akira
Quoted 47 lines
Thanx, Paul
Quoted 44 lines
Thanks, Akira
--------8<--------------------------
From: Akira Yokosawa <[email protected]>
Date: Wed, 28 Apr 2021 07:26:05 +0900
Subject: [PATCH] Auto run periodcheck on 'make'Run periodcheck on "make" and "make all".
Now they are the same as "make periodcheck".
"make periodcheck" builds your default target before the check.Suggested-by Paul E. McKenney <[email protected]>Signed-off-by Akira Yokosawa <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -194,7 +194,7 @@ BASE_DEPENDS := perfbook.tex $(foreach v,tcb 1c msns mss mstx msr msn msnt sf nq .PHONY: help-experimental help-prefixed .PHONY: paper-clean periodcheck -all: $(targ) +all: periodcheck ifeq ($(MAKECMDGOALS),clean) else ifeq ($(MAKECMDGOALS),distclean)@@ -611,7 +611,7 @@ ls-unused: neatfreak: distclean find . -name '*.pdf' | xargs rm -f -periodcheck: +periodcheck: $(targ) utilities/periodcheck.sh .SECONDEXPANSION:Signature · 1 line
2.17.1