From patchwork Wed Nov 27 05:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 13886594 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FCB1D609A1 for ; Wed, 27 Nov 2024 05:48:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8DBE6B008C; Wed, 27 Nov 2024 00:48:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3D616B0092; Wed, 27 Nov 2024 00:48:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DE726B0095; Wed, 27 Nov 2024 00:48:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7B9016B008C for ; Wed, 27 Nov 2024 00:48:38 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2C66F1A0A07 for ; Wed, 27 Nov 2024 05:48:38 +0000 (UTC) X-FDA: 82830795264.08.81C2ED6 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) by imf26.hostedemail.com (Postfix) with ESMTP id 310C514000E for ; Wed, 27 Nov 2024 05:48:31 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="v2Ut/Ie0"; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf26.hostedemail.com: domain of bharata@amd.com designates 40.107.93.69 as permitted sender) smtp.mailfrom=bharata@amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732686512; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=52GXtxbgPZDYGiSzCy2z3eNOxOPwtwkTj6mpZG710AA=; b=E1Q/Km0pjp3Z0Y+HlWkjH7Iu1rtQTYxYP0cp98YiyG2Ev28DPDp3MqzppnyW2lxwto/FAj xGsind9g8mXtDMBp54nOo1pyXJGL5YHTsAsVoJfwScU8tYqOvfyH5SR62hjqph8OhKZqmw +/4yPtk8Wn3EsROJIELtUsV1jdQYknQ= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1732686512; a=rsa-sha256; cv=pass; b=2S8CMEWfjytxCdRy533ZY7zM5aJ3jti+j2DrI+nx+Elq1y4kHmuJ897d6DZ/z07bT6UwiB rCZ66XGo6Q2IYCU4iHxAZJI2znwsncQB6WwEvhL9rgXGxBinkTrLhIgRLPZFowgVqvSdh6 xr9eJXadZ1/1YNn/N/meZHYNvC+tZbA= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="v2Ut/Ie0"; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf26.hostedemail.com: domain of bharata@amd.com designates 40.107.93.69 as permitted sender) smtp.mailfrom=bharata@amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=flKorirD8/GBQS/+EuMxtA2oFJ79MYBAwVV0hPVamv9ActuAevIYO3xl0Prg5uqc1qXgggLBkHnpH1xhiC4PMMqJwEoRL1J/ZQfTSLE1mQZ1mjwphgHxvj0ABt7nE42hzF57AUyFvKEMu9Lxs0Q7iq4gDymTNTN5JGDYkFravjgEYGYFnuMjC5O97KvWDpsMByPvtIQa7aw2aCQvUSME/iTrNDiUzAHyNOXdQ3PX0Pzss2/irnFBZV8rWxMkk5xy6QAXMDGYwt3q0nbWUtDSofmL8Au7yvJHDn9yvcvrLG4D8BzFsiVV8Fa6JHSlqWudt4i0I6Rdf6fr77Ujj+N3Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=52GXtxbgPZDYGiSzCy2z3eNOxOPwtwkTj6mpZG710AA=; b=iwQGrX6XY4hY7SCosUaU0ouPDzta9/bZksgvcCJVG0V4YYd2W/546jL9OCNRoI2T1XHWPQjP++FS8hcWNMQm+D4y5sb5O01W6/t8cV7EftOpBeFGUlgE48FkqPDd1/A7830I7FX/fLkScOYLJKsEq+QSA3jqHyk1ujYagCFtWOmwoxllo3FesLETb6jCGSG9aLoXxFDXNF4kZcYtV8SChgrqZdds/FTJoR/lwypisb/5/pID61Tso07Pi4NLN6Vu/uhU7gfZITOejB8RmNo/DSa2lRRZFfdbKBVaONmo0FLN1W0M0P8Izl+DAEPmdF7gwRmkHruJzMCcw9y+f0QcnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=52GXtxbgPZDYGiSzCy2z3eNOxOPwtwkTj6mpZG710AA=; b=v2Ut/Ie0eurqrVUJwKsxTjalur46BqPYbuO9QiRsPA6zmR/zHqEWsR0evymekwKid1f0JOedYqPE6lrB/oVn1stcz26XGFffEeDVFcYXLb0FLVwwcA0DMop83yeJvXRiSHrcTFp2wWlSNI48ibLZ/B+FUTVOh+aPeBuVXMCVa2U= Received: from MW4PR04CA0223.namprd04.prod.outlook.com (2603:10b6:303:87::18) by CH3PR12MB8355.namprd12.prod.outlook.com (2603:10b6:610:131::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.23; Wed, 27 Nov 2024 05:48:29 +0000 Received: from SJ5PEPF000001D0.namprd05.prod.outlook.com (2603:10b6:303:87:cafe::d9) by MW4PR04CA0223.outlook.office365.com (2603:10b6:303:87::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 05:48:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D0.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 05:48:28 +0000 Received: from BLR-L-BHARARAO.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 26 Nov 2024 23:48:22 -0600 From: Bharata B Rao To: , , , CC: , , , , , , , , , , , , , Bharata B Rao Subject: [RFC PATCH 1/1] block/ioctl: Add an ioctl to enable large folios for block buffered IO path Date: Wed, 27 Nov 2024 11:17:37 +0530 Message-ID: <20241127054737.33351-2-bharata@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241127054737.33351-1-bharata@amd.com> References: <20241127054737.33351-1-bharata@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D0:EE_|CH3PR12MB8355:EE_ X-MS-Office365-Filtering-Correlation-Id: 71a54189-ff83-4cd6-d561-08dd0ea71e24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: OPGsxL+FfzQhlmDxWhzEL9jbs2Z6hnxcYkFPCrb0ecwaUdKTx5fzk86wo7Exa9J1RIzZ2XGXvz1B7OfnkeH9niQQbToe0fRx5Ne5VAtB+RA3Tre84ICiLy4FiTfKShqNg88DUOxokN07isIgZsNDyRVU1H4kVpHTGg7QX3+jSLAE6bUMRvpflxg/OoV34/06mbvO7eYrfJoxGl3zPe87jXDDDWsdOZN1VEthknJvuekQ4Vbv35btKnGr02HmIT3x2vdmc3VvBQfn9SHNmh0M1TZtn5UqGozJA7uTKprYKAdOA+qqeVbOrqViu20oV7wp0RnlNpfJltCHS5rCEKPT4v1hFsddKN+gMp/VldaHK1hFKZD2OiDlVJpoXiLiane+5zye4wiJlpDBDzmtphuZ1KIK0p6tW8OwZDKHFoRV9W5yX5KP4kGPcz9vaGIvyOWSq7vtE0G0M5iYNqYdK1HwWDWTkDOHLHkoLD4JvKN91BVvtnxTd3wAuHWBOTew3EjF0zp8j+V3mfECQbcGPGJOVVd5+GBTyTrgdOyAAS4/ydCimZEciHsinAE77ZJWkbeGJ1i1ypxlsGp1mbG/DC3Q1f2mTibhkP0G3+GZIxtxH6BqeDag941G6QTmiNPGFGhFfiKYkMt950+3FfshRuCljrsiMv6y+lOwzVjKgeOcoKYMsq1sFjqu+ZpwfzUfUXJN/spN2L9FyZU5iMPmHzLGEoIjSW7DQJ+BFGcQm9j8VzhHk2kAcz0bMC8IqNMZUHxM0joHLPS/fvkI7gCFr4hkegUqXSP8JAUdtj46KM5Aop/cZNcybx4dfFfSJX8Qn3osAuef4k9fykue/W8x64G3Zki63O6FUOyDIxnTUG76tuBFpfNBDm4d1aFkqj3HAfZGPWr2eu2oBwJH2ArhBctZYxLkP0MXYZi3/EM5kBXsEy69aKkM2123/pTrOwnPKgU9hnN11Wxd0OfSe+9W8u0NwFxuLm3CKVvhnqpmi+afERkq/S+ZP8smECSCJdYugL7OPmPUtrpwccWL19JPAr0rPyab58wmUs8pWGI0HYKBb2YTtFgsQb5ZG3JvsKj67pqP6lTl86MYJrcpKICGaZpDseg3RPhqxUBO/gdzrz5o+Tf+R0B8JnG3kypPnbcovHxNv6v9NslXmdoiH+2You7LSS5tTLqDLnhH3Zws0kupyhP2KZr25ffDrYHH4ktZI2RvjtpeVA0Bev7/piyCKu2dlyIGwiD4sNAoYVBmSqdlh8QN5jQ0tHu/DosdXDcHttf798eYA0N92K0hvO1/RWyQ45isTjK3Jci7kH8v/q3hmZ3fERapdXUbQ3ev26ozeqAZutFZrxLnHoIcAPLEXUpNhABDYMiy3PlP/AEX4zBSFUijLWrE4buaflRkNcSO8qc4eTna8MFtdqRnkVdlsDYHTSbOWaKcOQjNKhyWsRz61PYgQQLTWB6q4j6D0aitGuSW X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 05:48:28.2973 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71a54189-ff83-4cd6-d561-08dd0ea71e24 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8355 X-Stat-Signature: ixxsjkfj8iz8mns55e76tnwe7hbzw61e X-Rspamd-Queue-Id: 310C514000E X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1732686511-131141 X-HE-Meta: U2FsdGVkX1/H7hRI/1bf6mGloxSbPYSILIBUXMeX1CzRU6IT3QEd2h8RWaWUKJS/iJyPYp6edFxKLwXwT2cvz1wm7ZMwpIhYxTe93nrYXGX5bxdPXilXZqmW/F8QE+WXx91ESnfZbAufESs1/OiYn4lO6slSn5JQdjYbCiV60l1c+ebudN7/t94+/SZbHGg7CchQjGcnOqkfeWuX35B+i3aE6WD96ZduCFJ8vuKxszSY44U4R+t/IoPNacKtJL7hVIHc5i9vq97EUtlmyQGrSJjTIcxVi6H0I+AWOiJeZpyeXIWTlNbH3Agh3EauPqSLcu34zfcptvB4BBXQ8WniAysVEBoH04Sl40VnJSqDeddPIF65VBtEJDKEuQVukJtXD6f9uNnW6EN2coe4jaJgjKJnmJ9d3t/94CfFLGRC0Z4yUHYyDr6t/m/xola4Q08WUGE0dQsfK7hrD0wOkfJYQUzoHc3nA1+ucglxOcPqPY+wiqQDIDjM2NAu0/oUsbQyGk72kWVJIzsAvrAJH5SD+IbdnDYbDaE8HVFvSNxS/8HWQdb6YO5ih1A444l0ompvSyzgzb+TNoWM+BjYHudPiZHlzi9v5ZNws/bTmh5dfAsaW1lROrjz/Rq/25zvi02YssB+67LWcUJDPLsK3majtEJdkulBvb4eAsRec/fKsMlRDEahFfhwBvvoPETOxFSH0x9wYWoGWqBC51gf22aKgDLMxsIQO1zRwhrOBjSKvnKyLFAV0b/sKlDevoWnASI9RLZaNNXbtY+pBPtaDKzltnx0XQE67ZtOytkl8hcAkI0aL3I/sKSSyNIrWdkz5j7xCatk6UxG2Y5KRzUreeve+l6xnwA5w5VTjfNEEKRgOQAP/DPti/eKHBjeZNRLKPfRs/zXOBRHNZVsbBWZdngIfEuQ0lxXgfzaFHdc+BChCrwM9+blCXxs9bQpAfBOLCePyGUKAFOBOCcXX2+59uZ ZYEI+WrM V7to7+WZiNcjhf+fBJ+oHBEaMGo5vnj/BgWTi+Li418usrhOu6PHBBbfmDGDSviAaBCGIGvDkZ7+RodsFPmx4Y94zkkfrGVDKhyAr6gWckq7hyJ+OH2owb7l9ltG7MhOz27lotVOXb/7RhO8G9sp2IRS2WgqzDBStJ65qFVJe5M+6osZg4P2r3zK1CVx/DabXp+98PZJD+3dGAfBKhL+5DM4s7/vzM4OK7lSb7wvlSawxzded7f9DHjYF4tQ/w3NHkzr9e8Rj7vpttvlC7wPnbxrIUZNb9RJZT29An1RyofwQQjv5Lrn7b8JIbv3vo9BY9L12ZRimGuRWmtTbYez8Pg0/KkoWramqZuSv+M1sDj9P3ARUvaXVv4panKswrG1FWodab4Lr87jQdnCvKXbGccFYJ/GhkoRWDiI1MD3JifOKd4wzOS9i0vyf/HPNgBD0xfayBP2JYh5t4wvlnde7srFSu013TZyN1CAoMfjNPSf/SMagC8Gui76Qxg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In order to experiment using large folios for block devices read/write operations, expose an ioctl that userspace can selectively use on the raw block devices. For the write path, this forces iomap layer to provision large folios (via iomap_file_buffered_write()). Signed-off-by: Bharata B Rao --- block/ioctl.c | 8 ++++++++ include/uapi/linux/fs.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index 6554b728bae6..6af26a08ef34 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -548,6 +548,12 @@ static int blkdev_bszset(struct file *file, blk_mode_t mode, return ret; } +static int blkdev_set_large_folio(struct block_device *bdev) +{ + mapping_set_large_folios(bdev->bd_mapping); + return 0; +} + /* * Common commands that are handled the same way on native and compat * user space. Note the separate arg/argp parameters that are needed @@ -632,6 +638,8 @@ static int blkdev_common_ioctl(struct block_device *bdev, blk_mode_t mode, return blkdev_pr_preempt(bdev, mode, argp, true); case IOC_PR_CLEAR: return blkdev_pr_clear(bdev, mode, argp); + case BLKSETLFOLIO: + return blkdev_set_large_folio(bdev); default: return -ENOIOCTLCMD; } diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 753971770733..5c8a326b68a1 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -203,6 +203,8 @@ struct fsxattr { #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) #define BLKGETDISKSEQ _IOR(0x12,128,__u64) +#define BLKSETLFOLIO _IO(0x12, 129) + /* * A jump here: 130-136 are reserved for zoned block devices * (see uapi/linux/blkzoned.h)