mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SeongJae Park <sj38.park@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: SeongJae Park <sj38.park@gmail.com>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-doc <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Documentation/memory-barriers: fix wrong comment in example
Date: Mon, 22 Feb 2016 20:08:15 +0900 (KST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1602222006200.16296@hxeon> (raw)
In-Reply-To: <26215.1456135273@warthog.procyon.org.uk>



On Mon, 22 Feb 2016, David Howells wrote:

> SeongJae Park <sj38.park@gmail.com> wrote:
>
>>   a = 0;
>>   /* Code that does not store to variable a. */
>> + does_not_change_a();
>>   a = 0;
>
> Since it's not actually code that's meant to be executed, you could make it:
>
> 	a = 0;
> 	... code that does not store to variable a ...
> 	a = 0;

I selected Paul's third option because the function could be noop (In this
case, it doesn't break the original meaning) and it makes the code looks
complete.
However, your suggestion looks much better than the comment, too.

So, I am attaching a patch that applying your suggestion below.


=============================== >3 ====================================
>From f7b5677790771599f418f1d95536935be971ae86 Mon Sep 17 00:00:00 2001
From: SeongJae Park <sj38.park@gmail.com>
Date: Mon, 22 Feb 2016 19:26:18 +0900
Subject: [PATCH] Documentation/memory-barriers: polish compiler store omit
  example

Comments of examples about compiler store omit in memory-barriers.txt is
about code that could be possible at that point.  However, someone could
interpret the comment as an explanation about below line.  This commit
exploits the intent more explicitly by changing the comment to be seems
like a possible code rather than explanation about below line.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
  Documentation/memory-barriers.txt | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/memory-barriers.txt 
b/Documentation/memory-barriers.txt
index 904ee42..dc66351 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1459,7 +1459,7 @@ of optimizations:
       the following:

         a = 0;
-       /* Code that does not store to variable a. */
+       ... Code that does not store to variable a ...
         a = 0;

       The compiler sees that the value of variable 'a' is already zero, so
@@ -1471,7 +1471,7 @@ of optimizations:
       wrong guess:

         WRITE_ONCE(a, 0);
-       /* Code that does not store to variable a. */
+       ... Code that does not store to variable a ...
         WRITE_ONCE(a, 0);

   (*) The compiler is within its rights to reorder memory accesses unless
--
1.9.1



>
> David
>

  reply	other threads:[~2016-02-22 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-20  6:01 SeongJae Park
2016-02-20 19:57 ` Paul E. McKenney
2016-02-20 22:50   ` SeongJae Park
2016-02-21  5:25     ` Paul E. McKenney
2016-02-21  6:33       ` SeongJae Park
2016-02-22 10:01       ` David Howells
2016-02-22 11:08         ` SeongJae Park [this message]
2016-02-22 11:16         ` David Howells
2016-02-22 16:33           ` Paul E. McKenney
2016-02-22 21:45             ` SeongJae Park

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=alpine.DEB.2.10.1602222006200.16296@hxeon \
    --to=sj38.park@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®