From patchwork Tue Sep 19 13:55:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 13391485 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 A048ECD5BC5 for ; Tue, 19 Sep 2023 13:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232523AbjISN4Q (ORCPT ); Tue, 19 Sep 2023 09:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232514AbjISN4A (ORCPT ); Tue, 19 Sep 2023 09:56:00 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40249F7 for ; Tue, 19 Sep 2023 06:55:49 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230919135547euoutp01e6cf122666a9d610dec69512b5fbafb9~GUVfcfq-T3234632346euoutp01k for ; Tue, 19 Sep 2023 13:55:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230919135547euoutp01e6cf122666a9d610dec69512b5fbafb9~GUVfcfq-T3234632346euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1695131747; bh=9v/OznAy5MmB2I5X2K/60mpRUFXshyVhJcFQaJCZyNc=; h=From:To:CC:Subject:Date:References:From; b=IHIb+moZpaIaiVWh7/iDxg7NXKT9cC2T0hVOu8+ROcw8m5A4e+FhWkLUxi473YjNb P+bBDYbuoPlE5fh/frUyVMC+dMM45vEWfwMhpw8EzFXt6V1361FD89LJw5IsAruhWZ tZX/qvICpNYmEF8usbBwzwwc3Ml/RBD6qCjWYSbI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230919135547eucas1p2471ffd018646e18cbfad7a2bfb288601~GUVfGZAK-2317523175eucas1p29; Tue, 19 Sep 2023 13:55:47 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AC.62.37758.268A9056; Tue, 19 Sep 2023 14:55:47 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230919135546eucas1p1181b8914fb5eceda5f08068802941358~GUVeiqixj3130331303eucas1p1D; Tue, 19 Sep 2023 13:55:46 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230919135546eusmtrp1e7f6f9d682d56461110c3554862a7a53~GUVeh_PHK2614026140eusmtrp18; Tue, 19 Sep 2023 13:55:46 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-ae-6509a86209e2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 94.C9.10549.268A9056; Tue, 19 Sep 2023 14:55:46 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230919135546eusmtip27a87e2a32ef039a9ba314ae6b8e9a02e~GUVeOjS683046630466eusmtip2H; Tue, 19 Sep 2023 13:55:46 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (106.1.227.72) by CAMSVWEXC02.scsc.local (106.1.227.72) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 19 Sep 2023 14:55:45 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Tue, 19 Sep 2023 14:55:45 +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 v2 0/6] shmem: high order folios support in write path Thread-Topic: [PATCH v2 0/6] shmem: high order folios support in write path Thread-Index: AQHZ6wD7vvOcEXEs80eufkhxE90CMQ== Date: Tue, 19 Sep 2023 13:55:44 +0000 Message-ID: <20230919135536.2165715-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: <05AD81B6E53FB643B157C066403B7126@scsc.local> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKKsWRmVeSWpSXmKPExsWy7djPc7rJKzhTDXqmMlvMWb+GzWL13X42 i8tP+Cyefupjsdh7S9tiz96TLBaXd81hs7i35j+rxa4/O9gtbkx4ymix7Ot7dovdGxexWfz+ MYfNgddjdsNFFo8Fm0o9Nq/Q8rh8ttRj06pONo9Nnyaxe5yY8ZvF4/MmuQCOKC6blNSczLLU In27BK6MV4dnsRScUazYd+0gUwPjHYUuRk4OCQETid4nE1m7GLk4hARWMErsn7ecEcL5wiix ffV6KOczo8T54xOYYFrm774K1bKcUeLNtivscFVnVzWzgFQJCWxilFh8UREisZJR4vG6Bawg CTYBTYl9JzeBdYgIzGaVOLy4gxEkwSxQJ7Hm2SywbmEBN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ZK+nY2Kak5mWWpRfp2CXoZrw7PYik4o1ix79pB pgbGOwpdjJwcEgImEvN3X2XtYuTiEBJYyigx4/ojVoiEjMTGL1ehbGGJP9e62CCKPgIVLbrG COFsYpT4df0jlLOSUeLCsUtMIC1sApoS+05uYgdJiAjMZpU4vLiDESTBLFAnsebZLBYQW1jA TeLNkjnMILaIgLdET/M8RghbT+J74zawOIuAqsSFTbvZQGxeAWuJbSfWgd3EKCAr8WjlL3aI meISt57MZ4K4VUBiyZ7zzBC2qMTLx/+gftCROHv9CSOEbSCxdek+FghbSeJPx0KgOAfQHE2J 9bv0IUZaSmy8cJIJwlaUmNL9kB3iBEGJkzOfsExglJqFZPMshO5ZSLpnIemehaR7ASPrKkaR 1NLi3PTcYkO94sTc4tK8dL3k/NxNjMD0tO3Yz807GOe9+qh3iJGJg/EQowQHs5II70xDtlQh 3pTEyqrUovz4otKc1OJDjKbAEJrILCWanA9MkHkl8YZmBqaGJmaWBqaWZsZK4ryeBR2JQgLp iSWp2ampBalFMH1MHJxSDUxxMdeMvk6r6jU9x+k5MUckUeHWvCy1T04lLjMnJT4oC4gub/jk OW1Z/2fHk2cf7WUtk8t7Z+LE7DL7wa+dyoJhXh+8z20wXebRHaO09POFJ3IaWS+EDW6fuvj5 T1Sb9cWtmTn5hvW95bKlL5qmcj5lkE+S7Gv2Xdlx/n217vuMzRLLzrL4L+D/eJnljWTfjTmH zmk7zyzg8L7MWRATxLbnx9dc+2qDW73iIqzM80XFjwSsZI26XHJpbeEaJfv7/Q/k7l99bDDJ aMettys8P78PP7nASnym6rTw33dCTuW18ui0vNm4nP/KinYFPg+Dzhm80bv03yp8saibmdl4 88C6Izd/qhucbexRavrPcF6JpTgj0VCLuag4EQD68OTM2AMAAA== X-CMS-MailID: 20230919135546eucas1p1181b8914fb5eceda5f08068802941358 X-Msg-Generator: CA X-RootMTR: 20230919135546eucas1p1181b8914fb5eceda5f08068802941358 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230919135546eucas1p1181b8914fb5eceda5f08068802941358 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 when swap is disabled (noswap option). This is part of the Large Block Size (LBS) effort [1][2] and a continuation of the shmem work from Luis here [3] following Matthew Wilcox's suggestion [4] regarding the path to take for the folio allocation order calculation. [1] https://kernelnewbies.org/KernelProjects/large-block-size [2] https://docs.google.com/spreadsheets/d/e/2PACX-1vS7sQfw90S00l2rfOKm83Jlg0px8KxMQE4HHp_DKRGbAGcAV-xu6LITHBEc4xzVh9wLH6WM2lR0cZS8/pubhtml# [3] RFC v2 add support for blocksize > PAGE_SIZE https://lore.kernel.org/all/ZHBowMEDfyrAAOWH@bombadil.infradead.org/T/#md3e93ab46ce2ad9254e1eb54ffe71211988b5632 [4] https://lore.kernel.org/all/ZHD9zmIeNXICDaRJ@casper.infradead.org/ fsx and fstests has been performed on tmpfs with noswap with the following results: V2: - fsx: 4,9B - fstests: Same result as baseline for next-230918. V1: - fsx: 2d test, 21,5B - fstests: Same result as baseline for next-230911 [3][4][5] Patches have been tested and sent from next-230918. [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 Note: because of next-230918 regression in rmap, patch [8] applied. [8] 20230918151729.5A1F4C32796@smtp.kernel.org Daniel Changes since v1 * Order handling code simplified in shmem_get_folio_gfp after Matthew Willcox's review. * Drop patch 1/6 [6] and merge mapping_size_order code directly in shmem. * Added MAX_SHMEM_ORDER to make it explicit we don't have the same max order as in pagecache (MAX_PAGECACHE_ORDER). * Use HPAGE_PMD_ORDER-1 as MAX_SHMEM_ORDER to respect huge mount option. * Update cover letter: drop huge strategy question and add more context regarding LBS project. Add fsx and fstests summary with new baseline. * Add fixes found by Matthew in patch 3/6 [7]. * Fix length (i_size_read -> PAGE_SIZE) that is passed to shmem_get_folio_gfp in shmem_fault and shmem_read_folio_gfp to PAGE_SIZE. * Add patch as suggested by Matthew to return the number of pages freed in shmem_free_swap (instead of errno). When no pages are freed, return 0 (pages). Note: As an alternative, we can embed -ENOENT and make use of IS_ERR_VALUE. Approach discarded because little value was added. If this method is preferred, please let discuss it. [6] filemap: make the folio order calculation shareable [7] shmem: account for large order folios Daniel Gomez (5): shmem: drop BLOCKS_PER_PAGE macro shmem: return freed pages in shmem_free_swap 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 include/linux/shmem_fs.h | 2 +- mm/khugepaged.c | 2 +- mm/shmem.c | 141 ++++++++++++++++++++++++++------------- 3 files changed, 97 insertions(+), 48 deletions(-) --- 2.39.2