From: acampanella-thegoodpenguin <acampanella@thegoodpenguin.co.uk>
To: linux-embedded@vger.kernel.org
Subject: [PATCH PREVIEW RFC 2/6] raid6: Add bootcache
Date: Tue, 23 Sep 2025 15:23:39 +0100 [thread overview]
Message-ID: <20250923-bootcache-v1-2-4f86fdc38b4e@thegoodpenguin.co.uk> (raw)
In-Reply-To: <20250923-bootcache-v1-0-4f86fdc38b4e@thegoodpenguin.co.uk>
Check for previously cached results before benchmark
Signed-off-by: Andrea Campanella <acampanella@thegoodpenguin.co.uk>
---
lib/raid6/algos.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
index 799e0e5eac26db3d10c07e79f46537af4ec6f182..fc69d94afdb4fc153626a3e21c506eda57540618 100644
--- a/lib/raid6/algos.c
+++ b/lib/raid6/algos.c
@@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/gfp.h>
#endif
+#include <linux/bootcache.h>
struct raid6_calls raid6_call;
EXPORT_SYMBOL_GPL(raid6_call);
@@ -159,6 +160,24 @@ static inline const struct raid6_calls *raid6_choose_gen(
int start = (disks>>1)-1, stop = disks-3; /* work on the second half of the disks */
const struct raid6_calls *const *algo;
const struct raid6_calls *best;
+ char cached_algo_name[32];
+
+ /* Try to get cached algorithm by name */
+ if (bootcache_get_string("raid6_best_algo", cached_algo_name,
+ sizeof(cached_algo_name)) == 0) {
+ /* Find algorithm by name */
+ for (algo = raid6_algos; *algo; algo++) {
+ if (strcmp((*algo)->name, cached_algo_name) == 0) {
+ if (!(*algo)->valid || (*algo)->valid()) {
+ raid6_call = *algo;
+ pr_info("raid6: using algorithm %s (from cache)\n",
+ (*algo)->name);
+ return best;
+ }
+ break;
+ }
+ }
+ }
for (bestgenperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) {
if (!best || (*algo)->priority >= best->priority) {
@@ -198,6 +217,8 @@ static inline const struct raid6_calls *raid6_choose_gen(
goto out;
}
+ bootcache_set_string("raid6_best_algo", best->name);
+
raid6_call = *best;
if (!IS_ENABLED(CONFIG_RAID6_PQ_BENCHMARK)) {
--
2.48.1
next prev parent reply other threads:[~2025-09-23 14:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-23 14:23 [PATCH PREVIEW RFC 0/6] Add support for boot-time caching acampanella-thegoodpenguin
2025-09-23 14:23 ` [PATCH PREVIEW RFC 1/6] base: bootcache: initial commit acampanella-thegoodpenguin
2025-09-29 23:38 ` Bird, Tim
2025-09-30 8:24 ` Andrea Campanella
2025-09-23 14:23 ` acampanella-thegoodpenguin [this message]
2025-09-23 14:23 ` [PATCH PREVIEW RFC 3/6] crypto: use bootcache to cache fastest algorithm acampanella-thegoodpenguin
2025-09-29 23:48 ` Bird, Tim
2025-09-30 11:37 ` Andrew Murray
2025-09-23 14:23 ` [PATCH PREVIEW RFC 4/6] base: bootcache: Add bootcache test backend acampanella-thegoodpenguin
2025-09-23 14:23 ` [PATCH PREVIEW RFC 5/6] base: bootcache: Add bootcache memory backend acampanella-thegoodpenguin
2025-09-24 14:42 ` Dan Scally
2025-09-24 15:13 ` Andrea Campanella
2025-09-26 17:34 ` Marc Kelly
2025-09-26 20:09 ` Dan Scally
2025-09-23 14:23 ` [PATCH PREVIEW RFC 6/6] dt-bindings: bootcache: Add bindings for bootcache backend acampanella-thegoodpenguin
2025-09-30 12:49 ` [PATCH PREVIEW RFC 0/6] Add support for boot-time caching Rob Landley
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=20250923-bootcache-v1-2-4f86fdc38b4e@thegoodpenguin.co.uk \
--to=acampanella@thegoodpenguin.co.uk \
--cc=linux-embedded@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 NNTP newsgroup(s).