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

Song Liu
2021-12-18T09:02:03Z

On Fri, Dec 17, 2021 at 1:43 PM Daniel Vacek <neelx.g@gmail.com> wrote:
>
> Hello,
>
> This is perfectly correct and expected result. Further explanation
> follows down below.
>
> On Wed, Dec 15, 2021 at 8:41 PM <yajun.deng@linux.dev> wrote:
> >
> > December 15, 2021 1:27 AM, "Song Liu" <song@kernel.org> wrote:
> >
> > > On Mon, Dec 13, 2021 at 7:17 PM Yajun Deng <yajun.deng@linux.dev> 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 <yajun.deng@linux.dev>
> > >
> > > 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?
> >
> > Here are the command of my test：
> > Execute "sudo cyclictest -S -p 95 -d 0 -i 1000 -D 24h -m" in one terminal and "sudo modprobe raid6_pq" in the other terminal.
> >
> > Here are the results of my test：
> > CONFIG_PREEMPT_VOLUNTARY=y，CONFIG_HZ_250=y
> > T:17 ( 3109) P:95 I:1000 C: 7255 Min: 1 Act: 2 Avg: 170 Max: 1220832
>
> No preemption is expected with this config so the CPU is busy and
> occupied for full duration of all the benchmarks.
>
> > CONFIG_PREEMPT=y,CONFIG_HZ_250=y
> > T: 2 ( 2462) P:95 I:1000 C: 49024 Min: 1 Act: 2 Avg: 4 Max: 67888
>
> 16 jiffies with 250 Hz equals to 64 ms. So again, this result is
> perfectly expected. The benchmarks can be preempted in between the
> individual measurements with preemptible kernel configuration.
>
> > CONFIG_PREEMPT_RT=y,CONFIG_HZ_1000=y
> > T: 6 ( 2561) P:95 I:1000 C: 25284 Min: 3 Act: 3 Avg: 4 Max: 16593
>
> 16 jiffies by 1000 Hz is 16 ms. Ditto. So far so good.

Thanks for the explanation. I misread/misunderstood some of these results.
I dropped the patch from md-next.

Song