History

lib/raid6: Use strict priority ranking for pq gen() benchmarking

On x86_64, currently 3 variants of AVX512, 3 variants of AVX2 and 3 variants of SSE2 are benchmarked on initialization, taking between 144-153 jiffies. Testing across a hardware pool of various generations of intel cpus I could not find a single case where SSE2 won over AVX2 or AVX512. There are cases where AVX2 wins over AVX512 however. Change "prefer" into an integer priority field (similar to how recov selection works) to have more than one ranking level available, which is backwards compatible with existing behavior. Give AVX2/512 variants higher priority over SSE2 in order to skip SSE testing when AVX is available. in a AVX2/x86_64/HZ=250 case this saves in the order of 200ms of initialization time.

Dirk Müller committed 4 years ago

Commit 36dacdd1 parent 38640c44 files · +9 −9Browse files

Unified · Split

4 files
  1. include/linux/raid/pq.h +1 −1
  2. lib/raid6/algos.c +1 −1
  3. lib/raid6/avx2.c +4 −4
  4. lib/raid6/avx512.c +3 −3
include/linux/raid/pq.h+1−1
@@ -81,7 +81,7 @@ struct raid6_calls { · 80 unmodified lines
8181 void (*xor_syndrome)(int, int, int, size_t, void **);
8282 int (*valid)(void); /* Returns 1 if this routine set is usable */
8383 const char *name; /* Name of this routine set */
84− int prefer; /* Has special performance attribute */
84+ int priority; /* Relative priority ranking if non-zero */
8585 };
8686
8787 /* Selected algorithm */
lib/raid6/algos.c+1−1
@@ -151,7 +151,7 @@ static inline const struct raid6_calls *raid6_choose_gen( · 150 unmodified lines
151151 const struct raid6_calls *best;
152152
153153 for (bestgenperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) {
154− if (!best || (*algo)->prefer >= best->prefer) {
154+ if (!best || (*algo)->priority >= best->priority) {
155155 if ((*algo)->valid && !(*algo)->valid())
156156 continue;
157157
lib/raid6/avx2.c+4−4
@@ -132,7 +132,7 @@ const struct raid6_calls raid6_avx2x1 = { · 131 unmodified lines
132132 raid6_avx21_xor_syndrome,
133133 raid6_have_avx2,
134134 "avx2x1",
135− 1 /* Has cache hints */
135+ .priority = 2 /* Prefer AVX2 over priority 1 (SSE2 and others) */
136136 };
137137
138138 /*
@@ -262,7 +262,7 @@ const struct raid6_calls raid6_avx2x2 = { · 123 unmodified lines
262262 raid6_avx22_xor_syndrome,
263263 raid6_have_avx2,
264264 "avx2x2",
265− 1 /* Has cache hints */
265+ .priority = 2 /* Prefer AVX2 over priority 1 (SSE2 and others) */
266266 };
267267
268268 #ifdef CONFIG_X86_64
@@ -465,6 +465,6 @@ const struct raid6_calls raid6_avx2x4 = { · 196 unmodified lines
465465 raid6_avx24_xor_syndrome,
466466 raid6_have_avx2,
467467 "avx2x4",
468− 1 /* Has cache hints */
468+ .priority = 2 /* Prefer AVX2 over priority 1 (SSE2 and others) */
469469 };
470−#endif
470+#endif /* CONFIG_X86_64 */
lib/raid6/avx512.c+3−3
@@ -162,7 +162,7 @@ const struct raid6_calls raid6_avx512x1 = { · 161 unmodified lines
162162 raid6_avx5121_xor_syndrome,
163163 raid6_have_avx512,
164164 "avx512x1",
165− 1 /* Has cache hints */
165+ .priority = 2 /* Prefer AVX512 over priority 1 (SSE2 and others) */
166166 };
167167
168168 /*
@@ -319,7 +319,7 @@ const struct raid6_calls raid6_avx512x2 = { · 150 unmodified lines
319319 raid6_avx5122_xor_syndrome,
320320 raid6_have_avx512,
321321 "avx512x2",
322− 1 /* Has cache hints */
322+ .priority = 2 /* Prefer AVX512 over priority 1 (SSE2 and others) */
323323 };
324324
325325 #ifdef CONFIG_X86_64
@@ -557,7 +557,7 @@ const struct raid6_calls raid6_avx512x4 = { · 231 unmodified lines
557557 raid6_avx5124_xor_syndrome,
558558 raid6_have_avx512,
559559 "avx512x4",
560− 1 /* Has cache hints */
560+ .priority = 2 /* Prefer AVX512 over priority 1 (SSE2 and others) */
561561 };
562562 #endif
563563

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t