summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2018-11-12 15:26:52 -0800
committerJunghoon Kim <jhoon20.kim@samsung.com>2020-01-20 16:48:13 +0900
commit1307ca29e127fffb24984456bc1e407888fc3d66 (patch)
tree82eab9c73c55268c1d40be9fbde6a2c7c2e16cae /lib
parentb39d05ef772bbca70a3345e3cf77f704a6b21020 (diff)
downloadlinux-rpi3-1307ca29e127fffb24984456bc1e407888fc3d66.tar.gz
linux-rpi3-1307ca29e127fffb24984456bc1e407888fc3d66.tar.bz2
linux-rpi3-1307ca29e127fffb24984456bc1e407888fc3d66.zip
lib/raid6: add option to skip algo benchmarking
This is helpful for systems where fast startup time is important. It is especially nice to avoid benchmarking RAID functions that are never used (for example, BTRFS selects RAID6_PQ even if the parity RAID mode is not in use). This saves 250+ milliseconds of boot time on modern x86 and ARM systems with a dozen or more available implementations. The new option is defaulted to 'y' to match the previous behavior of always benchmarking on init. Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Signed-off-by: Shaohua Li <shli@fb.com> [jhoon20.kim: backport from mainline for the fast kernel startup] Change-Id: I38c270c413d60de65f27cf9c95d44bb2e2d07ac2 Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig8
-rw-r--r--lib/raid6/algos.c5
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index a3928d4438b5..fcb00bc06f1a 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -10,6 +10,14 @@ menu "Library routines"
config RAID6_PQ
tristate
+config RAID6_PQ_BENCHMARK
+ bool "Automatically choose fastest RAID6 PQ functions"
+ depends on RAID6_PQ
+ default y
+ help
+ Benchmark all available RAID6 PQ functions on init and choose the
+ fastest one.
+
config BITREVERSE
tristate
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
index 5065b1e7e327..c34344902fd2 100644
--- a/lib/raid6/algos.c
+++ b/lib/raid6/algos.c
@@ -163,6 +163,11 @@ static inline const struct raid6_calls *raid6_choose_gen(
if ((*algo)->valid && !(*algo)->valid())
continue;
+ if (!IS_ENABLED(CONFIG_RAID6_PQ_BENCHMARK)) {
+ best = *algo;
+ break;
+ }
+
perf = 0;
preempt_disable();