mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "yu kuai" <yukuai@fygo.io>
To: "Hiroshi Nishida" <nishidafmly@gmail.com>,
	"Song Liu" <song@kernel.org>,  "yu kuai" <yukuai@fygo.io>
Cc: "Li Nan" <magiclinan@didiglobal.com>, "Xiao Ni" <xiao@kernel.org>,
	 <linux-raid@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/6] md/raid5: size the worker group array by nr_node_ids
Date: Fri, 31 Jul 2026 04:25:01 +0800	[thread overview]
Message-ID: <10cc8ef5-cbef-455a-b027-7b8bccec49fe@fygo.io> (raw)
In-Reply-To: <20260710132346.7295-2-nishidafmly@gmail.com>

在 2026/7/10 21:23, Hiroshi Nishida 写道:

> alloc_thread_groups() sizes conf->worker_groups[] by num_possible_nodes()
> -- the number of possible NUMA nodes -- but raid5_wakeup_stripe_thread()
> indexes it by cpu_to_group(cpu), i.e. cpu_to_node(cpu), which is a node
> id.  When the node map is sparse (for example possible nodes 0 and 2) the
> node count is 2 while the largest node id is 2, so the index reaches
> worker_groups[2] on a two-element array -- an out-of-bounds access.
>
> This has stayed latent because worker groups are only allocated when
> group_thread_cnt is non-zero, and the historical default is 0.  Size the
> array by nr_node_ids -- one past the largest possible node id -- so that
> indexing by cpu_to_node() is always in bounds.  On a dense node map
> nr_node_ids equals num_possible_nodes() and nothing changes; on a sparse
> map the array just gains the unused id slots it needs.
>
> Fixes: 851c30c9badf ("raid5: offload stripe handle to workqueue")
> Signed-off-by: Hiroshi Nishida<nishidafmly@gmail.com>
> ---
>   drivers/md/raid5.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
Reviewed-by: Yu Kuai <yukuai@fygo.io>

-- 
Thanks,
Kuai

  reply	other threads:[~2026-07-30 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 13:23 [PATCH 0/6] md/raid5: size stripe-cache and worker tuning from the hardware Hiroshi Nishida
2026-07-10 13:23 ` [PATCH 1/6] md/raid5: size the worker group array by nr_node_ids Hiroshi Nishida
2026-07-30 20:25   ` yu kuai [this message]
2026-07-10 13:23 ` [PATCH 2/6] md/raid5: size stripe-cache hash locks from the CPU count Hiroshi Nishida
2026-07-30 20:26   ` yu kuai
2026-07-10 13:23 ` [PATCH 3/6] md/raid5: scale the stripe_cache_size limit with system memory Hiroshi Nishida
2026-07-30 21:01   ` yu kuai
2026-07-10 13:23 ` [PATCH 4/6] md/raid5: make the stripe batch size a module parameter Hiroshi Nishida
2026-07-30 21:12   ` yu kuai
2026-07-10 13:23 ` [PATCH 5/6] md/raid5: scale the default stripe cache size with system memory Hiroshi Nishida
2026-07-30 21:17   ` yu kuai
2026-07-10 13:23 ` [PATCH 6/6] md/raid5: derive the default group_thread_cnt from the hardware Hiroshi Nishida
2026-07-30 21:20   ` yu kuai

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=10cc8ef5-cbef-455a-b027-7b8bccec49fe@fygo.io \
    --to=yukuai@fygo.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=magiclinan@didiglobal.com \
    --cc=nishidafmly@gmail.com \
    --cc=song@kernel.org \
    --cc=xiao@kernel.org \
    /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

all inboxes | Powered by JetHome®