lib/raid6: Reduce high latency by using migrate instead of preempt
PATCH v2 1/1 lib/raid6: Reduce high latency by using migrate instead of preempt
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 ksoftirqd fail to scheduled due to disable preemption, this time is too long and unreasonable.
Reduce high latency by using migrate_disabl()/emigrate_enable() instead of preempt_disable()/preempt_enable().
How to reproduce:
- Install cyclictest
sudo apt install rt-tests
- Run cyclictest example in one terminal
sudo cyclictest -S -p 95 -d 0 -i 1000 -D 24h -m
- Modprobe raid6_pq in another terminal
sudo modprobe raid6_pq
This patch beneficial for CONFIG_PREEMPT=y and CONFIG_PREEMPT_RT=y, but no effect for CONFIG_PREEMPT_VOLUNTARY=y.
--- lib/raid6/algos.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/raid6/algos.c +4 -4
@@ -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;
Signature · 1 line
2.32.0
Song Liu
maintainerQuoted 19 lines · Yajun Deng
We found an abnormally high latency when executing modprobe
raid6_pq, the latency is greater than 1.2s whenCONFIG_PREEMPT_VOLUNTARY=y, greater than 67ms whenCONFIG_PREEMPT=y, and greater than 16ms whenCONFIG_PREEMPT_RT=y.This is caused by ksoftirqd fail to scheduled due to disable preemption, this time is too long and unreasonable.
Reduce high latency by using migrate_disabl()/emigrate_enable() instead of preempt_disable()/preempt_enable().
How to reproduce:
- Install cyclictest
sudo apt install rt-tests
- Run cyclictest example in one terminalsudo cyclictest -S -p 95 -d 0 -i 1000 -D 24h -m- Modprobe
raid6_pqin another terminal
sudo modproberaid6_pq
Quoted 7 lines
This patch beneficial for
CONFIG_PREEMPT=yandCONFIG_PREEMPT_RT=y, but no effect forCONFIG_PREEMPT_VOLUNTARY=y.Fixes fe5cbc6e06c7 ("md/raid6 algorithms: delta syndrome functions")Fixes cc4589ebfae6 ("Rename raid6 files now they're in a 'raid6' directory.")Signed-off-by Yajun Deng <[email protected]>
Updated the patch and CC'ed stable. It should make to LTS kernels.
Thanks,
Song
NACK. This is a BUG.
--nX
Quoted 33 lines · Song Liu
Quoted 19 lines · Yajun Deng
We found an abnormally high latency when executing modprobe
raid6_pq, the latency is greater than 1.2s whenCONFIG_PREEMPT_VOLUNTARY=y, greater than 67ms whenCONFIG_PREEMPT=y, and greater than 16ms whenCONFIG_PREEMPT_RT=y.This is caused by ksoftirqd fail to scheduled due to disable preemption, this time is too long and unreasonable.
Reduce high latency by using migrate_disabl()/emigrate_enable() instead of preempt_disable()/preempt_enable().
How to reproduce:
- Install cyclictest
sudo apt install rt-tests
- Run cyclictest example in one terminalsudo cyclictest -S -p 95 -d 0 -i 1000 -D 24h -m- Modprobe
raid6_pqin another terminal
sudo modproberaid6_pqQuoted 7 lines
This patch beneficial for
CONFIG_PREEMPT=yandCONFIG_PREEMPT_RT=y, but no effect forCONFIG_PREEMPT_VOLUNTARY=y.Fixes fe5cbc6e06c7 ("md/raid6 algorithms: delta syndrome functions")Fixes cc4589ebfae6 ("Rename raid6 files now they're in a 'raid6' directory.")Signed-off-by Yajun Deng <[email protected]>Updated the patch and CC'ed stable. It should make to LTS kernels.
Thanks,
Song