[stable v4.9.y] Backports to fix fstrim time / CPU load on raid0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello GregKH,

I have been seeing several reports of performance issue with raid0 while performing fstrim on v4.9.y.
Currently, if one performs:

# fio --name fio_test_file --direct=1 --rw=randwrite --bs=4k --size=5G --numjobs=8 --group_reporting --directory=/mount/raid0 
# rm -rf /media/nvme-raid0 
# time fstrim -vvv -a 
real	3m41.102s 
user	0m0.000s 
sys	0m4.964s 

And on latest linus master, in fact, starting v4.12, we get

# time fstrim -vvv -a 
/mount/raid0: 3.5 TiB (3798132523008 bytes) trimmed

real	0m1.953s
user	0m0.004s
sys	0m0.004s

So, I performed a git bisect and found this patch:
commit 29efc390b9462582ae95eb9a0b8cd17ab956afc0
Author: Shaohua Li <shli@xxxxxx>
Date:   Sun May 7 17:36:24 2017 -0700

    md/md0: optimize raid0 discard handling

However, the above patch depends on several other patches. I have performed a backport of the depending patches and I confirm
I can get the performance boost after applying all fixes. The list of patches is bellow. I also have a branch with the backports
here:

https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux.git/log/?h=backports/v4.9.y/raid0/fstrim


And here is the list of patches:
797476b block: Add 'zoned' queue limit
c4aebd0 block: remove bio_is_rw
bd1c1c2 block: REQ_NOMERGE is common to the bio and request
188bd2b block: move REQ_RAHEAD to common flags
8d2bbd4 block: replace REQ_THROTTLED with a bio flag
e806402 block: split out request-only flags into a new namespace
ef295ec block: better op and flags encoding
8737417 block: add a proper block layer data direction encoding
e73c23f block: add async variant of blkdev_issue_zeroout
a6f0788 block: add support for REQ_OP_WRITE_ZEROES
bef1331 block: don't try to discard from __blkdev_issue_zeroout
eeeefd4 block: don't try Write Same from __blkdev_issue_zeroout
35b785f md: add bad block support for external metadata
688834e md/failfast: add failfast flag for md to be used by some personalities.
504634f md: add blktrace event for writes to superblock
85c9ccd md/bitmap: Don't write bitmap while earlier writes might be in-flight
91a6c4a md: wake up personality thread after array state update
060b068 md: perform async updates for metadata where possible.
be306c2 md: define mddev flags, recovery flags and r1bio state bits using enums
46533ff md: Use REQ_FAILFAST_* on metadata writes where appropriate
6995f0b md: takeover should clear unrelated bits
394ed8e md: cleanup mddev flag clear for takeover
32cd7cb md/raid5: Use correct IS_ERR() variation on pointer check
109e376 md: add block tracing for bio_remapping
2648381 md: disable WRITE SAME if it fails in underlayer disks
3deff1a md: support REQ_OP_WRITE_ZEROES
f00d7c8 md/raid0: fix up bio splitting.
29efc39 md/md0: optimize raid0 discard handling

The above patches were pulled into the backports due to either static dependency or semantic dependency.

Let me know if it is possible to include these patches into stable v4.9.y.

-- 
All the best,
Eduardo Valentin



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]