All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: linux-crypto@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH] lib/crc_kunit.c: update comment in crc_benchmark()
Date: Tue,  4 Mar 2025 17:58:30 -0800	[thread overview]
Message-ID: <20250305015830.37813-1-ebiggers@kernel.org> (raw)

From: Eric Biggers <ebiggers@google.com>

None of the CRC library functions use __pure anymore, so the comment in
crc_benchmark() is outdated.  But the comment was not really correct
anyway, since the CRC computation could (in principle) be optimized out
regardless of __pure.  Update the comment to have a proper explanation.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 lib/crc_kunit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/crc_kunit.c b/lib/crc_kunit.c
index 40b4b41f2184..d5a5045fd9ab 100644
--- a/lib/crc_kunit.c
+++ b/lib/crc_kunit.c
@@ -222,12 +222,13 @@ crc_benchmark(struct kunit *test,
 	static const size_t lens_to_test[] = {
 		1, 16, 64, 127, 128, 200, 256, 511, 512, 1024, 3173, 4096, 16384,
 	};
 	size_t len, i, j, num_iters;
 	/*
-	 * Some of the CRC library functions are marked as __pure, so use
-	 * volatile to ensure that all calls are really made as intended.
+	 * The CRC value that this function computes in a series of calls to
+	 * crc_func is never actually used, so use volatile to ensure that the
+	 * computations are done as intended and don't all get optimized out.
 	 */
 	volatile u64 crc = 0;
 	u64 t;
 
 	if (!IS_ENABLED(CONFIG_CRC_BENCHMARK))

base-commit: 13f3d13d88b5dcba104a204fcbee61c75f8407d0
-- 
2.48.1


             reply	other threads:[~2025-03-05  1:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05  1:58 Eric Biggers [this message]
2025-03-06 17:21 ` [PATCH] lib/crc_kunit.c: update comment in crc_benchmark() Eric Biggers

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=20250305015830.37813-1-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.