perfbook.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>, Elad Lahav <e2lahav@gmail.com>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH] SMPdesign: Fix command characters in code snippets
Date: Tue, 13 Sep 2022 09:18:13 +0900	[thread overview]
Message-ID: <f7d486c3-34f4-0908-7221-41ab634378d3@gmail.com> (raw)

Some of listings in Chapter 6 use the command character option of
"commandchars=\\\[\]".
This collides with "[" and "]" in the code snippets and removes
them in the resulting listings.

Fix the issue by using "commandchars=\\\@\$" instead and adjusting
the \lnlbl commands.

Reported-by: Elad Lahav <e2lahav@gmail.com>
Fixes: 2c8eae0b8c65 ("SMPdesign: Employ new scheme for inline snippets")
Fixes: 05d62c297542 ("SMPdesign: Apply \clnref{} scheme to Listing 6.5")
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 SMPdesign/SMPdesign.tex | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/SMPdesign/SMPdesign.tex b/SMPdesign/SMPdesign.tex
index 05b86ec7271b..70936c12ce7e 100644
--- a/SMPdesign/SMPdesign.tex
+++ b/SMPdesign/SMPdesign.tex
@@ -134,7 +134,7 @@ careful choice of data structure, can be arbitrarily large.
 On the other hand, if you are not in this happy situation, read on!
 
 \begin{listing}
-\begin{VerbatimL}[commandchars=\\\[\]]
+\begin{VerbatimL}[commandchars=\\\@\$]
 struct hash_table
 {
 	long nbuckets;
@@ -209,7 +209,7 @@ lock before returning.
 
 \begin{listing}
 \begin{fcvlabel}[ln:SMPdesign:Code-Locking Hash Table Search]
-\begin{VerbatimL}[commandchars=\\\[\]]
+\begin{VerbatimL}[commandchars=\\\@\$]
 spinlock_t hash_lock;
 
 struct hash_table
@@ -228,17 +228,17 @@ int hash_search(struct hash_table *h, long key)
 	struct node *cur;
 	int retval;
 
-	spin_lock(&hash_lock);				\lnlbl[acq]
+	spin_lock(&hash_lock);				\lnlbl@acq$
 	cur = h->buckets[key % h->nbuckets];
 	while (cur != NULL) {
 		if (cur->key >= key) {
 			retval = (cur->key == key);
-			spin_unlock(&hash_lock);	\lnlbl[rel1]
+			spin_unlock(&hash_lock);	\lnlbl@rel1$
 			return retval;
 		}
 		cur = cur->next;
 	}
-	spin_unlock(&hash_lock);			\lnlbl[rel2]
+	spin_unlock(&hash_lock);			\lnlbl@rel2$
 	return 0;
 }
 \end{VerbatimL}
@@ -912,7 +912,7 @@ the POSIX implementation described in
 shows how the hash search might be implemented using reader-writer locking.
 
 \begin{listing}
-\begin{VerbatimL}[commandchars=\\\[\]]
+\begin{VerbatimL}[commandchars=\\\@\$]
 rwlock_t hash_lock;
 
 struct hash_table
@@ -972,7 +972,7 @@ and likely perform better.
 
 \begin{listing}
 \begin{fcvlabel}[ln:SMPdesign:Hierarchical-Locking Hash Table Search]
-\begin{VerbatimL}[commandchars=\\\[\]]
+\begin{VerbatimL}[commandchars=\\\@\$]
 struct hash_table
 {
 	long nbuckets;
@@ -1003,7 +1003,7 @@ int hash_search(struct hash_table *h, long key)
 		if (cur->key >= key) {
 			spin_lock(&cur->node_lock);
 			spin_unlock(&bp->bucket_lock);
-			retval = (cur->key == key);\lnlbl[retval]
+			retval = (cur->key == key);\lnlbl@retval$
 			spin_unlock(&cur->node_lock);
 			return retval;
 		}

base-commit: 34400fe10ca37b884ee64f7bd2b93d5cccfe675d
-- 
2.25.1


             reply	other threads:[~2022-09-13  0:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  0:18 Akira Yokosawa [this message]
2022-09-13  7:51 ` [PATCH] SMPdesign: Fix command characters in code snippets Paul E. McKenney
2022-09-13 10:26   ` Elad Lahav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7d486c3-34f4-0908-7221-41ab634378d3@gmail.com \
    --to=akiyks@gmail.com \
    --cc=e2lahav@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).