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: 14226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3590694vqi; Tue, 19 Sep 2023 11:19:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTMztvfa2KRA4ctyiOc3j6/x0Dn+wnUTiC6xgUEy3aWitv5HGjTYZ/9Yu7NVvlyvZl+bFh X-Received: by 2002:a17:90b:224e:b0:26d:2b1d:1982 with SMTP id hk14-20020a17090b224e00b0026d2b1d1982mr493137pjb.24.1695147595345; Tue, 19 Sep 2023 11:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695147595; cv=none; d=google.com; s=arc-20160816; b=WdCl2cApqNvuEIbADiTgLTF4pmRetyQ6z7YsXn13Ia/WNQhfIA6HrX9ySvs6noyc7z +6jAjOel5NE3501s9chZNV7cT+B/KV6915+Uk1jp5h3qrWEacwHf15HPlAxq+KbpPXgm GcWwG2AzQV3KqZtVDWnsVo0UhJmRZOFWlD4kM5eKGTuLQXC6LlFaP9177Ki719q/EP2R Yzs7azsiiMfiCNmY31X4rtGeeSj/ZlktoJfktNB1dRP8H8B08ljGhhKH81iFuU96Y/SQ zefkg1SV2+IH2E0lR0FejHbI2zXSqIcwPdZeI5mzy1/EbV0L42He2qN3xarw0IN4KTuW yC5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:mime-version :content-transfer-encoding:content-id:content-language :accept-language:message-id:date:thread-index:thread-topic:subject :cc:to:from:dkim-signature:dkim-filter; bh=9v/OznAy5MmB2I5X2K/60mpRUFXshyVhJcFQaJCZyNc=; fh=uxBAUgUSkBYxjd1CTtcj7MO+vdwExfJsOb4I3IkdCcM=; b=hFIxeOjuywC2/EqW/PEGQEnD55kdLVnt2XnUEfjiuCHTXmtRZcp+Ohg2Z0aKaSIGbX Xtv6ommNqsa2ogP0rwyQlphtjyGMeTvcgk9ZVc9Hrm7FN//x6XpU04bdNCfeRbPWsZpt QgJmJ/v4qvkOVcgK7E0vybGtO8tGWdMuZW5uYpwIy4MPXGFQ93IfGjyX2z601VyE1nJL Kr+baCVAc1qvWoXwYUW9zH7g7S57zM7KnWzNOSofmx2deW+EozsnRKnEUVxOlG4J+v4B OJ3YacoWuwjhtIAsfm7As/Nf7pMtI9FcsiY3SJVD2eXWsm6jTkxyBAuYEkcxxUickFv2 AObg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IHIb+moZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id gb14-20020a17090b060e00b0026d40e6a819si1526182pjb.157.2023.09.19.11.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 11:19:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IHIb+moZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A345B802AF1B; Tue, 19 Sep 2023 06:56:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbjISN4E (ORCPT + 26 others); Tue, 19 Sep 2023 09:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232486AbjISNzz (ORCPT ); Tue, 19 Sep 2023 09:55:55 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11AA8F3 for ; Tue, 19 Sep 2023 06:55:49 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230919135547euoutp027e4726ef333bdf5486b51834e86f6151~GUVfdvHOB1711217112euoutp025 for ; Tue, 19 Sep 2023 13:55:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230919135547euoutp027e4726ef333bdf5486b51834e86f6151~GUVfdvHOB1711217112euoutp025 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 CTYBTYl9JzeBdYgIzGaVOLy4gxEkwSxQJ7Hm2SywbmEBN4k3S+Ywg9giAt4SPc3zGCFsPYnv jdvA4iwCqhIXNu1mA7F5Bawltp1YB7aAUUBW4tHKX+wQM8Ulbj2ZD3W3oMSi2XuYIWwxiX+7 HrJB2DoSZ68/YYSwDSS2Lt3HAmErSfzpWAgU5wCaoymxfpc+xEhLiY0XTjJB2IoSU7ofskOc IChxcuYTFpC/JAR+cUrsuvuUHWKOi8TK/VOhZgpLvDq+BSouI3F6cg/LBEbtWUhOnYWwbhaS dbOQrJuFZN0CRtZVjOKppcW56anFxnmp5Xr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v9CSOEbSCxdek+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: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 06:56:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777491085167669794 X-GMAIL-MSGID: 1777491085167669794 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