From patchwork Fri Dec 6 07:03:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13896554 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 8F721E77173 for ; Fri, 6 Dec 2024 07:04:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E10616B01A1; Fri, 6 Dec 2024 02:04:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DBF706B01A2; Fri, 6 Dec 2024 02:04:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C87156B01A3; Fri, 6 Dec 2024 02:04:17 -0500 (EST) 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 AAFE56B01A1 for ; Fri, 6 Dec 2024 02:04:17 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1DC9AC18E1 for ; Fri, 6 Dec 2024 07:04:17 +0000 (UTC) X-FDA: 82863644682.13.6668E81 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf13.hostedemail.com (Postfix) with ESMTP id CFADE2000B for ; Fri, 6 Dec 2024 07:03:56 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733468647; 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: references; bh=yiitNrChJV8c+8GH3Q6jptW1cvv2EhmtV8oNMItiUqs=; b=zH2/JiwMhwNt+miqkITFe5PyXbAtz9jzobi0y6W6fcFAmm9VcXRpg/et+hrsMAo8HPvMBN 4eoUgRcQDttf1IQB2id4abMYlrMEP74tuil8c6PaKo44YFMmxtaUn55ywMNjQM7a34/AW9 VeiCL27UxezJAy4sAVb/g4atnh1kdrA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733468647; a=rsa-sha256; cv=none; b=eYtPTrLawq2T0KyZE5rb/8r/ljPjOqiVmXf5BG/Ua01kK0DsUe+GdK6LFaDrzpcAKTwkAL Vx+RGj5a8nTzoeqy4Q/JwxcbpGU6rSi0Ke3zBdjTqjUaArCJaI/mNw9qBOAXWXkdHi9Jg1 NvHDpARbwBs59LAVrznPKwNtVIgxhok= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Y4Mct3sJnz1T6c4; Fri, 6 Dec 2024 15:01:50 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 55E9F1402E0; Fri, 6 Dec 2024 15:04:10 +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, 6 Dec 2024 15:04:09 +0800 From: Kefeng Wang To: Andrew Morton CC: "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Christophe Leroy , Rick Edgecombe , , Yang Shi , David Hildenbrand , Ryan Roberts , Kefeng Wang Subject: [PATCH -next] mm: don't try THP align for FS without get_unmapped_area Date: Fri, 6 Dec 2024 15:03:45 +0800 Message-ID: <20241206070345.2526501-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemf100008.china.huawei.com (7.185.36.138) X-Stat-Signature: ujhgr16apyujnp7s8inzqrfjbogh9rer X-Rspamd-Queue-Id: CFADE2000B X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1733468636-153753 X-HE-Meta: U2FsdGVkX183nul4rX6NhZDU2V5VTef/XcPM9JDp9R6+/7z2WqSgB3iQGWTwE8vGWE8NSjq6ExZ4/3RhWAv2L50IRCAHvB471ovFbAnqzfOBDHr8drMJmLcTW4C47os8ta0mDyamKsI61vW59SNJq2edaeTJiA60MkVwUwM4OIF4kZH4zlZd51JDAr9ruFlRiFrmVzgovF2PyVXGv3OVlSx3sFGdbKaSCRaPcS7bOuwRC/YuFCoT412fqFyXDmgQoBfOXBlAxDfBVIqIH0Ye8d9XykxGmz9H0FX5m80o6+1tQMuIuIXLy4xIwZeYvx1DzaHlo4va3qctovgWBvrXhRSG5JA06BDTGJFn7fd78bRBv4qvhLWebDH72R3XsXbX6/lGObouXxVdPqh3uypBeC7rttUskGQAkTU01PjN6qH04ZDtDJwqcC61CiTNWKP2MOjB6y34CiSR5mDdibf7xsrEr96lFENu64tk0KdBeZrPAeLuSJ0jDVyPnNnqEpL6dI6Ajy4NZgHMXyE7GmBpy9swFtcoR8QQJ4veHQEcnlBW0DmyajjKFS4m4dZRNYN+nKyL6TiZDVb3GG8WxvnAQtYsMB370gM1bdjKu7PjIrWKXdmSPf9rhxGox/a6f42pBUWHDzGXD6Qc26DXFv2Mq9efzwLX4u2foUTO2pOh/gQ2OMSXHVpFYbJVCkMClyb/dn4+bs/56em+mygv1Qtuz0vwXcUsd6H1e/kLBKxWenyI72AjN1ZZE+fvdPfSGUVKRfIENw0jRSJC3UmpXeGeL3b7SqqMmAO9aA1f2QdAgUmvZ1tR3+ISYzEe2UkJ0thFxxNyfPJkA46Yu0wvdat138BOdx41HH+wvKXE7cmv32irBnzr2XkvAyzZH+PMBC6D8JkuoSNZU9uHv6YTgeQ6Zxfje6JPYDMcq2C5upfIquTunTkl2LNvbbdO1YXh9tYEuurdxTSCu8iKukL5M/g KJa4L5et L97N/XW0LIY/tSSiqrcfVd1zUI2zDuHu62mDHYy7rWQamcFnBwXiLh+acvyYWdW6t50QE7KBVDvrgWx8hMo8zMmgfbDdGSUhYTqJkCiX/8oEHMDRNOUcmpHa5uFEa/1LMbMzCHeN9Lvx9tlt6/foRzhXCCz19r8Cw9yMyKaYXBMQ6hFieydRm0A5E8CjQ8JqFsp4o 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: Commit ed48e87c7df3 ("thp: add thp_get_unmapped_area_vmflags()") changes thp_get_unmapped_area() to thp_get_unmapped_area_vmflags() in __get_unmapped_area(), which won't setup get_area for anonymous mappings, but it leads to always try THP align when file ops without '.get_unmapped_area' callback too as the get_area is NULL. Since commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries") only want to enable THP align for anonymous, adding !file check to fix it. Fixes: ed48e87c7df3 ("thp: add thp_get_unmapped_area_vmflags()") Signed-off-by: Kefeng Wang Reviewed-by: Vlastimil Babka --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 1c6bdffa13dd..b373486bd1c6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -782,7 +782,7 @@ __get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, if (get_area) { addr = get_area(file, addr, len, pgoff, flags); - } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) + } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && !file && !addr /* no hint */ && IS_ALIGNED(len, PMD_SIZE)) { /* Ensures that larger anonymous mappings are THP aligned. */