From patchwork Tue May 21 11:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13668883 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 3E4A9C25B79 for ; Tue, 21 May 2024 03:28:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B99576B008C; Mon, 20 May 2024 23:28:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B49596B0092; Mon, 20 May 2024 23:28:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C31E6B009D; Mon, 20 May 2024 23:28:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7A91C6B008C for ; Mon, 20 May 2024 23:28:40 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2DCDB160FCF for ; Tue, 21 May 2024 03:28:40 +0000 (UTC) X-FDA: 82140970800.10.6454CE1 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2084.outbound.protection.outlook.com [40.107.8.84]) by imf26.hostedemail.com (Postfix) with ESMTP id 5B622140005 for ; Tue, 21 May 2024 03:28:37 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=nxp.com header.s=selector2 header.b=UVPo1Zb2; dmarc=pass (policy=none) header.from=nxp.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf26.hostedemail.com: domain of xu.yang_2@nxp.com designates 40.107.8.84 as permitted sender) smtp.mailfrom=xu.yang_2@nxp.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716262117; 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=WochignTIwIPyyTdxOzcLlmWpQ7M5ZVQRhp2E5OLnAQ=; b=laEYgzFo+ToRu7R5Ii3eXfcu5qV7aQTDrtxjLA3dQl2nxYB3rfk0zZfICEc54mbX5MpEGk H6i5GiIf1QlO9OOtdhVFzZRraK8nAcKF5M56YMEK2Pld+MdpgxFJj4jcksw/V0rbg3KqU6 qOHl12eR/pEU81WszsAeIFnL5igwZF4= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=nxp.com header.s=selector2 header.b=UVPo1Zb2; dmarc=pass (policy=none) header.from=nxp.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf26.hostedemail.com: domain of xu.yang_2@nxp.com designates 40.107.8.84 as permitted sender) smtp.mailfrom=xu.yang_2@nxp.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1716262117; a=rsa-sha256; cv=pass; b=n9FejHv/sISxnHUFk4oOVgM2A/3wVs0IIXSnFdY9imh2HjC3jCyS/Hbb+9w3qCU20gF+xk o58X3Y40xV033i1EKYSK9lfZcwl4tK28R+PeAJfytaFPMcqcGTMyCusJtqFiY4I+N6+aKA xK5x6yBnrphMTDhzr/n/UWBz75BkDiw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YOsKWZF19KLSmWu208QqdOHaEtg7AfUmOf1+uD8fl6c3ZghHIFQ7GeJ1fLuVQio19OnYPxq4q90GpPPu01gZSc5wIP7fF62SwLRpXN7wfOdKwDd0A/ygPZu97FyH10YSbeIew2bJ8e0yhKRaREO82+Ep9JuQ1ZoNGy0TkwLBBUEtAkaVNJDRLazcI4ybSC6zmXCSZMDETbJSVEzhSsh0Kvn409GawRA32mdU2gG9muesiD7V4+qEcBffwE8h3bSB1wbIYgGUP2BMt1oZ/5bJtC+MPKA7lmUVG3/yJfn5d3mAow1jjW2hN4U4XLIubOH9ZOpw6yRYmo+sYZOQqHQmaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=WochignTIwIPyyTdxOzcLlmWpQ7M5ZVQRhp2E5OLnAQ=; b=j7KykuDttWzGPZTsvhGRRfy1WYIK2rTNjcnvurgaKru1cbpPbbLA4gSnGAVkf74ypC7IHVNjBZbrLGS92lppD/2++zicGzYU6zPOKQ2L8jQhXY6slk+66jTG9P48a2Z38Dd/MYdN1PFuTyw5XqVj+THg7pETDIu2LzIjpu2fokd+twRrjYcJkb6mypaJIoBo4gZGnE9GYVdIUKj4f9vPIsANBsbcbqenx44aRBMCaSAKD44+yi8o5gjhjPU78ngM1DgXxLepICuvUnQ3cgTE/ySYbg5ETGKq7efb88XL33a1rwiVx+owcAJiGT8B1E016klXB6ypO6vHLg41//xzsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WochignTIwIPyyTdxOzcLlmWpQ7M5ZVQRhp2E5OLnAQ=; b=UVPo1Zb2eq/rhEHN6lYLXFXba7TIjrJEAB8e7zKG+AtaaCtvjHOtU7x7tMyceT3FWKN+LCn+4jrgvHsfKMtpk1XRa+oZzt0oUc1jx1gN0AUfgFvLWGPJE5mJ9xVIU4k9e+VmJvFid5RI+DseNW21oceBuQam8t/y4m9IoCW9wvA= Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by PAXPR04MB8606.eurprd04.prod.outlook.com (2603:10a6:102:219::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Tue, 21 May 2024 03:28:21 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::8d2f:ac7e:966a:2f5f]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::8d2f:ac7e:966a:2f5f%6]) with mapi id 15.20.7587.035; Tue, 21 May 2024 03:28:21 +0000 From: Xu Yang To: brauner@kernel.org, djwong@kernel.org, willy@infradead.org, kpm@linux-foundation.org Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, jun.li@nxp.com Subject: [PATCH v4 2/2] iomap: fault in smaller chunks for non-large folio mappings Date: Tue, 21 May 2024 19:36:24 +0800 Message-Id: <20240521113624.2538951-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240521113624.2538951-1-xu.yang_2@nxp.com> References: <20240521113624.2538951-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI2P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::8) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|PAXPR04MB8606:EE_ X-MS-Office365-Filtering-Correlation-Id: b283f680-2b96-4a97-fa65-08dc794610a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|52116005|366007|38350700005; X-Microsoft-Antispam-Message-Info: mtIuQs436rEL/iPQ6cnC7nMG5A3Y0WK5ehJ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wJW2PvgSvEp1E3VvU10aa8IjR35SJGn+2xpdGwptsNnF5SVPdgfTmqekCKIa2zV24AA64Hm3XsMJzzMgwzJdVVkNrCDBXNWg3EZoUDmhVgx3v0XTNQCsGRQX2JEQKfZ0G48EVStZknS1FDjOqquc6d+L/ZafcyDPkTP6cYpPGLYHgxmGNfztsnpTO0h/Te0di1evaKA3Q4jA78WfIseU1dI9U+TTLcoWFMGsaqaVgBhAAIe+j/JADP1MahHmyNJT3MZqDSg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8822.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(52116005)(366007)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DZ+VDfzlbLPa3j43FmSht4mwUDXDTVZoCUwjHcrxZylmYUBvzDRdEvdyW9Bu/ysuCNdHfEUxXWp3+I+D8KFMs3sew+3PC/hlc7r4PE0F+lvVkR/hW42ScK+2wLmAFayaG6D/IplNDEiFA2hBfrAEopJB8y1KkEU1m2e7zB+ulA6fh6iyQpmuoAitaVXiH+MJVzw2SRgB7v2ddLeFefhBtgV//iNNr/aInQSLPVyG6KP5YNI9UnFhpv5uM7Nh+tz/IuQp8x2srp4tzIkmDrPYhcs2BlTwHk/ONdLT6OKnDwaYkrdbl/0GvAoleEU0z/sfJ86Y6qFV/u37UhHun6xuKlLdZ4finRmSZJ7ZRLiF4t0s1NgZBPe34ecBGm7SLhr3KUFZ37HVXO44mPNWWOi4tcI2L6P37mIDiUPAsS0jnlQft5Id9NmYAJM90A5yIFeUlaYvb8w6F+hlYMF7F/OcS8yOCaWtbbBZ6par9EAb7zA80e9/oJTu5k0pauhJGOzixIV9ZXKTNmWceaRXkYy6btfPc6ToaGB0DXlKmNeubP0OK2PyCnvm3y6idori5ZUL7VSJByt7XR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4 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2024 03:28:21.6777 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kXuiFbf7TgqmUIn09s4fmFe7zwhLC2ErouoZ2cUEe6zXl773XL+xRnxYsMJd9OUo70UnHiYjBIwBjiy5xUDEZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8606 X-Rspamd-Queue-Id: 5B622140005 X-Stat-Signature: e6e38171367npypdqwhxqq8xnw7w43mw X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1716262117-40317 X-HE-Meta: U2FsdGVkX1+r9IXpbUve6o/ilqVwSB9HdJgJ7XYv1q0PvD7Vj0Ij9LQpzCRuWkZNi/1EpOTVqKEW+/8IvfhNHyHqKSRMz/nXGA/t7gllNkr2DlZGQMMebsV26dOUt3NctnLMyIaLtsAEz4qWGfjuSX24GVvegWKBOX8QSSmSc5Wy0fOLtR6szVlPqk62Xa56Ot89Z0e16w3KrvZjlPUjWlyemdcJ6E3e3Wbgiv8fWPX2/KfDfZqJzv2MF2G8I65Yf37gub+67J5vYeMQzGMpVXLlcwiYVO7YGz5c1Lo3EW5gdo/7cLdmriFfYZwtoy/cjRLS+D53LrZh09PJxU0/gE7UDlwCMkN7caIZibC3NsIG4J2ZUCfXW0rNLhexRTCouIgDAZdVMe9MGTcMRzdpR9hBjHnyBQoi3im+4rf64Tk4Jz2Y5et3tbSKGY4HKN5RjOmGF9UjTAsuXmYx6y1+MecvQ9RvHwhyk/AjDjHJ4wmsfdNcmRVD+jqe2WC7MjKMvo9XStNUuR+xzlfnsRTbALMVe8ag65c5KsXiNEQ1+l506c/aQLQI2i1DzyAEsdQZla0kSXWjXtRfehQ1zFKU6c65z822suMtRegdt/vWMoGARo8JJTGf6MoWENzVxFVVPz+WOsqKEUYHmM402S65Rxsreu5bPE4L6+GdY5OhwUxdb6gj/CWiX+o8INAUB5FGsDTP0rMD5K0IUDy7ELrY4i+gQ3ktXPeIc43/AR0N276dYJzytFsThll85Kh4CyQZ9PksiaECTg6DyWilwRDOkEBbYeZkdhuZZh32RSjguvS+SqnVF3lU9/yljBNT+Hdn5eWpgTgBWC8w68+YHvhazB1ASDvxMNDhPDkM4m5dQtso1Ud2mHqhJajRw75ahlHvULv5kS9d/yKEck17HzPCImPcmoMc1GegGTVvFqT56UE1T7UpjsK6RYTrkuHB+XbXXK7/G26mACnxdrcO9eJ 4KWwKdlH LoA9ZRCZWR2crAbkWIkpH7YygxKhGVSjVY9sSkfjEwzi+mIiK9S7ar5XJPgkjk5mMJNPlRPu9T54n/V4Q9dJWwX0PUkt63HcKMUTKRq3BqIl/2v+mBlCe4NL2GkBavTQFUZUoa4PBYiVw9QFwML1hSk0DxRoUQy7PY3ieMrgdtsEXuSCGcDDiDe+y3cVD7Er/VtPhjwymRwDC/EIzgK5T7XOcteSaWHio9XSo4MVh2cY9hrJhdiwgVGkxZ3n4cvBJZUt6BQb4mJX/7xu+wNidAyAA+H4Qs6VrSiTnH4zrU+bRmAZSManlP/XDxKbyp1MHNOrlUkELVZG2gsrXBjl54oWNaQ== 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: Since commit (5d8edfb900d5 "iomap: Copy larger chunks from userspace"), iomap will try to copy in larger chunks than PAGE_SIZE. However, if the mapping doesn't support large folio, only one page of maximum 4KB will be created and 4KB data will be writen to pagecache each time. Then, next 4KB will be handled in next iteration. This will cause potential write performance problem. If chunk is 2MB, total 512 pages need to be handled finally. During this period, fault_in_iov_iter_readable() is called to check iov_iter readable validity. Since only 4KB will be handled each time, below address space will be checked over and over again: start end - buf, buf+2MB buf+4KB, buf+2MB buf+8KB, buf+2MB ... buf+2044KB buf+2MB Obviously the checking size is wrong since only 4KB will be handled each time. So this will get a correct chunk to let iomap work well in non-large folio case. With this change, the write speed will be stable. Tested on ARM64 device. Before: - dd if=/dev/zero of=/dev/sda bs=400K count=10485 (334 MB/s) - dd if=/dev/zero of=/dev/sda bs=800K count=5242 (278 MB/s) - dd if=/dev/zero of=/dev/sda bs=1600K count=2621 (204 MB/s) - dd if=/dev/zero of=/dev/sda bs=2200K count=1906 (170 MB/s) - dd if=/dev/zero of=/dev/sda bs=3000K count=1398 (150 MB/s) - dd if=/dev/zero of=/dev/sda bs=4500K count=932 (139 MB/s) After: - dd if=/dev/zero of=/dev/sda bs=400K count=10485 (339 MB/s) - dd if=/dev/zero of=/dev/sda bs=800K count=5242 (330 MB/s) - dd if=/dev/zero of=/dev/sda bs=1600K count=2621 (332 MB/s) - dd if=/dev/zero of=/dev/sda bs=2200K count=1906 (333 MB/s) - dd if=/dev/zero of=/dev/sda bs=3000K count=1398 (333 MB/s) - dd if=/dev/zero of=/dev/sda bs=4500K count=932 (333 MB/s) Fixes: 5d8edfb900d5 ("iomap: Copy larger chunks from userspace") Cc: stable@vger.kernel.org Reviewed-by: Darrick J. Wong Signed-off-by: Xu Yang --- Changes in v2: - fix address space description in message Changes in v3: - adjust 'chunk' and add mapping_max_folio_size() in header file as suggested by Matthew - add write performance results in commit message Changes in v4: - split mapping_max_folio_size() into a single patch 1/2 - adjust subject - add Rb tag --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 41c8f0c68ef5..c5802a459334 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -898,11 +898,11 @@ static bool iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len, static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i) { loff_t length = iomap_length(iter); - size_t chunk = PAGE_SIZE << MAX_PAGECACHE_ORDER; loff_t pos = iter->pos; ssize_t total_written = 0; long status = 0; struct address_space *mapping = iter->inode->i_mapping; + size_t chunk = mapping_max_folio_size(mapping); unsigned int bdp_flags = (iter->flags & IOMAP_NOWAIT) ? BDP_ASYNC : 0; do {