From patchwork Tue Sep 19 13:55:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 13391494 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 BA26ACD5BC2 for ; Tue, 19 Sep 2023 13:56:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 95D6B6B0531; Tue, 19 Sep 2023 09:55:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C16B6B0532; Tue, 19 Sep 2023 09:55:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C32B6B0533; Tue, 19 Sep 2023 09:55:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4914E6B0531 for ; Tue, 19 Sep 2023 09:55:59 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1A9321605D1 for ; Tue, 19 Sep 2023 13:55:59 +0000 (UTC) X-FDA: 81253495638.17.FDE517B Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by imf30.hostedemail.com (Postfix) with ESMTP id 0E63780030 for ; Tue, 19 Sep 2023 13:55:55 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=RdyrgSlx; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf30.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=da.gomez@samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695131756; 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=qf0ZYfltBJHFQkocAMfpwOGkTFM18/mnXm/sqbTG1Hc=; b=nDs9oQERkG9cJ5SWrI/U9Z4PSTx8gzgK+jFSeaNnb6XIn1s2ifBN0f+a2t9D8cfINyUl6Q W64ZCHeHKbtI0JRrgFxUtRUBmKVGCpTjuAD261cf+KRWEc+ZSW5nnbyWgnxhdAxIG25qH+ x5JKK1tk8wUxbY105qisfAfNxWiN55M= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=RdyrgSlx; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf30.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=da.gomez@samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695131756; a=rsa-sha256; cv=none; b=v0NlnJJMTIv6C+fNDQbfjJK7hpCfSVYYpa2/eojIt2CnJ5aizyQkh/TF2bAOXCWmh3+wdI QS3A7xDajqQ/c/NUASeyyPYrHrDnebREFqIXaj6M6X9FvECxPeQxiNMqpuendymQ0u94ws oNUfBzhsipTtNHUz4EFpV/chYHf+y8A= Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230919135554euoutp022b4dcfb1edbec041e874ddba1dbae29f~GUVmPQLEn1619216192euoutp02A for ; Tue, 19 Sep 2023 13:55:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230919135554euoutp022b4dcfb1edbec041e874ddba1dbae29f~GUVmPQLEn1619216192euoutp02A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1695131754; bh=qf0ZYfltBJHFQkocAMfpwOGkTFM18/mnXm/sqbTG1Hc=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=RdyrgSlxDQnZ8OoTspAB8yPA4ahyu5un4f+0ntoCmwiJDcdh42jompH23sIq8BVqW ed8f1O+Q8HVOUfEHREfoorxQqo4i608JK7GT+n2oHWziyh0TcWPrXrc2pUNg0wsJie 1zSJwpiEYbsFnS+ZEdeLgKqZPJ2kcKgs6RKMQ9GQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230919135554eucas1p2c289f7b4360774a8577116bad4b22a34~GUVmEZqWP1832118321eucas1p2Q; Tue, 19 Sep 2023 13:55:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 44.72.37758.A68A9056; Tue, 19 Sep 2023 14:55:54 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230919135554eucas1p1fefbe420a2381465f3b6b2b7f298433c~GUVli9uA70405804058eucas1p13; Tue, 19 Sep 2023 13:55:54 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230919135554eusmtrp145105151189bdca9c761ae4116051b63~GUVliU81s2584925849eusmtrp1S; Tue, 19 Sep 2023 13:55:54 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-ca-6509a86ab4f5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EE.C9.10549.968A9056; Tue, 19 Sep 2023 14:55:54 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230919135553eusmtip1da98dd855cbc6c425b4b7b0a0fa939af~GUVlXP9Nk1382813828eusmtip1f; Tue, 19 Sep 2023 13:55:53 +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; Tue, 19 Sep 2023 14:55:53 +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:53 +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 5/6] shmem: add file length in shmem_get_folio path Thread-Topic: [PATCH v2 5/6] shmem: add file length in shmem_get_folio path Thread-Index: AQHZ6wEANquhpkBXk0KILtjKWHTHrQ== Date: Tue, 19 Sep 2023 13:55:52 +0000 Message-ID: <20230919135536.2165715-6-da.gomez@samsung.com> In-Reply-To: <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] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBKsWRmVeSWpSXmKPExsWy7djP87pZKzhTDV4vVbaYs34Nm8Xqu/1s Fpef8Fk8/dTHYrH3lrbFnr0nWSwu75rDZnFvzX9Wi11/drBb3JjwlNFi2df37Ba7Ny5is/j9 Yw6bA6/H7IaLLB4LNpV6bF6h5XH5bKnHplWdbB6bPk1i9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J78qEyoz/LvSNFXspDZ3FCVO3PwqUxCcfXex5M T15oWOJy9JXOa18fmT2M5dJqW2TiHvd/+qHEUpyRaKjFXFScCAB3yF0I1wMAAA== X-CMS-MailID: 20230919135554eucas1p1fefbe420a2381465f3b6b2b7f298433c X-Msg-Generator: CA X-RootMTR: 20230919135554eucas1p1fefbe420a2381465f3b6b2b7f298433c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230919135554eucas1p1fefbe420a2381465f3b6b2b7f298433c References: <20230919135536.2165715-1-da.gomez@samsung.com> X-Rspamd-Queue-Id: 0E63780030 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4idto8e8cxsunqj69a77etm1tsg3i5rf X-HE-Tag: 1695131755-714465 X-HE-Meta: U2FsdGVkX1+QefOKPCRrO7dAigZ/+O7zOQoSNUQFD54Q9B0YUp/g6Zhml9A/tZz72/E+31p3DaA9nNr5YOI14MWNA/aKhf30RWu6H99T6qPWkcZyS4V10hWacKrUW9RQy9u0hNLaCNDNsBQCWAZPcRnyHj/XIkV8xuMNuDFyNcoEw6ZttEUTSjKEL/62oh3GvuxkDm2B7FCon2DskpusLcI/VHd8uPPdFtn8/HFjKmdm/xk6GaIk/19Q296ovJmlaYH3kM4+MgGD/tDytCwuxrhJgjxRCjMkRL0n1xOvJxSHtbTyHjO50RzG0/scyhCbSMOadJQFSAIGmrvYJPJMMD9t4U5Fyyp0VfZiag8aQEdhoBIWYkmrTF2U7N8QMSxLBvBy7DeDh4/72lo9zSZDQTURsar+crQjAATf8pYJKBrDwbkYsRIDMhoJGTdyxH7kBCGCARra1EFwn3BN9ODsr8P5zRbZZsnlpD4NKXsNheVQ/Gs2cVK7a7PTc5L76Bqp0Pxy2nRteWbyJ5Fi+vgHDiW/OgDM8lSVkYRxBukU80PMx93X4mg2MbX/HM2hdLWNZIWJoSQg17jliMjvbUM5BT6vI+PoE+dYO4y1DGgRvfnj5wFQdpWG3TW0g5l4QeY7khkza2H40Lk6YpFjMpNV+2rNd+KTBGtFpPLgVzNvnjqPSe2hbHuk6woaPEtmBYPILbtzjFN+TwlpWiDARLAmgMY5shnoIj5FDk8TppIakXRp72lQl7ue3baxoZyt+kD0zUDT4EOgALaJcZUaseeTKJgorraL1f5Ya8HDCoMQL2j0gN1y12GL0+yc0sIBfWQhDQ2+dN1/UwcJ6pkMY0ZhecB9z/ut5XiFZhC3887Z1+5K58HDM9yDKrzHEN5jao0zGkDGw3FqqrffAXAqCWo6pNMfdMh4e6aKe6QZD1cUQgcDarvvKkZNVe5Sj8jdsRJ/P/z5+mNj+qm/oK58o+m q/2xOZB6 9IDCAYDXWStOg+2+zbNh0Gn7gX7YwU1Ae0EaWFE0amMZOOOJe97CJ1oOtYlEzoL4WrZMJh9bXGDfAKVsDP+wIR0CWXotamAT084TzlkOKHH+c8gmxxKcs8DYMCpemQp3nLC1aXPtsIzbXOAcm7hlC72Cvc5MTzQWFEfUzylJcs35/SeyQHum5pJ4Sm72FZTmLGeKDHD1H+i19PRvwh1lCyYJUSQ== 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: To be able to calculate folio order based on the file size when allocation occurs on the write path. Use of length 0 for non write paths and PAGE_SIZE for pagecache read and vm fault. Signed-off-by: Daniel Gomez --- include/linux/shmem_fs.h | 2 +- mm/khugepaged.c | 2 +- mm/shmem.c | 32 ++++++++++++++++++-------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 6b0c626620f5..b3509e7f1054 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -133,7 +133,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 88433cc25d8a..e5d3feff6de6 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1856,7 +1856,7 @@ 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, 0)) { result = SCAN_FAIL; goto xa_unlocked; } diff --git a/mm/shmem.c b/mm/shmem.c index 66d94207b40c..38aafa0b0845 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -971,7 +971,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, 0); return folio; } @@ -1948,7 +1948,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_area_struct *vma, struct vm_fault *vmf, - vm_fault_t *fault_type) + vm_fault_t *fault_type, size_t len) { struct address_space *mapping = inode->i_mapping; struct shmem_inode_info *info = SHMEM_I(inode); @@ -2162,10 +2162,11 @@ 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, NULL); + mapping_gfp_mask(inode->i_mapping), + NULL, NULL, NULL, len); } /* @@ -2248,8 +2249,8 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf) spin_unlock(&inode->i_lock); } - err = shmem_get_folio_gfp(inode, vmf->pgoff, &folio, SGP_CACHE, - gfp, vma, vmf, &ret); + err = shmem_get_folio_gfp(inode, vmf->pgoff, &folio, SGP_CACHE, gfp, + vma, vmf, &ret, PAGE_SIZE); if (err) return vmf_error(err); if (folio) @@ -2700,6 +2701,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))) { @@ -2709,7 +2713,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; @@ -2781,7 +2785,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, 0); if (error) { if (error == -EINVAL) error = 0; @@ -2958,7 +2962,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, 0); if (error) { if (error == -EINVAL) error = 0; @@ -3145,7 +3149,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, 0); if (error) { info->fallocend = undo_fallocend; /* Remove the !uptodate folios we added */ @@ -3500,7 +3504,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, 0); if (error) goto out_remove_offset; inode->i_mapping->a_ops = &shmem_aops; @@ -3548,7 +3552,7 @@ static const char *shmem_get_link(struct dentry *dentry, return ERR_PTR(-ECHILD); } } else { - error = shmem_get_folio(inode, 0, &folio, SGP_READ); + error = shmem_get_folio(inode, 0, &folio, SGP_READ, 0); if (error) return ERR_PTR(error); if (!folio) @@ -4916,8 +4920,8 @@ struct folio *shmem_read_folio_gfp(struct address_space *mapping, int error; BUG_ON(!shmem_mapping(mapping)); - error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE, - gfp, NULL, NULL, NULL); + error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE, gfp, NULL, + NULL, NULL, PAGE_SIZE); if (error) return ERR_PTR(error);