mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Yann Collet <cyan@fb.com>, Vasily Averin <vvs@virtuozzo.com>,
	Gao Xiang <hsiangkao@aol.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Gao Xiang <xiang@kernel.org>
Subject: Re: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()
Date: Sun, 07 Jun 2020 18:02:44 -0700	[thread overview]
Message-ID: <3bf931c6ea0cae3e23f3485801986859851b4f04.camel@perches.com> (raw)
In-Reply-To: <D4762145-BBC5-4574-BF68-8C1A3AF41D98@fb.com>

On Mon, 2020-06-08 at 00:40 +0000, Yann Collet wrote:
> Hi Vasily
> 
> 
> If I do understand the discussion, the question is about usage of `&` instead of `&&`,
> and the speculation that it might be an error.
> 
> It's not an error. Unfortunately, explaining the reasoning behind this decision is a bit long.

Likely better to add a comment around the use so that
another patch like this doesn't get submitted again.

Perhaps something like:
---
 lib/lz4/lz4_decompress.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 0c9d3ad17e0f..5371dab6b481 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -141,6 +141,9 @@ static FORCE_INLINE int LZ4_decompress_generic(
 		 * space in the output for those 18 bytes earlier, upon
 		 * entering the shortcut (in other words, there is a
 		 * combined check for both stages).
+		 *
+		 * The & in the likely() below is intentionally not && so that
+		 * some compilers can produce better parallelized runtime code
 		 */
 		if ((endOnInput ? length != RUN_MASK : length <= 8)
 		   /*



  reply	other threads:[~2020-06-08  1:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200606143646.GB10839.ref@hsiangkao-HP-ZHAN-66-Pro-G1>
2020-06-06 13:28 ` Vasily Averin
2020-06-06 14:36   ` Gao Xiang
2020-06-06 15:16     ` Vasily Averin
2020-06-08  0:40       ` Yann Collet
2020-06-08  1:02         ` Joe Perches [this message]
2020-06-08  1:24           ` Andrew Morton

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=3bf931c6ea0cae3e23f3485801986859851b4f04.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=cyan@fb.com \
    --cc=hsiangkao@aol.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vvs@virtuozzo.com \
    --cc=xiang@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

all inboxes | Powered by JetHome®