Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: Junchang Wang <junchangwang@gmail.com>
Cc: Akira Yokosawa <akiyks@gmail.com>, perfbook@vger.kernel.org
Subject: Re: [PATCH 1/7] toyrcu: Convert Listing B.1 to new scheme
Date: Mon, 22 Jul 2019 05:34:07 -0700	[thread overview]
Message-ID: <20190722123407.GC14271@linux.ibm.com> (raw)
In-Reply-To: <CABoNC80vzXtMx2_jW4Ln9c8JxSsAdT4uq2fxaFW=-HLvQtNhhA@mail.gmail.com>

On Sun, Jul 21, 2019 at 08:07:11PM +0800, Junchang Wang wrote:
> Hi Akira,
> 
> Thanks for the patch. The new scheme worked great as a good example of
> composing my commits. So,
> 
> Acked-by: Junchang Wang <junchangwang@gmail.com>

Thank you both!  I have queued and pushed this series, with Junchang's
ack on this patch.

							Thanx, Paul

> Thanks,
> --Junchang
> 
> On Sun, Jul 21, 2019 at 8:02 AM Akira Yokosawa <akiyks@gmail.com> wrote:
> >
> > From 245899f43fd007aa344180c0089515cd90f84db2 Mon Sep 17 00:00:00 2001
> > From: Akira Yokosawa <akiyks@gmail.com>
> > Date: Sat, 27 Apr 2019 21:04:40 +0900
> > Subject: [PATCH 1/7] toyrcu: Convert Listing B.1 to new scheme
> >
> > This commit was originally presented to Junchang as an example where
> > code fragments extracted from two source files under CodeSamples/ are
> > merged into a code snippet.
> >
> > Junchan employed this scheme in commits 686f3f3b721c ("rcu: Use
> > READ_ONCE() and WRITE_ONCE() for shared variable rcu_gp_ctr"),
> > a26c1625bb0d ("rcu_qs: Use READ_ONCE() AND WRITE_ONCE() for shared
> > variable rcu_gp_ctr"), and b9696a4a456f ("rcu_nest: Update description
> > of rcu_nest.[hc]").
> >
> > Extra vertical space needs to be canceled by the \vspace*{} command
> > between the two \input{} commands.
> > \fvset{firstnumber=last} is to continue line numbering.
> > \fvset{firstnumber=auto} restores the default setting.
> >
> > Also tweak positioning option of the listing environment.
> >
> > Cc: Junchang Wang <junchangwang@gmail.com>
> > Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> > ---
> >  CodeSamples/defer/rcu_lock.c |  2 ++
> >  CodeSamples/defer/rcu_lock.h |  2 ++
> >  appendix/toyrcu/toyrcu.tex   | 26 ++++----------------------
> >  3 files changed, 8 insertions(+), 22 deletions(-)
> >
> > diff --git a/CodeSamples/defer/rcu_lock.c b/CodeSamples/defer/rcu_lock.c
> > index 8d45ac89..08b87fbd 100644
> > --- a/CodeSamples/defer/rcu_lock.c
> > +++ b/CodeSamples/defer/rcu_lock.c
> > @@ -20,12 +20,14 @@
> >
> >  #include "../api.h"
> >  #include "rcu_lock.h"
> > +//\begin{snippet}[labelbase=ln:defer:rcu_lock:synchronize,commandchars=\\\[\]]
> >
> >  void synchronize_rcu(void)
> >  {
> >         spin_lock(&rcu_gp_lock);
> >         spin_unlock(&rcu_gp_lock);
> >  }
> > +//\end{snippet}
> >
> >  #ifdef TEST
> >  #include "rcutorture.h"
> > diff --git a/CodeSamples/defer/rcu_lock.h b/CodeSamples/defer/rcu_lock.h
> > index 224ea0e4..bf6f9b3c 100644
> > --- a/CodeSamples/defer/rcu_lock.h
> > +++ b/CodeSamples/defer/rcu_lock.h
> > @@ -26,6 +26,7 @@ static void rcu_init(void)
> >  {
> >  }
> >
> > +//\begin{snippet}[labelbase=ln:defer:rcu_lock:lock_unlock,commandchars=\\\[\]]
> >  static void rcu_read_lock(void)
> >  {
> >         spin_lock(&rcu_gp_lock);
> > @@ -35,5 +36,6 @@ static void rcu_read_unlock(void)
> >  {
> >         spin_unlock(&rcu_gp_lock);
> >  }
> > +//\end{snippet}
> >
> >  extern void synchronize_rcu(void);
> > diff --git a/appendix/toyrcu/toyrcu.tex b/appendix/toyrcu/toyrcu.tex
> > index 0e84b058..d876595b 100644
> > --- a/appendix/toyrcu/toyrcu.tex
> > +++ b/appendix/toyrcu/toyrcu.tex
> > @@ -30,29 +30,11 @@ provides a summary and a list of desirable RCU properties.
> >
> >  \section{Lock-Based RCU}
> >  \label{sec:app:toyrcu:Lock-Based RCU}
> > +\NoIndentAfterThis
> >
> > -\begin{listing}[bp]
> > -{ \scriptsize
> > -\begin{verbbox}
> > -  1 static void rcu_read_lock(void)
> > -  2 {
> > -  3   spin_lock(&rcu_gp_lock);
> > -  4 }
> > -  5
> > -  6 static void rcu_read_unlock(void)
> > -  7 {
> > -  8   spin_unlock(&rcu_gp_lock);
> > -  9 }
> > - 10
> > - 11 void synchronize_rcu(void)
> > - 12 {
> > - 13   spin_lock(&rcu_gp_lock);
> > - 14   spin_unlock(&rcu_gp_lock);
> > - 15 }
> > -\end{verbbox}
> > -}
> > -\centering
> > -\theverbbox
> > +\begin{listing}[htbp]
> > +\input{CodeSamples/defer/rcu_lock@lock_unlock.fcv}\vspace*{-11pt}\fvset{firstnumber=last}
> > +\input{CodeSamples/defer/rcu_lock@synchronize.fcv}\fvset{firstnumber=auto}
> >  \caption{Lock-Based RCU Implementation}
> >  \label{lst:app:toyrcu:Lock-Based RCU Implementation}
> >  \end{listing}
> > --
> > 2.17.1
> >
> >
> 


  reply	other threads:[~2019-07-22 12:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-20 23:59 [PATCH 0/7] Collection of small fixes and updates Akira Yokosawa
2019-07-21  0:01 ` [PATCH 1/7] toyrcu: Convert Listing B.1 to new scheme Akira Yokosawa
2019-07-21 12:07   ` Junchang Wang
2019-07-22 12:34     ` Paul E. McKenney [this message]
2019-07-22 15:12       ` Akira Yokosawa
2019-07-22 16:28         ` Paul E. McKenney
2019-07-24 15:04           ` Akira Yokosawa
2019-07-21  0:03 ` [PATCH 2/7] toyrcu: Extract Listing B.15 from rcu_nest.h Akira Yokosawa
2019-07-21 12:10   ` Junchang Wang
2019-07-21  0:07 ` [PATCH 3/7] toolsoftrade: Fix typo Akira Yokosawa
2019-07-21  0:08 ` [PATCH 4/7] FAQ-BUILD: Update for recent Fedora releases Akira Yokosawa
2019-07-21  0:10 ` [PATCH 5/7] howto: Stop mentioning quantum computing Akira Yokosawa
2019-07-21  0:12 ` [PATCH 6/7] toyrcu: Extract Listing B.13 from rcu.h Akira Yokosawa
2019-07-21 12:12   ` Junchang Wang
2019-07-21  0:13 ` [PATCH 7/7] styleguide: Update description of available options to \begin{snippet} Akira Yokosawa
2019-07-21  0:17 ` [PATCH 0/7] Collection of small fixes and updates Akira Yokosawa
2019-07-22 12:34 ` Paul E. McKenney

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=20190722123407.GC14271@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=akiyks@gmail.com \
    --cc=junchangwang@gmail.com \
    --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