Thread (10 messages) 10 messages, 4 authors, 2021-12-17

Re: [PATCH] lib/raid6: fix abnormally high latency

flat view

From: Song Liu <song@kernel.org>
Date: 2021-12-14 17:28:11
Also in: linux-rt-users, lkml

On Mon, Dec 13, 2021 at 7:17 PM Yajun Deng [off-list ref] wrote:
We found an abnormally high latency when executing modprobe raid6_pq, the
latency is greater than 1.2s when CONFIG_PREEMPT_VOLUNTARY=y, greater than
67ms when CONFIG_PREEMPT=y, and greater than 16ms when CONFIG_PREEMPT_RT=y.
This is caused by disable the preemption, this time is too long and
unreasonable. We just need to disable migration. so used migrate_disable()/
migrate_enable() instead of preempt_disable()/preempt_enable(). This is
beneficial for CONFIG_PREEMPT=y or CONFIG_PREEMPT_RT=y, but no effect for
CONFIG_PREEMPT_VOLUNTARY=y.

Fixes: fe5cbc6e06c7 ("md/raid6 algorithms: delta syndrome functions")
Signed-off-by: Yajun Deng <redacted>
We measure the speed of different RAID algorithms.If we don't disable
preempt, the result may be inaccurate, right? IIUC, we only disable preempt
for 16 jiffies. Why do we see 1.2 second delay?

Thanks,
Song
quoted hunk ↗ jump to hunk
---
 lib/raid6/algos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
index 6d5e5000fdd7..21611d05c34c 100644
--- a/lib/raid6/algos.c
+++ b/lib/raid6/algos.c
@@ -162,7 +162,7 @@ static inline const struct raid6_calls *raid6_choose_gen(

                        perf = 0;

-                       preempt_disable();
+                       migrate_disable();
                        j0 = jiffies;
                        while ((j1 = jiffies) == j0)
                                cpu_relax();
@@ -171,7 +171,7 @@ static inline const struct raid6_calls *raid6_choose_gen(
                                (*algo)->gen_syndrome(disks, PAGE_SIZE, *dptrs);
                                perf++;
                        }
-                       preempt_enable();
+                       migrate_enable();

                        if (perf > bestgenperf) {
                                bestgenperf = perf;
@@ -186,7 +186,7 @@ static inline const struct raid6_calls *raid6_choose_gen(

                        perf = 0;

-                       preempt_disable();
+                       migrate_disable();
                        j0 = jiffies;
                        while ((j1 = jiffies) == j0)
                                cpu_relax();
@@ -196,7 +196,7 @@ static inline const struct raid6_calls *raid6_choose_gen(
                                                      PAGE_SIZE, *dptrs);
                                perf++;
                        }
-                       preempt_enable();
+                       migrate_enable();

                        if (best == *algo)
                                bestxorperf = perf;
--
2.32.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help