mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "yu kuai" <yukuai@fygo.io>
To: "Miroslav Cimerman" <mc@raidlab.org>,
	"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>,
	 "Anton Gavriliuk" <antosha20xx@gmail.com>
Subject: Re: [PATCH] md/raid5: grow stripe hash table with the size of stripe cache
Date: Sun, 29 Nov 2026 09:25:26 +0800	[thread overview]
Message-ID: <8fec6c92-cfa5-45ac-afd1-1be26ea75360@fygo.io> (raw)
In-Reply-To: <20261116133954.5111-1-mc@raidlab.org>

在 2026/11/16 21:39, Miroslav Cimerman 写道:

> The stripe hash table has a fixed size of one page, 512 buckets with
> 4 KiB pages. With stripe_cache_size at its current maximum (32768), a
> bucket contains 64 stripes on average. Every stripe lookup walks one
> chain with interrupts off and the hash lock held, and with random I/O
> most lookups miss and walk the whole chain. This costs CPU time on
> every request and makes the hash locks more contended.
>
> Grow the table when stripe_cache_size is written, to about
> STRIPES_PER_HASH_BUCKET (two) stripes per bucket, rounded up to a
> power of two. The new table is allocated before any hash lock is taken,
> and the stripes are moved to it with all hash locks held. The table
> size stays a power of two and a multiple of NR_STRIPE_HASH_LOCKS, so
> every stripe keeps its hash lock. If the allocation fails, the old
> table stays. Moving about 24k stripes (only stripes that have been
> used are in the table) took about 2 ms with interrupts off on the
> Xeon machine below. This happens only when stripe_cache_size is set.
>
> The table starts at one page as before. It needs at most 8 bytes per
> stripe: 128 KiB at stripe_cache_size=32768, where the stripe pages
> alone take 768 MiB on RAID-6 4+2. The table is not shrunk when
> stripe_cache_size is lowered.
>
> 2x Xeon E5-2699 v3 (one NUMA node used), RAM disks, chunk 512K,
> stripe_cache_size=32768, group_thread_cnt=8, io_uring, without -> with
> this patch:
>
>    RAID-6 4+2  4k random write, 16 jobs QD64  320k -> 355k IOPS  (+11%)
>    RAID-6 6+2  4k random write, 16 jobs QD64  345k -> 381k IOPS  (+10%)
>    RAID-5 5+1  4k random write, 16 jobs QD64  437k -> 514k IOPS  (+18%)
>    RAID-6 4+2  1M seq write, 4 jobs QD16      4410 -> 4971 MiB/s (+13%)
>    RAID-6 4+2  4k random read, degraded       543k -> 705k IOPS  (+30%)
>
> HPE DL345 Gen11, AMD EPYC 9455, 6x PCIe 5.0 NVMe (KIOXIA CM7-V 3.2 TB),
> the same md settings and chunk size:
>
>    RAID-6 4+2  4k random write, 16 jobs QD64  501k -> 536k IOPS   (+7%)
>    RAID-6 4+2  2M seq write, 1 job QD64      10342 -> 13523 MiB/s (+31%)
>
> The CPU time per I/O drops by 21-34% on the Xeon, and by 12% (random)
> and 49% (sequential) on the EPYC. In the 4k random write tests,
> find_get_stripe() drops from 9.2% to 0.6% of all cycles on the Xeon,
> and from 3.4% to 0.2% on the EPYC. With md's default stripe_cache_size
> nothing changes.
>
> Signed-off-by: Miroslav Cimerman<mc@raidlab.org>
> ---
>   drivers/md/raid5.c | 60 +++++++++++++++++++++++++++++++++++++++++++---
>   drivers/md/raid5.h | 14 ++++++++---
>   2 files changed, 68 insertions(+), 6 deletions(-)
Applied

-- 
Thanks,
Kuai

      reply	other threads:[~2026-11-29  1:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 13:39 Miroslav Cimerman
2026-11-29  1:25 ` yu kuai [this message]

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=8fec6c92-cfa5-45ac-afd1-1be26ea75360@fygo.io \
    --to=yukuai@fygo.io \
    --cc=antosha20xx@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=magiclinan@didiglobal.com \
    --cc=mc@raidlab.org \
    --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®