From patchwork Fri Oct 11 06:59:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13832139 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 BC161D2447B for ; Fri, 11 Oct 2024 06:59:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28FA86B0093; Fri, 11 Oct 2024 02:59:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 219116B0095; Fri, 11 Oct 2024 02:59:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E0136B0096; Fri, 11 Oct 2024 02:59:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E454C6B0093 for ; Fri, 11 Oct 2024 02:59:34 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 20D0D1A076C for ; Fri, 11 Oct 2024 06:59:27 +0000 (UTC) X-FDA: 82660420626.24.B49D93D Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf01.hostedemail.com (Postfix) with ESMTP id B0DE54000E for ; Fri, 11 Oct 2024 06:59:29 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728629927; 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; bh=MvaBjeMm8YDBcHWUsNOhr+l9jZbfEVN2W4g6r92hU/s=; b=rXpBFkjjQPTaFdrFu0gLowF/vP0bT7y6NjoYEbtkpXTrcalmgnaCt/aSjxCIisbEt4kdEY AFM5xZABbnN/b3meB3NccH0g6oFL5+hImQuOzMvUAMNwM+6OKUJiYz8xQReS5E5pfCQLMD QpB6b3i+jIV55nC7Hw0rpEFfzWBn31A= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728629927; a=rsa-sha256; cv=none; b=nRLxu37nel0QYNlHXPwYVO1xVyAlKc5XMStGI4Fb7ipeLyJL/DcusUnqJiDdIaZafKFvTm xVo08v78JM4jHxMWhIVS8cf8/6y4OGJbd/3JlnrGExgmkF2NDCgu3P0TaFKkXT7zSfpcx1 DvVIUc0lj8aRNxf9/YDkvxLtq/+INy8= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4XPyBh4TKBz1j9gm; Fri, 11 Oct 2024 14:58:20 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 12F8D140361; Fri, 11 Oct 2024 14:59:28 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 11 Oct 2024 14:59:27 +0800 From: Kefeng Wang To: Andrew Morton , Hugh Dickins CC: Alexander Viro , Christian Brauner , Jan Kara , Matthew Wilcox , , , Baolin Wang , David Hildenbrand , Kefeng Wang Subject: [PATCH v3] tmpfs: don't enable large folios if not supported Date: Fri, 11 Oct 2024 14:59:19 +0800 Message-ID: <20241011065919.2086827-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240920143654.1008756-1-wangkefeng.wang@huawei.com> References: <20240920143654.1008756-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspam-User: X-Stat-Signature: sbzrwei99ef7yr5s15on81xtxt9pgonf X-Rspamd-Queue-Id: B0DE54000E X-Rspamd-Server: rspam11 X-HE-Tag: 1728629969-574169 X-HE-Meta: U2FsdGVkX19cuzZlF6KDLjjgD46o6KnF9QBE1TblyZ4I9CBIQ+PqOAg3NdZ1ImP9fZ5o85kr67mXfxEonBOQ/srmJBzfFFIvwWVkT/+3Una9DWxPtutL0q4emuzD44Dev7dqO0p65e4mMmS1RYSN4Hn+aEV5zEYNJXpzuIn/O9hQsP2RvZgXvU5CYLzZlqY4bpqBUaxtd0Pu1IKxhYelkeRH5C319IlAyGlb15gAhi5OCbr0mt7IFYoYvWDp+HC4XB5NJ8uMEveL1P5xX9fNQLEZPiI4ou+Eg9H4NQF6foJnXVD4+Odi1DMVZeFYUDFrovi8cxX9y9mhEuK1GOsgzymVTZ6Bph5cENvIwJFSeNkQkI1E+fYbFExthAVIIVMuMTVq4kkPXt/wD/C1jMytA5h4Ls+p5nLDbcHnM2tQ8qEMyJBsvmMxu9f68Px9qj29M9WQ6lp27lJnD1jtByWOYHDhAlGhFlYmOq/RmGJ6Z3gUr7DHiQKdl8YMA/ZtXzuk6GHxvDtJspBvuD6XByQ2qKgK3APyYNeUK8/p0T0oGF5RTUM2rp8PYnlOybazNVHDzedQULs7DaXgkxkWxVcp7Yg+6XszyicYvQK75HflCCUXRbnk/5CQPVXe/O8raxBurm1aafc9psW7UxDoHZwnb2jTsftlBQFDk/1b1qppnsZzgItLkN/KMLwySLTkK+8ZYek/Y4M9TdbZON9zZq9jNECmigvo9J1ZOycR+jCLVPN7uXQw3Pzd8HUewpstGrmeBEF4pVld3HWHGZTvn94Ks+DQ213DlAr2jgRTg7xj0nbPJYdE7gFsJzYnwbcRmZ/yrvRg+DsThkS5KcQ7XXSjyO/vRn9sf6NBMAMRRY+UMoOowP2DeRRFdE+5xhKm6/yoQzvTy7F1tMFvQyLUxAprqB47E7MJ2yeZ8cOHCq0kY04w1OjGsQKfSmuuGZCAP6Bee/sPkY52c+Alq1XBR1l F0B9PTCb ecWN0E1vgseFrGAPjQP0IS7Py9rtySFL1nxrJCjpA7AWGwFRRYwP1lhh1eHQjEjcf9gj6TXmqYx5n7oCmBj2M5k09qXP9m0Z4FDo4QTkNpCw28AODbtVcMmn+6+ZptiBiBwkTgqo2qBIfCJ4= 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: List-Subscribe: List-Unsubscribe: The tmpfs could support large folio, but there is some configurable options(mount options and runtime deny/force) to enable/disable large folio allocation, so there is a performance issue when perform write without large folio, the issue is similar to commit 4e527d5841e2 ("iomap: fault in smaller chunks for non-large folio mappings"). Don't call mapping_set_large_folios() in __shmem_get_inode() when large folio is disabled to fix it. Fixes: 9aac777aaf94 ("filemap: Convert generic_perform_write() to support large folios") Signed-off-by: Kefeng Wang --- v3: - don't enable large folio suppport in __shmem_get_inode() if disabled, suggested by Matthew. v2: - Don't use IOCB flags mm/shmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 0a2f78c2b919..2b859ac4ddc5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2850,7 +2850,10 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap, cache_no_acl(inode); if (sbinfo->noswap) mapping_set_unevictable(inode->i_mapping); - mapping_set_large_folios(inode->i_mapping); + + if ((sbinfo->huge && shmem_huge != SHMEM_HUGE_DENY) || + shmem_huge == SHMEM_HUGE_FORCE) + mapping_set_large_folios(inode->i_mapping); switch (mode & S_IFMT) { default: