From patchwork Sat Oct 28 21:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 159302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1401543vqb; Sat, 28 Oct 2023 14:18:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcA/00ECra1ZwYRlrh98LcFMV5U5FXfeSxjobTzw0WzH7byzbEbpp+Wg5E/78vjqjXxKc/ X-Received: by 2002:a05:6808:210e:b0:3a1:e17a:b3fb with SMTP id r14-20020a056808210e00b003a1e17ab3fbmr7739763oiw.1.1698527894057; Sat, 28 Oct 2023 14:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698527894; cv=none; d=google.com; s=arc-20160816; b=P2LdCv6Wk0lz6STKdUTpRI06WzH8fs3lyeXYIKXghYn+o5X61KUt/4JozDwcadsj5V +hkF1hl5dszmqM/waMybKDJByekz9UEpYuCM8Bo0xDTPk6nhLXQexcOmLmMYQ7YjKehi UMZ213i7ThnLypWnJCorX4uEOgO0f+8XEKYel9U3EGLjbXegOdYM8J0bm1VuoZ69H7/D PiDVV1QxMF18CvpGi5aCEBpDrg5WaMTKR4cKKILJSEIVAJIrl/68XoDk/bOLgQFHqr22 hNuclPiLEsPCswTQPXKq2BvLLMHPCFQcbjTzP7rTTrD2kkgj0Hl9FdsZYSM4OMzMj9Wb XoLQ== 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-language:accept-language :in-reply-to:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:dkim-filter; bh=gxd/EGAczS5Sd2rHF+B8nzW13spueLXcZPpoB3AlPYI=; fh=uxBAUgUSkBYxjd1CTtcj7MO+vdwExfJsOb4I3IkdCcM=; b=BwR6MrFC9AKWwofF1UzuAdI+rSeEA2su9gRbbAaSL0/r0OiaQz2IXXykmEF6wyezhu obbQk1pyLe8St0/bHb7j6JbHLQEw9Id4HB76D9ClITznnRz9nq9S9x2rwMDrP5yXLS+v dYiyIuGIdEJs+NVKLe+RMGV4vzVhWgigV+UgbO2s5o6VSRfeDXqKwOZ+/6FCnROWfjld X8shoT+TZ36TTns1Nf9X+cCKmUdvzFQFQN58b+lLRoMilTZYWfYDEgRuvgocrWbL9A2W 4LwlZ7HmhTiOqS8JS3bSnM0yzZXXGdi4gZ/Hp7rso4ZO4gVT9R4G4RcwkDTjoAdWTzYg wV3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HvgVsjl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cb14-20020a056a02070e00b005b065bb6822si2975912pgb.286.2023.10.28.14.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 14:18:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HvgVsjl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 4F5EF806E3E5; Sat, 28 Oct 2023 14:17:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230180AbjJ1VQb (ORCPT + 29 others); Sat, 28 Oct 2023 17:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbjJ1VQZ (ORCPT ); Sat, 28 Oct 2023 17:16:25 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1887DCA for ; Sat, 28 Oct 2023 14:15:51 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231028211550euoutp01c2e243073a19eff31afbaf140ed9e348~SYf1mO6VX3100431004euoutp01W for ; Sat, 28 Oct 2023 21:15:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231028211550euoutp01c2e243073a19eff31afbaf140ed9e348~SYf1mO6VX3100431004euoutp01W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698527750; bh=gxd/EGAczS5Sd2rHF+B8nzW13spueLXcZPpoB3AlPYI=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=HvgVsjl64HvJ64ot77kmzDje+uQuxtA7zifALFjBJvDoDR4pE12gHKnQopPb9Q1Ki JcsOmoG3yxeNnMF8nPokyO29MmGgAeRqQa/qZXip9wn/92O8bamlvsBdGOhyhREkOW bBBKJ419K6MQ52U10yhCjUxALGKOW1hVkwIgykE8= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231028211549eucas1p239234b06d304c44bb785b810de7b1834~SYf0zFEUx1087910879eucas1p2O; Sat, 28 Oct 2023 21:15:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id DD.57.37758.50A7D356; Sat, 28 Oct 2023 22:15:49 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231028211548eucas1p18d34af3d578966ba6778d4e60751789d~SYf0Hvnnc0616106161eucas1p1U; Sat, 28 Oct 2023 21:15:48 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231028211548eusmtrp167fbd68caf98448438c2e2eab8a99c2b~SYf0HNAVQ0755507555eusmtrp1c; Sat, 28 Oct 2023 21:15:48 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-07-653d7a050245 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 03.52.10549.40A7D356; Sat, 28 Oct 2023 22:15:48 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20231028211548eusmtip138c1e7e6b533f290bc0b98246a985425~SYfz7zIWw0467404674eusmtip1S; Sat, 28 Oct 2023 21:15:48 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 28 Oct 2023 22:15:48 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Sat, 28 Oct 2023 22:15:48 +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: [RFC PATCH 08/11] shmem: add file length arg in shmem_get_folio() path Thread-Topic: [RFC PATCH 08/11] shmem: add file length arg in shmem_get_folio() path Thread-Index: AQHaCePr7bvMjV6bP0CdFgNDCwhrFA== Date: Sat, 28 Oct 2023 21:15:47 +0000 Message-ID: <20231028211518.3424020-9-da.gomez@samsung.com> In-Reply-To: <20231028211518.3424020-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] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJKsWRmVeSWpSXmKPExsWy7djPc7qsVbapBqdbpSzmrF/DZrH6bj+b xeUnfBZPP/WxWOy9pW2xZ+9JFovLu+awWdxb85/VYtefHewWNyY8ZbRY9vU9u8XujYvYLH7/ mMPmwOsxu+Eii8eCTaUem1doeVw+W+qxaVUnm8emT5PYPU7M+M3i8XmTXABHFJdNSmpOZllq kb5dAldG69KJbAWfrSomTH3I1sDYpd/FyMkhIWAicbf9I1MXIxeHkMAKRom1J34wQjhfGCUu fNsK5XxmlLh99QkjTMupR1tYIRLLGSUeX57IBJIAq9r0LQ8icYZRYtK2L6wQiZWMEvNnBYDY bAKaEvtObmIHKRIRmM0qcXhxB9hYZoE6iTXPZrF0MXJwCAsESvy/nQYSFhEIk/h0fCMThK0n 0X7+CFg5i4CqxIVfU8Hm8wpYSyw7vpYdxOYUsJG4/207G4jNKCAr8WjlL3aI8eISt57MZ4L4 QFBi0ew9zBC2mMS/XQ/ZIGwdibPXYb40kNi6dB8LhK0k8adjIdSZehI3pk5hg7C1JZYtfM0M cYOgxMmZT1hA/pIQaOKSOHT/C9RQF4nrVxqghgpLvDq+hR3ClpE4PbmHZQKj9iwk981CsmMW kh2zkOxYwMiyilE8tbQ4Nz212DgvtVyvODG3uDQvXS85P3cTIzC1nf53/OsOxhWvPuodYmTi YDzEKMHBrCTCy+xokyrEm5JYWZValB9fVJqTWnyIUZqDRUmcVzVFPlVIID2xJDU7NbUgtQgm y8TBKdXA1BJ/0l4obE7jb+lNRSf/LVVrDvgTqppwpun1lHtTzwLT4Yoqsd+qjisTg40fBeT5 L9JNedjQecZ45dGI2amphyKVO69l9zV8k3weeuCsgASP6O9KbUMHy9CXylO3R4fkLtssvrdT /LtxmJa7rNktVraqeF5HhZniO3YekVjF5f+qzlZrcmhVhW2cWGBCz7GLcTu0XI2Vyu1lfmnF 5boKs6w8Un/QIfyduHvWzkvP5zFsNXvz16ixpkEzWfnqWrs/iyJ+Jlv9VZozTYaVv2xvwtt9 gU9XL0r6dm6jmIhvWfrrG5f7nSe8Kb4s+k07VYMzYOeNlNrmvevObA3o+b36OIvy9/1GNRni d1O8biixFGckGmoxFxUnAgAOHVg63AMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCKsWRmVeSWpSXmKPExsVy+t/xu7osVbapBo+W61vMWb+GzWL13X42 i8tP+Cyefupjsdh7S9tiz96TLBaXd81hs7i35j+rxa4/O9gtbkx4ymix7Ot7dovdGxexWfz+ MYfNgddjdsNFFo8Fm0o9Nq/Q8rh8ttRj06pONo9Nnyaxe5yY8ZvF4/MmuQCOKD2bovzSklSF jPziElulaEMLIz1DSws9IxNLPUNj81grI1MlfTublNSczLLUIn27BL2M1qUT2Qo+W1VMmPqQ rYGxS7+LkZNDQsBE4tSjLaxdjFwcQgJLGSUmXOpghkjISGz8cpUVwhaW+HOtiw2i6COjxNbO iWBFQgJnGCW6GiQgEiuBume/AOtgE9CU2HdyEztIQkRgNqvE4cUdjCAJZoE6iTXPZrF0MXJw CAsESvy/nQYSFhEIk9i5bSI7hK0n0X7+CFg5i4CqxIVfU8Fm8gpYSyw7vpYdpFVIIFeivy0T JMwpYCNx/9t2NhCbUUBW4tHKX+wQm8Qlbj2ZzwTxgIDEkj3noR4TlXj5+B/UYzoSZ68/YYSw DSS2Lt3HAmErSfzpWAh1sZ7EjalT2CBsbYllC18zQ5wjKHFy5hOWCYzSs5Csm4WkZRaSlllI WhYwsqxiFEktLc5Nzy021CtOzC0uzUvXS87P3cQITE7bjv3cvINx3quPeocYmTgYDzFKcDAr ifAyO9qkCvGmJFZWpRblxxeV5qQWH2I0BQbRRGYp0eR8YHrMK4k3NDMwNTQxszQwtTQzVhLn 9SzoSBQSSE8sSc1OTS1ILYLpY+LglGpgYlcX/fQuqjyj5O0+T1Ff6ztTeKQ4ZwnMrTtQeyF+ 44ESE+nld02Wec2Nu6F7TCt7h1Q2Y0qXppNDvFL8Rl8F/ZlhitwCvyPY18g7HvJsK19we693 1cXVLuLvebqnxVt1nKjbLvlD+OFHlpVCKmZ9a5ovLJryhjE3j0tkxvI/B6+bi76z5eSX7Wo8 UZtmIVIkej99j4nQsSmW9zcUXHFe2LzHavHXeyczNgt9+7m5KPRS49K5h+Zs1fz1Qri98lDi /KnyFzyUz6nxP6i68O9DXJXIt0/+NTsZTNaI7Eu9s9pe5FNafWHz8WWlXae65Wbzq3YYfQ31 PX1AWLXE+ZfzwTs2ecWmtzKfJOfsKp+pxFKckWioxVxUnAgAN/NqXtcDAAA= X-CMS-MailID: 20231028211548eucas1p18d34af3d578966ba6778d4e60751789d X-Msg-Generator: CA X-RootMTR: 20231028211548eucas1p18d34af3d578966ba6778d4e60751789d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231028211548eucas1p18d34af3d578966ba6778d4e60751789d References: <20230919135536.2165715-1-da.gomez@samsung.com> <20231028211518.3424020-1-da.gomez@samsung.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Sat, 28 Oct 2023 14:17:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781035584950412455 X-GMAIL-MSGID: 1781035584950412455 In preparation for large folio in the write path, add file length argument in shmem_get_folio() path to be able to calculate the folio order based on the file size. Use of order-0 (PAGE_SIZE) for non write paths such as read, page cache read, and vm fault. This enables high order folios in the write and fallocate paths once the folio order is calculated based on the length. Signed-off-by: Daniel Gomez --- include/linux/shmem_fs.h | 2 +- mm/khugepaged.c | 3 ++- mm/shmem.c | 33 ++++++++++++++++++--------------- mm/userfaultfd.c | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) -- 2.39.2 diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 2caa6b86106a..7138ea980884 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -137,7 +137,7 @@ enum sgp_type { }; int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop, - enum sgp_type sgp); + enum sgp_type sgp, size_t len); struct folio *shmem_read_folio_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp); diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 064654717843..fcde8223b507 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1855,7 +1855,8 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, xas_unlock_irq(&xas); /* swap in or instantiate fallocated page */ if (shmem_get_folio(mapping->host, index, - &folio, SGP_NOALLOC)) { + &folio, SGP_NOALLOC, + PAGE_SIZE)) { result = SCAN_FAIL; goto xa_unlocked; } diff --git a/mm/shmem.c b/mm/shmem.c index 9d68211373c4..d8dc2ceaba18 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -958,7 +958,7 @@ static struct folio *shmem_get_partial_folio(struct inode *inode, pgoff_t index) * (although in some cases this is just a waste of time). */ folio = NULL; - shmem_get_folio(inode, index, &folio, SGP_READ); + shmem_get_folio(inode, index, &folio, SGP_READ, PAGE_SIZE); return folio; } @@ -1644,7 +1644,7 @@ static struct folio *shmem_alloc_folio(gfp_t gfp, static struct folio *shmem_alloc_and_add_folio(gfp_t gfp, struct inode *inode, pgoff_t index, - struct mm_struct *fault_mm) + struct mm_struct *fault_mm, size_t len) { struct address_space *mapping = inode->i_mapping; struct shmem_inode_info *info = SHMEM_I(inode); @@ -1969,7 +1969,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index, */ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, struct folio **foliop, enum sgp_type sgp, gfp_t gfp, - struct vm_fault *vmf, vm_fault_t *fault_type) + struct vm_fault *vmf, vm_fault_t *fault_type, size_t len) { struct vm_area_struct *vma = vmf ? vmf->vma : NULL; struct mm_struct *fault_mm; @@ -2051,7 +2051,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, huge_gfp = vma_thp_gfp_mask(vma); huge_gfp = limit_gfp_mask(huge_gfp, gfp); folio = shmem_alloc_and_add_folio(huge_gfp, - inode, index, fault_mm); + inode, index, fault_mm, len); if (!IS_ERR(folio)) { count_vm_event(THP_FILE_ALLOC); goto alloced; @@ -2060,7 +2060,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, goto repeat; } - folio = shmem_alloc_and_add_folio(gfp, inode, index, fault_mm); + folio = shmem_alloc_and_add_folio(gfp, inode, index, fault_mm, len); if (IS_ERR(folio)) { error = PTR_ERR(folio); if (error == -EEXIST) @@ -2140,10 +2140,10 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, } int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop, - enum sgp_type sgp) + enum sgp_type sgp, size_t len) { return shmem_get_folio_gfp(inode, index, foliop, sgp, - mapping_gfp_mask(inode->i_mapping), NULL, NULL); + mapping_gfp_mask(inode->i_mapping), NULL, NULL, len); } /* @@ -2237,7 +2237,7 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf) WARN_ON_ONCE(vmf->page != NULL); err = shmem_get_folio_gfp(inode, vmf->pgoff, &folio, SGP_CACHE, - gfp, vmf, &ret); + gfp, vmf, &ret, PAGE_SIZE); if (err) return vmf_error(err); if (folio) { @@ -2716,6 +2716,9 @@ shmem_write_begin(struct file *file, struct address_space *mapping, struct folio *folio; int ret = 0; + if (!mapping_large_folio_support(mapping)) + len = min_t(size_t, len, PAGE_SIZE - offset_in_page(pos)); + /* i_rwsem is held by caller */ if (unlikely(info->seals & (F_SEAL_GROW | F_SEAL_WRITE | F_SEAL_FUTURE_WRITE))) { @@ -2725,7 +2728,7 @@ shmem_write_begin(struct file *file, struct address_space *mapping, return -EPERM; } - ret = shmem_get_folio(inode, index, &folio, SGP_WRITE); + ret = shmem_get_folio(inode, index, &folio, SGP_WRITE, len); if (ret) return ret; @@ -2796,7 +2799,7 @@ static ssize_t shmem_file_read_iter(struct kiocb *iocb, struct iov_iter *to) break; } - error = shmem_get_folio(inode, index, &folio, SGP_READ); + error = shmem_get_folio(inode, index, &folio, SGP_READ, PAGE_SIZE); if (error) { if (error == -EINVAL) error = 0; @@ -2973,7 +2976,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos, break; error = shmem_get_folio(inode, *ppos / PAGE_SIZE, &folio, - SGP_READ); + SGP_READ, PAGE_SIZE); if (error) { if (error == -EINVAL) error = 0; @@ -3160,7 +3163,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset, error = -ENOMEM; else error = shmem_get_folio(inode, index, &folio, - SGP_FALLOC); + SGP_FALLOC, (end - index) << PAGE_SHIFT); if (error) { info->fallocend = undo_fallocend; /* Remove the !uptodate folios we added */ @@ -3511,7 +3514,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, inode->i_op = &shmem_short_symlink_operations; } else { inode_nohighmem(inode); - error = shmem_get_folio(inode, 0, &folio, SGP_WRITE); + error = shmem_get_folio(inode, 0, &folio, SGP_WRITE, PAGE_SIZE); if (error) goto out_remove_offset; inode->i_mapping->a_ops = &shmem_aops; @@ -3558,7 +3561,7 @@ static const char *shmem_get_link(struct dentry *dentry, struct inode *inode, return ERR_PTR(-ECHILD); } } else { - error = shmem_get_folio(inode, 0, &folio, SGP_READ); + error = shmem_get_folio(inode, 0, &folio, SGP_READ, PAGE_SIZE); if (error) return ERR_PTR(error); if (!folio) @@ -4923,7 +4926,7 @@ struct folio *shmem_read_folio_gfp(struct address_space *mapping, BUG_ON(!shmem_mapping(mapping)); error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE, - gfp, NULL, NULL); + gfp, NULL, NULL, PAGE_SIZE); if (error) return ERR_PTR(error); diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 96d9eae5c7cc..aab8679b322a 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -256,7 +256,7 @@ static int mfill_atomic_pte_continue(pmd_t *dst_pmd, struct page *page; int ret; - ret = shmem_get_folio(inode, pgoff, &folio, SGP_NOALLOC); + ret = shmem_get_folio(inode, pgoff, &folio, SGP_NOALLOC, PAGE_SIZE); /* Our caller expects us to return -EFAULT if we failed to find folio */ if (ret == -ENOENT) ret = -EFAULT;