From patchwork Thu Jul 6 08:58:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 13303380 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 BDD53EB64D9 for ; Thu, 6 Jul 2023 08:59:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A5AA8D0007; Thu, 6 Jul 2023 04:59:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 555ED8D0001; Thu, 6 Jul 2023 04:59:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41EDE8D0007; Thu, 6 Jul 2023 04:59:26 -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 355D78D0001 for ; Thu, 6 Jul 2023 04:59:26 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 02C43120AA0 for ; Thu, 6 Jul 2023 08:59:25 +0000 (UTC) X-FDA: 80980588332.10.9E794BA Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf27.hostedemail.com (Postfix) with ESMTP id 7CD2D40004 for ; Thu, 6 Jul 2023 08:59:23 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=KhvqwxvI; spf=pass (imf27.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688633963; a=rsa-sha256; cv=none; b=VBkroNznHBwj+ETOknPL8alCUyd+U3rAzSQ+9Pr3ZNRqNHAYH8Ksq+2pzQhVT3y31kwIcE 6t1nlP25xN/3fqc/0cAAPOEzmKIfmy8Q1NW9id6BplNQaD+58hIqXwAFDKRzGbH3k5Txv0 t3lBV5vBWrAxL3Jqh0EvSgu/Gg6jJ34= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=KhvqwxvI; spf=pass (imf27.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688633963; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AoFTsQX3X9wpdrWskmvUov4h2rk+jPDdNe7QeKoQYz8=; b=pMvks4sR5A3lNdKW5RXeSRXCuxfGWWgvFPH8nnqWLgocYy/8UHvkJm89JwmosGbmHl3Sha 94m3cyC8sizRv0v5XtEw+vVisSJ4csrvfsr94BDTj3lfChVYJBjxPXr4CIzps45ne3yiPs 44dU9nRgaHltjVaBZj42jZ2PBuD4lbc= Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3668lcoi027627; Thu, 6 Jul 2023 08:59:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=AoFTsQX3X9wpdrWskmvUov4h2rk+jPDdNe7QeKoQYz8=; b=KhvqwxvIC0dbviJD4zdwptA47UpSfYmKjWffF51O7ey+GeMK/tGLRUT9L/JdpCU7fNuy nylCpLTDZkMSDQiktwv0/QbUV/C2nt7qhJr7h/3CNWT7Ankb+CqVOoXbtD+R9IfUmJMe nxmxNk9LBRi6gaueGDtu8h3UEha11TQleBN4As+chjSaEKUBnpPP/p2LIsesDUsl/Fcm F4NOxteuKdHL17fB7akXFxrADQlyFYGMdOFzh+/E9kF00zT53/idhLQEotVx86jGT3Gb G7xy80s/9zM81eyrHq2LsY6TfMhZEWCxhoOTKnFf/J1mE1jF/LZI78uJQ2FbOx3ZP/ma xw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rntdpg81r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 08:59:11 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3668lbif027611; Thu, 6 Jul 2023 08:59:10 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rntdpg813-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 08:59:10 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3667sZ5Y022623; Thu, 6 Jul 2023 08:59:09 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3rjbs5qy1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 08:59:09 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3668x85n54198742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Jul 2023 08:59:08 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A01E58061; Thu, 6 Jul 2023 08:59:08 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D26DE58057; Thu, 6 Jul 2023 08:59:03 +0000 (GMT) Received: from skywalker.in.ibm.com (unknown [9.109.212.144]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 6 Jul 2023 08:59:03 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org, akpm@linux-foundation.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: Oscar Salvador , Mike Kravetz , Dan Williams , Joao Martins , Catalin Marinas , Muchun Song , Will Deacon , "Aneesh Kumar K.V" Subject: [PATCH v3 07/13] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization Date: Thu, 6 Jul 2023 14:28:13 +0530 Message-ID: <20230706085819.827761-8-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706085819.827761-1-aneesh.kumar@linux.ibm.com> References: <20230706085819.827761-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: fFcf-_WuQviJk9t4gL29Ja9EwY87Eue2 X-Proofpoint-GUID: mWdNBaQ5o1lthiivcF_IMxFvtvXpiJT1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-06_05,2023-07-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 priorityscore=1501 adultscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 suspectscore=0 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307060075 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7CD2D40004 X-Stat-Signature: 3muze4dr5fi8sbexrbnfwrwu1whn7qe5 X-Rspam-User: X-HE-Tag: 1688633963-594218 X-HE-Meta: U2FsdGVkX1+whFiWg4dGF3YhhIdjZh4tFuBzwJLmceGLQiBukOobZV6XQK7QNuTwdXI5ZvLTf2ZhAg7dawpOTQAS/POZVECrQmbn5VhK15Ul7lrrSgWi4UoVv6rM9rENluxP/tPLhxog+TOHFCGElC9LXw3aVMq7ORMRhCDBh/eCxiHG2bxqp0AtMKh1brk7EAKcCblMiyHXtA85jQdMnoiLKJN21gcbDiLNNcnGZaGOt9vK2PTstIvwTEAVBanKbXrhN44ImZ51Oz5gDHfMJvjudN4jGKkS9CfTW3h4hboSmVRMNgtihILL2Zxpu0+5wbziOHytOojfDd3sR3jZtYL4BEa/UiYSoqE1J0O+euLHNIINO2RUu6FXJl1RPNlBXG13ZCO02y2haUTW535Up+CE6kvd8TwMyShSE3DLAkBtFbwtPZbGxcPIOtJfgAeS8FyS0xFgUomafZJXSzvRurnG6Sax5ZzkOlWt9zQ9qlcyr/xy7decXWDQNzciIvcryGZ1Blkwog2qiE0irKxyQ3brDfvlXs4abQd4SWRB71bngdlbp8qV30eZyFhOI4smXZ+KCpJmWVD7DS4aD1+GluH1DxbYll4ppenQ48lQT++bZO+4+6WiVDGxbc8rc4BqaIdvNDMDwvP1vs5oNacWgo/no/CjkbT1zxfiyHSMUB2ZFW/j71pZtv7EAp2ti/orE0yXfbDkb64gJf8B6Yg/HI/6erhtVBBywMofgmpllI8Ia1Y1DSMElfqdpFaafuJTpXuFI4p2ww+jXuvzzi9JpwoLgOV/gOt2SnUM+V3dYBBTKV3gdPZ4+ny4DgL6m1JzW/gkghSOZH2DMuHbKrZLsvn/6544YPmf7OJpTm/kHy0KJf/R42HO0jI/6a6/whYWBLWorGp3pnM0IAzfgRaytjwhZkSZ5ors2DcjDm5FbVoUq0IRGjCwU3fS5LZuhiY2lGuqmbXLnZ9aVl2BD9s QcNztWZo WEIYlzQYt5vgIQ6vk2sZu6mVh+KqyTcwMiTGHoXPOGX21XkkTuK3aJNo1Gvu3WQR7yzT49hk+pKoVxqkJ2QDbwaWPVfK9Wr3yv7o/kksYLnYfRlCWgZkChBiEjcMH6EcObnmCOkjIhbyoXIGHdfZaDgZNmdW0YO1cX3qO2tKQlxE3A/72BCVuUvOjHBehTdNai2ysSxeWduheil8oCXstcxh9aIX52UlGUjsed5u54QRbRkQIdgDblTVWTx1zkHq/2M6gV7Mar8V8nfg= 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: Arm disabled hugetlb vmemmap optimization [1] because hugetlb vmemmap optimization includes an update of both the permissions (writeable to read-only) and the output address (pfn) of the vmemmap ptes. That is not supported without unmapping of pte(marking it invalid) by some architectures. With DAX vmemmap optimization we don't require such pte updates and architectures can enable DAX vmemmap optimization while having hugetlb vmemmap optimization disabled. Hence split DAX optimization support into a different config. s390, loongarch and riscv don't have devdax support. So the DAX config is not enabled for them. With this change, arm64 should be able to select DAX optimization [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Signed-off-by: Aneesh Kumar K.V --- arch/loongarch/Kconfig | 2 +- arch/riscv/Kconfig | 2 +- arch/s390/Kconfig | 2 +- arch/x86/Kconfig | 3 ++- fs/Kconfig | 2 +- include/linux/mm.h | 2 +- mm/Kconfig | 5 ++++- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index e55511af4c77..537ca2a4005a 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -59,7 +59,7 @@ config LOONGARCH select ARCH_USE_QUEUED_SPINLOCKS select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_LD_ORPHAN_WARN - select ARCH_WANT_OPTIMIZE_VMEMMAP + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select ARCH_WANTS_NO_INSTR select BUILDTIME_TABLE_SORT select COMMON_CLK diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index b49793cf34eb..fd9b683c4263 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -53,7 +53,7 @@ config RISCV select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT select ARCH_WANT_HUGE_PMD_SHARE if 64BIT select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL - select ARCH_WANT_OPTIMIZE_VMEMMAP + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU select BUILDTIME_TABLE_SORT if MMU diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 5b39918b7042..975fd06e4f4d 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -127,7 +127,7 @@ config S390 select ARCH_WANTS_NO_INSTR select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_IPC_PARSE_VERSION - select ARCH_WANT_OPTIMIZE_VMEMMAP + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select BUILDTIME_TABLE_SORT select CLONE_BACKWARDS2 select DMA_OPS if PCI diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 7422db409770..78224aa76409 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -128,7 +128,8 @@ config X86 select ARCH_WANT_GENERAL_HUGETLB select ARCH_WANT_HUGE_PMD_SHARE select ARCH_WANT_LD_ORPHAN_WARN - select ARCH_WANT_OPTIMIZE_VMEMMAP if X86_64 + select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP if X86_64 + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if X86_64 select ARCH_WANTS_THP_SWAP if X86_64 select ARCH_HAS_PARANOID_L1D_FLUSH select BUILDTIME_TABLE_SORT diff --git a/fs/Kconfig b/fs/Kconfig index 18d034ec7953..9c104c130a6e 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -252,7 +252,7 @@ config HUGETLB_PAGE config HUGETLB_PAGE_OPTIMIZE_VMEMMAP def_bool HUGETLB_PAGE - depends on ARCH_WANT_OPTIMIZE_VMEMMAP + depends on ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP depends on SPARSEMEM_VMEMMAP config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON diff --git a/include/linux/mm.h b/include/linux/mm.h index 1a2234ee14d2..83f51ec0897d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3640,7 +3640,7 @@ void vmemmap_free(unsigned long start, unsigned long end, #endif #define VMEMMAP_RESERVE_NR 2 -#ifdef CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP +#ifdef CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP static inline bool __vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap) { diff --git a/mm/Kconfig b/mm/Kconfig index 09130434e30d..923bd35f81f2 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -487,7 +487,10 @@ config SPARSEMEM_VMEMMAP # Select this config option from the architecture Kconfig, if it is preferred # to enable the feature of HugeTLB/dev_dax vmemmap optimization. # -config ARCH_WANT_OPTIMIZE_VMEMMAP +config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP + bool + +config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP bool config HAVE_MEMBLOCK_PHYS_MAP