perfbook.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elad Lahav <e2lahav@gmail.com>
To: perfbook@vger.kernel.org
Subject: Comments on Section 7.1
Date: Mon, 26 Sep 2022 21:48:33 -0400	[thread overview]
Message-ID: <CAJbg=FVkC51pkG_cO-bBgfYq1pcug9B=ECEkmcNHLg+3HDbB4A@mail.gmail.com> (raw)

This started out as a longer email, but it looks like at least two of
the problems I spotted were already fixed in the latest version.

1. I think the recommendation to release all locks before invoking a
user-supplied function should come with a BIG FLASHING WARNING SIGN
(or the PDF equivalent). Whenever I review code that releases and
re-acquires a lock I look for the faulty assumptions it makes about
state being preserved from before the lock was released. 9 out of 10
times I find a bug.

2. qsort() may not be the best example to use in this section, as,
even assuming there is some version of it that requires locks, the
reader may fail to see any problems. While I'm no fan of nftw(), it
may be easier to see why you would need a lock in the library (to
prevent changes to the directory), as well as why releasing and
re-acquiring the lock can be dangerous (the iterator can become
invalid).

3. Page 106, first paragraph: "an pointer" should be "a pointer".

--Elad

             reply	other threads:[~2022-09-27  1:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  1:48 Elad Lahav [this message]
2022-09-27 19:06 ` Comments on Section 7.1 Paul E. McKenney
2022-09-27 19:12   ` Elad Lahav
2022-09-27 20:04     ` 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='CAJbg=FVkC51pkG_cO-bBgfYq1pcug9B=ECEkmcNHLg+3HDbB4A@mail.gmail.com' \
    --to=e2lahav@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).