From patchwork Fri Sep 15 09:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 13386749 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 538ACEE644B for ; Fri, 15 Sep 2023 09:52:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233772AbjIOJxB (ORCPT ); Fri, 15 Sep 2023 05:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231341AbjIOJw5 (ORCPT ); Fri, 15 Sep 2023 05:52:57 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC2F44B8 for ; Fri, 15 Sep 2023 02:51:36 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230915095123euoutp020b936287c7c3ec53c331ba838d56b568~FCa91QMix1141011410euoutp02S for ; Fri, 15 Sep 2023 09:51:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230915095123euoutp020b936287c7c3ec53c331ba838d56b568~FCa91QMix1141011410euoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694771484; bh=61KnDRJU/j6QIo81EkB+a0KV6D1jLBR/V3dxKwGeaXU=; h=From:To:CC:Subject:Date:References:From; b=XAt8KxOcepm9nH+PG81KQeEa/IFusoIoSdVDa3OqNQGR/bJCd3L4wKW7r7D231e/e bbjfJIBLda/sque+B36Jds9ADh8my6TBI+2MP9Gjb0IRfXxG7FQUlpkKo0PZ598eYK wwmXf74FvAGm3GVHlNDGO8OMIjyOrnNpcV/5iYb8= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230915095123eucas1p28eae7088346eb545abab7f81291874c3~FCa9eGfcx2793727937eucas1p24; Fri, 15 Sep 2023 09:51:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 74.E7.11320.B1924056; Fri, 15 Sep 2023 10:51:23 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230915095123eucas1p2c23d8a8d910f5a8e9fd077dd9579ad0a~FCa88M9fy1725217252eucas1p2x; Fri, 15 Sep 2023 09:51:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230915095122eusmtrp277016db842bf3caef7297f1208ae9efb~FCa87Yo4W1712217122eusmtrp2u; Fri, 15 Sep 2023 09:51:22 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-19-6504291bd619 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 9D.2B.10549.A1924056; Fri, 15 Sep 2023 10:51:22 +0100 (BST) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230915095122eusmtip287aab534de93e815592999a65d29fa78~FCa8w4py91112711127eusmtip2z; Fri, 15 Sep 2023 09:51:22 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 Sep 2023 10:51:22 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Fri, 15 Sep 2023 10:51:22 +0100 From: Daniel Gomez To: "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "willy@infradead.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" CC: "gost.dev@samsung.com" , Pankaj Raghav , Daniel Gomez Subject: [PATCH 0/6] shmem: high order folios support in write path Thread-Topic: [PATCH 0/6] shmem: high order folios support in write path Thread-Index: AQHZ57ou5Qxd50H2CkCAi/G4rRLLzQ== Date: Fri, 15 Sep 2023 09:51:21 +0000 Message-ID: <20230915095042.1320180-1-da.gomez@samsung.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [106.110.32.103] Content-ID: <2175A30A7CB61244BB755A21411698ED@scsc.local> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGKsWRmVeSWpSXmKPExsWy7djP87rSmiypBnsvSFnMWb+GzWL13X42 i8tP+Cyefupjsdh7S9tiz96TLBaXd81hs7i35j+rxa4/O9gtbkx4ymix7Ot7dovdGxexWfz+ MYfNgddjdsNFFo8Fm0o9Nq/Q8rh8ttRj06pONo9Nnyaxe5yY8ZvF4/MmuQCOKC6blNSczLLU In27BK6M1+tWMRVcEK3o2X2BrYGxQ7SLkZNDQsBEYvfkxUxdjFwcQgIrGCV6lt5jg3C+MEp8 2jkXyvnMKHH30gF2mJbbF9pZIBLLGSWeXdvPAle169dPdgjnDKPEgUmNzBDOSkaJmQc7WUH6 2QQ0Jfad3ARWJSIwm1Xi8OIOR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SczLLUIn27BL2M1+tWMRVcEK3o2X2B rYGxQ7SLkZNDQsBE4vaFdpYuRi4OIYGljBLr76xkgUjISGz8cpUVwhaW+HOtiw2i6COjRNvU JYwQzhlGiad9a5khnJWMEvuWHWYDaWET0JTYd3ITO0hCRGA2q8ThxR2MIAlmgTqJNc9mge0Q FnCWONazlx3EFhHwkDg4cQorhK0n8fPED7BBLAKqEr0b54PV8wpYS+y/uRcsziggK/Fo5S92 iJniEreezGeCuFVAYsme88wQtqjEy8f/oH7QkTh7/QkjhG0gsXXpPqg/lST+dCwEinMAzdGU WL9LH2KkpcTsmztZIGxFiSndD9khThCUODnzCcsERqlZSDbPQuiehaR7FpLuWUi6FzCyrmIU SS0tzk3PLTbUK07MLS7NS9dLzs/dxAhMT9uO/dy8g3Heq496hxiZOBgPMUpwMCuJ8LLZMqUK 8aYkVlalFuXHF5XmpBYfYjQFhtBEZinR5HxggswriTc0MzA1NDGzNDC1NDNWEuf1LOhIFBJI TyxJzU5NLUgtgulj4uCUamAKOxnHKukm475RyP7ZmsNbrjuJ7W/Y617xZmlodO7Mtne3fDvv rBV+dHvvhZMh7E+XzT1u271RLfOxSZGyW1Dp3skCD7/OeSqZ8uKIV9aEEr/zpgcnR/76NGvJ 36Wx3vMSjN8I3r17Sun//K2yItLMJcGbQ4QnPxe9V8IdIJ95xqNFMd0y5YGm4+l85Umph3nq C89c4ffedmFCRkWLoK50IPfEz/sk/S5ff2DcKZn45NOswGzlrsfXd+vdnax+jktHJzH9w+oC lwofzV/m2Q94l3vM27RU/gDT19//pyjkZ2dd3dl8oebxdra9gkvTwxSe9x/Q2/vliM8c3b8i 2suDcs9zSTgImF/P3ZTeZz1BiaU4I9FQi7moOBEAuIVg49gDAAA= X-CMS-MailID: 20230915095123eucas1p2c23d8a8d910f5a8e9fd077dd9579ad0a X-Msg-Generator: CA X-RootMTR: 20230915095123eucas1p2c23d8a8d910f5a8e9fd077dd9579ad0a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230915095123eucas1p2c23d8a8d910f5a8e9fd077dd9579ad0a References: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org This series add support for high order folios in shmem write path. This is a continuation of the shmem work from Luis here [1] following Matthew Wilcox's suggestion [2] regarding the path to take for the folio allocation order calculation. [1] RFC v2 add support for blocksize > PAGE_SIZE https://lore.kernel.org/all/ZHBowMEDfyrAAOWH@bombadil.infradead.org/T/#md3e93ab46ce2ad9254e1eb54ffe71211988b5632 [2] https://lore.kernel.org/all/ZHD9zmIeNXICDaRJ@casper.infradead.org/ Patches have been tested and sent from next-230911. They do apply cleanly to the latest next-230914. fsx and fstests has been performed on tmpfs with noswap with the following results: - fsx: 2d test, 21,5B - fstests: Same result as baseline for next-230911 [3][4][5] [3] Baseline next-230911 failures are: generic/080 generic/126 generic/193 generic/633 generic/689 [4] fstests logs baseline: https://gitlab.com/-/snippets/3598621 [5] fstests logs patches: https://gitlab.com/-/snippets/3598628 There are at least 2 cases/topics to handle that I'd appreciate feedback. 1. With the new strategy, you might end up with a folio order matching HPAGE_PMD_ORDER. However, we won't respect the 'huge' flag anymore if THP is enabled. 2. When the above (1.) occurs, the code skips the huge path, so xa_find with hindex is skipped. Daniel Daniel Gomez (5): filemap: make the folio order calculation shareable shmem: drop BLOCKS_PER_PAGE macro shmem: add order parameter support to shmem_alloc_folio shmem: add file length in shmem_get_folio path shmem: add large folios support to the write path Luis Chamberlain (1): shmem: account for large order folios fs/iomap/buffered-io.c | 6 ++- include/linux/pagemap.h | 42 ++++++++++++++++--- include/linux/shmem_fs.h | 2 +- mm/filemap.c | 8 ---- mm/khugepaged.c | 2 +- mm/shmem.c | 91 +++++++++++++++++++++++++--------------- 6 files changed, 100 insertions(+), 51 deletions(-) --- 2.39.2