From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.60 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795915538; b=b89eVzqnKs3+sIueGvi1eIUFcVJq1ZNxmRDcigc7f8z1WPD8PGKLhgqTOiViSUV1qsme kQS9C04x3cWDegG/ex3BEUAX6cWnhz3Bgmbw6Aclq/rcAUdzpHtevVebA0ty2SLeHBu4F Lfa3FEThoKIMIOOPy2S6rLckvKWsnfJVLgxFsn3yFcmAdSVGW/PoonmLJYyzD0yTUKPoL /l/gftX6pWNfONBupj1UYxb5c5fn+gsTTLKVnPUFzBhoY+RHIDYru4H2YOwaHChA9+yLo eRvQ8eVyUV4KOi7/PGT0q08qKvBi5PTjpG6yQLPzjN+dkyXyceRte2AI5kdbo6iUZsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795915538; h=DMARC-Filter:DKIM-Signature:Reply-To:Date:X-Original-From: X-Lms-Return-Path:Content-Type:Cc:From:Message-Id:In-Reply-To: References:To:Subject:Mime-Version:Content-Transfer-Encoding: User-Agent:Received; bh=lSt1yxNpYMzPktCNIgOVJL0dH7JkN0aAd1E6uc1Wbqw=; b=2849yro0Pi56Km/8azhMp4Rvd/Ejo4rcTHkClh7cXQSRb4EaCVYMYRdJ9a2o10GhJ3Wc Drnjob8rkuhHG6/ISAVB55QIuzwVSQUM6AQRCheD3Xfm6RXNaYk1RQRnEyd6A/N6FnTvx aAbxybfdXpyXouINiCaBBntsjf9whe4J/uKnRwdU+a+zXya71a/6yl+wtqxO8LRx6Yxff RxlNpPNuefgFJdr3r37TcignV4hqH06ILPNu5oVYb/H9sRN9R8Db50Go8OYwo6P2fh6NM 03rywE4CUAGxNULvi00MqD6NiidsEEobuqXfEjVFB/QTStxHmtSaYMgXLlc2y+nn/9Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=fygo.io; spf=pass smtp.mailfrom=fygo.io; dkim=pass header.d=fygo-io.20200929.dkim.larksuite.com header.i=@fygo-io.20200929.dkim.larksuite.com header.a=rsa-sha256 header.s=s1 header.b="IVk/JxFB"; arc=none smtp.remote-ip=209.127.231.60 Received: from va-2-60.ptr.blmpb.com (va-2-60.ptr.blmpb.com [209.127.231.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11FBF606A31C for ; Sun, 29 Nov 2026 01:25:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 11FBF606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fygo.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fygo.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=fygo-io.20200929.dkim.larksuite.com header.i=@fygo-io.20200929.dkim.larksuite.com header.a=rsa-sha256 header.s=s1 header.b=IVk/JxFB DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=fygo-io.20200929.dkim.larksuite.com; t=1795915532; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=lSt1yxNpYMzPktCNIgOVJL0dH7JkN0aAd1E6uc1Wbqw=; b=IVk/JxFB8NvAzek60MRUu5ei9wcG0zgrszqlAYGEZabCUmo8QEr9/fNaEv9jcaN1p2hK8v lx2/GRv9UpKVl9xuugOEzcQo45izD6AD1HZos2clcR4lQBtSKqAO492wt4wA50f//iU1kJ 7u00mVGB/WS8L1APdHBXtQg90aac1Y5/ZSESW0RSVcIz7FJ/NIwmpSHi8IX5f8POoYF+Mx OUgrtCZpuKxAyMpuhoQTxvMvl5U5gkcMRZ8SXNuBKmtC6f+hHkrVQFVw0Kh1ks/zs0DvG0 jrPZsQIPS5HpeGftjXV/OtZguhMrMbBjieGb6RKpJPNv3rGBSF7ALh2LNGm41g== Reply-To: yukuai@fygo.io Date: Sun, 29 Nov 2026 09:25:26 +0800 X-Original-From: yu kuai X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 Cc: "Li Nan" , "Xiao Ni" , , , "Anton Gavriliuk" From: "yu kuai" Message-Id: <8fec6c92-cfa5-45ac-afd1-1be26ea75360@fygo.io> In-Reply-To: <20261116133954.5111-1-mc@raidlab.org> References: <20261116133954.5111-1-mc@raidlab.org> To: "Miroslav Cimerman" , "Song Liu" , "yu kuai" Subject: Re: [PATCH] md/raid5: grow stripe hash table with the size of stripe cache X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable User-Agent: Mozilla Thunderbird Received: from [192.168.1.104] ([39.182.0.140]) by smtp.larksuite.com with ESMTPS; Sun, 29 Nov 2026 01:25:30 +0000 =E5=9C=A8 2026/11/16 21:39, Miroslav Cimerman =E5=86=99=E9=81=93: > 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=3D32768, 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=3D32768, group_thread_cnt=3D8, io_uring, without -> wit= h > 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 > --- > drivers/md/raid5.c | 60 +++++++++++++++++++++++++++++++++++++++++++--- > drivers/md/raid5.h | 14 ++++++++--- > 2 files changed, 68 insertions(+), 6 deletions(-) Applied --=20 Thanks, Kuai