On Thu, Mar 10, 2022 at 2:10 PM Song Liu <song@xxxxxxxxxx> wrote: > > On Wed, Mar 9, 2022 at 11:23 PM Song Liu <song@xxxxxxxxxx> wrote: > > > > On Wed, Mar 9, 2022 at 10:48 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > > > > > On Tue, Mar 08, 2022 at 10:42:09PM -0800, Song Liu wrote: > > > > RAID arrays check/repair operations benefit a lot from merging requests. > > > > If we only check the previous entry for merge attempt, many merge will be > > > > missed. As a result, significant regression is observed for RAID check > > > > and repair. > > > > > > > > Fix this by checking more than just the previous entry when > > > > plug->multiple_queues == true. > > > > > > But this also means really significant CPU overhead for all other > > > workloads. > > > > Would the following check help with these workloads? > > > > if (!plug->multiple_queues) > > break; > > > > > > > > > > > > > This improves the check/repair speed of a 20-HDD raid6 from 19 MB/s to > > > > 103 MB/s. > > > > > > What driver uses multiple queues for HDDs? > > > > > > Can you explain the workload submitted by a md a bit better? I wonder > > > if we can easily do the right thing straight in the md driver. > > > > It is the md sync_thread doing check and repair. Basically, the md > > thread reads all > > the disks and computes parity from data. > > > > Maybe we should add a new flag to struct blk_plug for this special case? > > I meant something like: > > diff --git c/block/blk-core.c w/block/blk-core.c > index 1039515c99d6..4fb09243e908 100644 > --- c/block/blk-core.c > +++ w/block/blk-core.c > @@ -1303,6 +1303,12 @@ void blk_finish_plug(struct blk_plug *plug) > } > EXPORT_SYMBOL(blk_finish_plug); > > +void blk_plug_merge_aggressively(struct blk_plug *plug) > +{ > + plug->aggresive_merge = true; > +} > +EXPORT_SYMBOL(blk_plug_merge_aggressively); > + > void blk_io_schedule(void) > { > /* Prevent hang_check timer from firing at us during very long I/O */ Missed one change: --- c/block/blk-core.c +++ w/block/blk-core.c @@ -1188,6 +1188,7 @@ void blk_start_plug_nr_ios(struct blk_plug *plug, unsigned short nr_ios) plug->multiple_queues = false; plug->has_elevator = false; plug->nowait = false; + plug->aggresive_merge = false; INIT_LIST_HEAD(&plug->cb_list); /*