linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chen Cheng" <chencheng@fnnas.com>
Cc: linux-raid@vger.kernel.org, yukuai@fygo.io
Subject: Re: [RFC PATCH 1/5] md/raid1: balance reads across non-rotational disks
Date: Tue, 18 Aug 2026 07:16:28 +0000	[thread overview]
Message-ID: <20260818071628.D20241F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818070646.1029149-2-chencheng@fnnas.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The use of a global atomic counter (`atomic_inc_return(&conf->read_rr)`) in the read fast-path introduces severe cacheline contention on high-concurrency NVMe arrays, heavily throttling peak read IOPS scalability.
--

--- Patch [1]: [RFC PATCH 1/5] md/raid1: balance reads across non-rotational disks ---
commit fe7aa5a93e1157781321a0273156730cd901aaec
Author: Chen Cheng <chencheng@fnnas.com>
md/raid1: balance reads across non-rotational disks

This commit optimizes read balancing for non-rotational disks in RAID1 by
distributing reads more evenly when pending IOs are equal. It introduces a
round-robin start slot rotation across disks to prevent low-depth random
reads from always sticking to the first slot.

> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index f0646fb24371f..319b24bcab5b7 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
[ ... ]
> @@ -799,6 +806,10 @@ static int choose_best_rdev(struct r1conf *conf, struct r1bio *r1_bio)
>  		.sequential_disk	= -1,
>  	};
>  
> +	if (has_nonrot)
> +		rr_start = (unsigned int)atomic_inc_return(&conf->read_rr) %
> +			   conf->raid_disks;

[Severity: Medium]
Will updating a global atomic counter on every read operation introduce
severe cacheline bouncing across CPU cores?

For high-concurrency NVMe arrays processing millions of IOPS, could this
global atomic increment in the read fast-path become a major scalability
bottleneck due to exclusive cacheline ownership?

> +
>  	for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) {
>  		struct md_rdev *rdev;
>  		sector_t dist;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818070646.1029149-1-chencheng@fnnas.com?part=1

  reply	other threads:[~2026-08-18  7:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  7:06 [RFC PATCH 0/5] md/raid1: improve choose_best_rdev read balance Chen Cheng
2026-08-18  7:06 ` [RFC PATCH 1/5] md/raid1: balance reads across non-rotational disks Chen Cheng
2026-08-18  7:16   ` sashiko-bot [this message]
2026-08-18  7:06 ` [RFC PATCH 2/5] md/raid1: do not move nonrot reads onto a rot disk Chen Cheng
2026-08-18  7:26   ` sashiko-bot
2026-08-18  7:06 ` [RFC PATCH 3/5] md/raid1: do not send random reads to " Chen Cheng
2026-08-18  7:06 ` [RFC PATCH 4/5] md/raid1: use rot policy when no nonrot disk is readable Chen Cheng
2026-08-18  7:34   ` sashiko-bot
2026-08-18  7:06 ` [RFC PATCH 5/5] md/raid1: clarify choose_best_rdev comments Chen Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260818071628.D20241F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chencheng@fnnas.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yukuai@fygo.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).