From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F1B9E77182 for ; Wed, 11 Dec 2024 19:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ryQGQQIHipBcW96LtkMuxoeXZBMueYj/M1epxeHWyWY=; b=XuQ3UidwJywBdrlVwjcgq+b/JQ fWPVLFS4OaU0q9U1x74wSUrP2YUGmNTuFWJFCnvkkeRafrQ37+bgUNRGH32PPP1zmthqNEMl+fOJL nqHNfmieFIOk1UygePy7L59fr5o9sjSDP2Byeqeglu8p6eJm1XvnUcvcJ2yHfD0Nzba+Y/oB54aF7 cahwoOB+ePJa0+4YsS3ngd6abv2OWk2JAHoNZrtnTgm4zcw1WK0sLvW/Ne0rwoxUEvjLNNzxFpqda 4CG/UdTRp3UNv40EBU7v1C174192yh2jgMr3oMBN4eZ5Delr/FXsicqxSx/cARwxbd9mIlTmPAiYB WRtSI7sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLS8Q-0000000FsPS-1qIf; Wed, 11 Dec 2024 19:12:34 +0000 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLS8O-0000000FsOZ-0K1r for linux-nvme@lists.infradead.org; Wed, 11 Dec 2024 19:12:33 +0000 Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BBIaJ4o026263 for ; Wed, 11 Dec 2024 11:12:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=s2048-2021-q4; bh=ryQGQQIHipBcW96LtkMuxoeXZBMueYj/M1epxeHWyWY=; b=jL4qz4ewGA49 +r/qDxfq2TaG4aJ1XWJOlFePVoYuw+7eWNnDQqMWlcDs+TIljgDligB0F57Pea3K XdwkMPJO6uyn6WDsJTi4tm2crJKVai/UAdRJFRil6XwJPK1kn0W1/TETDwCVhDM2 HW/VSBlzPRTcUHpX5NcfSkmOtCZJJZ6qmsFxUWt09hXlUw2vRS+MfzGiBTH8OUtN sh+1BmlA9CE9YwvgI683M39E0GYFhIgTMoz5IJ0ukK+wEp2K+PebNa0uLkN2b/ro OIP9y+FhgWFPa9ScjhI9/U/lkxdcJab7Y+n0kX+iSfNc5YE0Va6DqW/z6GK6q3NO IxWr/hEA/g== Received: from maileast.thefacebook.com ([163.114.135.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 43fg5k88j9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 11 Dec 2024 11:12:30 -0800 (PST) Received: from twshared24170.03.ash8.facebook.com (2620:10d:c0a8:1b::30) by mail.thefacebook.com (2620:10d:c0a9:6f::237c) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Wed, 11 Dec 2024 19:12:30 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 63B3A15DE3957; Wed, 11 Dec 2024 10:35:16 -0800 (PST) From: Keith Busch To: , , , , , CC: , , , , Hannes Reinecke , Nitesh Shetty , Keith Busch Subject: [PATCHv14 04/11] block: introduce a write_stream_granularity queue limit Date: Wed, 11 Dec 2024 10:35:07 -0800 Message-ID: <20241211183514.64070-5-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241211183514.64070-1-kbusch@meta.com> References: <20241211183514.64070-1-kbusch@meta.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: 43MJaNz-udG3wjc3orVFVHa2KyNDQddw X-Proofpoint-ORIG-GUID: 43MJaNz-udG3wjc3orVFVHa2KyNDQddw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-05_03,2024-10-04_01,2024-09-30_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_111232_236237_5F564EDA X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Christoph Hellwig Export the granularity that write streams should be discarded with, as it is essential for making good use of them. Reviewed-by: Hannes Reinecke Reviewed-by: Nitesh Shetty Signed-off-by: Christoph Hellwig Signed-off-by: Keith Busch --- Documentation/ABI/stable/sysfs-block | 8 ++++++++ block/blk-sysfs.c | 3 +++ include/linux/blkdev.h | 1 + 3 files changed, 12 insertions(+) diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/sta= ble/sysfs-block index f67139b8b8eff..c454c68b68fe6 100644 --- a/Documentation/ABI/stable/sysfs-block +++ b/Documentation/ABI/stable/sysfs-block @@ -514,6 +514,14 @@ Description: supported. If supported, valid values are 1 through max_write_streams, inclusive. =20 +What: /sys/block//queue/write_stream_granularity +Date: November 2024 +Contact: linux-block@vger.kernel.org +Description: + [RO] Granularity of a write stream in bytes. The granularity + of a write stream is the size that should be discarded or + overwritten together to avoid write amplification in the device. + What: /sys/block//queue/max_segments Date: March 2010 Contact: linux-block@vger.kernel.org diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index c514c0cb5e93c..525f4fa132cd3 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -105,6 +105,7 @@ QUEUE_SYSFS_LIMIT_SHOW(max_discard_segments) QUEUE_SYSFS_LIMIT_SHOW(max_integrity_segments) QUEUE_SYSFS_LIMIT_SHOW(max_segment_size) QUEUE_SYSFS_LIMIT_SHOW(max_write_streams) +QUEUE_SYSFS_LIMIT_SHOW(write_stream_granularity) QUEUE_SYSFS_LIMIT_SHOW(logical_block_size) QUEUE_SYSFS_LIMIT_SHOW(physical_block_size) QUEUE_SYSFS_LIMIT_SHOW(chunk_sectors) @@ -448,6 +449,7 @@ QUEUE_RO_ENTRY(queue_max_segments, "max_segments"); QUEUE_RO_ENTRY(queue_max_integrity_segments, "max_integrity_segments"); QUEUE_RO_ENTRY(queue_max_segment_size, "max_segment_size"); QUEUE_RO_ENTRY(queue_max_write_streams, "max_write_streams"); +QUEUE_RO_ENTRY(queue_write_stream_granularity, "write_stream_granularity= "); QUEUE_RW_LOAD_MODULE_ENTRY(elv_iosched, "scheduler"); =20 QUEUE_RO_ENTRY(queue_logical_block_size, "logical_block_size"); @@ -583,6 +585,7 @@ static struct attribute *queue_attrs[] =3D { &queue_max_integrity_segments_entry.attr, &queue_max_segment_size_entry.attr, &queue_max_write_streams_entry.attr, + &queue_write_stream_granularity_entry.attr, &queue_hw_sector_size_entry.attr, &queue_logical_block_size_entry.attr, &queue_physical_block_size_entry.attr, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ce2c3ddda2411..452e43e5735c5 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -400,6 +400,7 @@ struct queue_limits { unsigned short max_discard_segments; =20 unsigned short max_write_streams; + unsigned int write_stream_granularity; =20 unsigned int max_open_zones; unsigned int max_active_zones; --=20 2.43.5