Re: [RFC PATCH] md/raid5: set STRIPE_SIZE as a configurable value

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

 



On Thu, Aug 29 2019, Yufen Yu wrote:

> In RAID5, if issued bio has sectors more than STRIPE_SIZE,
> it will be split in unit of STRIPE_SIZE. For bio sectors
> less then STRIPE_SIZE, raid5 issue bio to disk in the size
> of STRIPE_SIZE.
>
> For now, STRIPE_SIZE is equal to the value of PAGE_SIZE.
> That means, RAID5 will issus echo bio to disk at least 64KB
> when use 64KB page size in arm64.
>
> However, filesystem usually issue bio in the unit of 4KB.
> Then, RAID5 will waste resource of disk bandwidth and compute xor.
>
> To avoding the waste, we can add a CONFIG option to set
> the default STRIPE_SIZE as 4096. User can also set the value
> bigger than 4KB for some special requirements, such as we know
> the issued io size is more than 4KB.
>
> Signed-off-by: Yufen Yu <yuyufen@xxxxxxxxxx>
> ---
>  drivers/md/Kconfig | 9 +++++++++
>  drivers/md/raid5.h | 2 +-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
> index 3834332f4963..4263a655dbbb 100644
> --- a/drivers/md/Kconfig
> +++ b/drivers/md/Kconfig
> @@ -157,6 +157,15 @@ config MD_RAID456
>  
>  	  If unsure, say Y.
>  
> +config MD_RAID456_STRIPE_SIZE
> +	int "RAID4/RAID5/RAID6 stripe size"
> +	default "4096"
> +	depends on MD_RAID456
> +	help
> +	  The default value is 4096. Only change this if you know
> +	  what you are doing.
> +
> +
>  config MD_MULTIPATH
>  	tristate "Multipath I/O support"
>  	depends on BLK_DEV_MD
> diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
> index cf991f13403e..2fcf5853b719 100644
> --- a/drivers/md/raid5.h
> +++ b/drivers/md/raid5.h
> @@ -473,7 +473,7 @@ struct disk_info {
>   */
>  
>  #define NR_STRIPES		256
> -#define STRIPE_SIZE		PAGE_SIZE
> +#define STRIPE_SIZE		CONFIG_MD_RAID456_STRIPE_SIZE
>  #define STRIPE_SHIFT		(PAGE_SHIFT - 9)
>  #define STRIPE_SECTORS		(STRIPE_SIZE>>9)
>  #define	IO_THRESHOLD		1
> -- 
> 2.17.2

While I agree that this is a problem that should be fixed, I think your
fix is rather simplistic.

grow_buffers() uses alloc_page() allocate the buffers for each
stripe_head()
With this change, it will allocate 64K buffers and use 4K of them.
This is a waste.  Unfortunately fixing it would be a lot more work.
I think that is best way forward though.

Also, I don't think this should be a config option - just make it
always 4096.

Thanks,
NeilBrown

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux