From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: Mark Morrissey <markem@pdx.edu>
Cc: alexey.roytman@oracle.com, perfbook@vger.kernel.org
Subject: Re: Parallel programming book query
Date: Wed, 19 Dec 2018 20:35:00 -0800 [thread overview]
Message-ID: <20181220043500.GA4170@linux.ibm.com> (raw)
In-Reply-To: <CAGnMLyyOaXro0g1q7ipnQVk1ei0dwiQGwqROBH+F=JoQmkoOzA@mail.gmail.com>
No, that would work. Not something I would think of because there is
no globally accessible ceil() function in the Linux kernel. ;-)
I have queued a patch with your Reported-by as shown at the end of this
email. Please let me know if I messed anything up.
Thanx, Paul
On Wed, Dec 19, 2018 at 05:13:01PM -0800, Mark Morrissey wrote:
> I agree that it is equivalent to:
>
> p = s * ceil(m/s)
>
> But why not just perform that calculation? If it is based on either
> efficiency or clock cycles, I don't see it. I admit to not having looked at
> the implementation of the ceil() library routine. If I should look at
> ceil(), then just slap me and I will understand.
>
> --mark
> --
> Mark Morrissey, markem@pdx.edu
> Senior Instructor, Computer Science
> Portland State University
>
>
> On Wed, Dec 19, 2018 at 4:45 PM Paul E. McKenney <paulmck@linux.ibm.com>
> wrote:
>
> > On Mon, Dec 17, 2018 at 01:04:37PM -0800, Mark Morrissey wrote:
> > > Hi Paul,
> > >
> > > I am looking at your parallel programming book, 12/5/2018 version. In
> > > formula E.6, you use the floor function rather than the ceiling function.
> > > Is this deliberate or perhaps in error?
> >
> > Good question!
> >
> > The intent is that the "+ s - 1" in the numerator does the upwards part
> > of the rounding, and the floor function does the rest.
> >
> > Or am I missing something here? It should be possible to express this
> > in terms of the ceiling function, though that would be further removed
> > from C code implementing this equation.
> >
> > Adding Alexey and the list on CC. This is on page 423 (PDF page 435) of
> >
> > https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.2018.12.08a.pdf
------------------------------------------------------------------------
commit 9d317176364184ad6ef55fdab5535449fb8d110d
Author: Paul E. McKenney <paulmck@linux.ibm.com>
Date: Wed Dec 19 20:30:28 2018 -0800
SMPdesign: Use ceiling symbol, skip odd floor computation
Equation E.6 in Quick Quiz 6.20 computes the floor function of
"(m + 2 - 1) / s", which is just the ceiling function of "m / s".
This commit therefore moves to this simpler formulation, on the
strength of the ceil() function in the standard library. The fact
that ceil() is not globally available in the Linux kernel, which
motivated the original, seems a bit irrelevant, hence the change.
Reported-by: Mark Morrissey <markem@pdx.edu>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
diff --git a/SMPdesign/SMPdesign.tex b/SMPdesign/SMPdesign.tex
index fe8f445851e3..0ba7ebd04fe6 100644
--- a/SMPdesign/SMPdesign.tex
+++ b/SMPdesign/SMPdesign.tex
@@ -1177,7 +1177,7 @@ this book.
$m$ rounded up to the next multiple of $s$, as follows:
\begin{equation}
- p = s \left \lfloor \frac{m + s - 1}{s} \right \rfloor
+ p = s \left \lceil \frac{m}{s} \right \rceil
\label{sec:SMPdesign:p}
\end{equation}
next prev parent reply other threads:[~2018-12-20 4:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAGnMLyzE5pjntT4Hz1PZaLKbz-2LSP=ziK60yWyNbwr4=WBdAg@mail.gmail.com>
2018-12-20 0:45 ` Parallel programming book query Paul E. McKenney
2018-12-20 1:13 ` Mark Morrissey
2018-12-20 4:35 ` Paul E. McKenney [this message]
2018-12-20 16:17 ` Mark Morrissey
2018-12-20 16:56 ` 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=20181220043500.GA4170@linux.ibm.com \
--to=paulmck@linux.ibm.com \
--cc=alexey.roytman@oracle.com \
--cc=markem@pdx.edu \
--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