From patchwork Fri Jun 16 11:08:22 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: 13282631 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 3438FEB64D7 for ; Fri, 16 Jun 2023 11:10:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1D5F6B007B; Fri, 16 Jun 2023 07:10:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCDA08E0001; Fri, 16 Jun 2023 07:10:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6E306B0081; Fri, 16 Jun 2023 07:10:18 -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 976A36B007B for ; Fri, 16 Jun 2023 07:10:18 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 76A19120C89 for ; Fri, 16 Jun 2023 11:10:18 +0000 (UTC) X-FDA: 80908342116.28.425B72E Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf20.hostedemail.com (Postfix) with ESMTP id F35831C0002 for ; Fri, 16 Jun 2023 11:10:15 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="RUFGDkV/"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf20.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686913816; 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=fnptJB5qGAcHT1CUlyBof6IMLSq55vUSDFTN16YlJMU=; b=EguKLXmgdu2vca3exHK25IvOxGJ/SEW+BUw/Tp67cJI0/Mm2gkIUWE3dZ1nGf3h8IYtzZP IKj4iQSrRnVdFlcas19Q21sQjz9TV3DIp6Ony6aQEXBpJUBv31JJfts3gIyUmlj8f8TNQN /ChdfapdCRywh0tQtD3voSxnXckLDRE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="RUFGDkV/"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf20.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686913816; a=rsa-sha256; cv=none; b=n7sYSokr6txzX5Rq3l3k6bq6/V61DpBu36NpF5wzzxjYW7Ws8vOW06zllwUn1eBC2rfdxW WJoi5QEsLPe+sJv8VcskY/PGfrf7xW6HOrkWKfCGldAkUTOPB6zj2YOmyU9zzKiEqXLxVc BTJ42qxNy5UIvXOYJZiSDRf5OuRKK2k= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35GAl7hT012077; Fri, 16 Jun 2023 11:10:06 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=fnptJB5qGAcHT1CUlyBof6IMLSq55vUSDFTN16YlJMU=; b=RUFGDkV/YOyUnQk7PIhvQaVSZdhcPhVgfcs0S6gaOIsaxTaCswznPk0c0SKhqCWB23XV skoS/+iIb2T6ABkvygfiyd+/h/ZOglgOQA+n6DV3jdB5mnY6oeJP6HsfGDJUOvUEkwkR CEX3iTXh376FU8ycWICkG8fhPPf00ot+Crgy4lqNCMcJX2eCRH7rDj3sbJ+86cZLC76V lexAf6aPRv94hGC/TozFxrcXl3ldx2mvQj1q0uhUua5HtNZkNeoQbMckeEFD7UcPYCEI r17r9uk/HTOG7lcjM5p1tTUwn1Dif6fw6E98hxP3LoHztb80exDbPdXWvPSOOsFPsxMs OQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r8p9n8e7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:10:05 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35GB59ko029868; Fri, 16 Jun 2023 11:10:05 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r8p9n8e73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:10:05 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35G8w3MO012063; Fri, 16 Jun 2023 11:10:04 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([9.208.129.114]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3r4gt6s34x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:10:04 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35GBA2JU28771058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Jun 2023 11:10:02 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87C3858058; Fri, 16 Jun 2023 11:10:02 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 454595805C; Fri, 16 Jun 2023 11:09:56 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.52.24]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 16 Jun 2023 11:09:55 +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 v2 12/16] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization Date: Fri, 16 Jun 2023 16:38:22 +0530 Message-Id: <20230616110826.344417-13-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230616110826.344417-1-aneesh.kumar@linux.ibm.com> References: <20230616110826.344417-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: or_7neAhvWhjnojFDN9BtabCUIumjqQv X-Proofpoint-GUID: sXKKgXKZW4iyFjCUKvQCt774s8hcpCSd 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-06-16_07,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 adultscore=0 impostorscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306160099 X-Rspamd-Queue-Id: F35831C0002 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: enjui8at44ksnbuxkjo763zbtyjfjrju X-HE-Tag: 1686913815-332555 X-HE-Meta: U2FsdGVkX19kvndadbtwSVeaHvsMRzETEW7bppnQbRX21YzU18LZr5vUKPvUDxW5Y5jUuJUDyIIdkImSNJLO1kYUM9Y8FohII3CELBORVtTVCdWD/MypoTXy6xUVJmq03HSSy21i8FEloUwwut8Um0Y2hn8nKkyFO8Jw8/T7muakE3rv6bXhaSIh+yH7DI8VGedf58DdUr+9PQHfVTsmaP5MsZM1kxWtbCTh1yXqIDHaJ/XZCTGFez/ft5YBLev5DaHbtsmLMUhC0XApD1b7hDdizVY/HfXW3+SSaruihv773QRq5L2s++zUSWwG58QS9o9eJymaLJhwHrpwmFxaFrbSrcJUJLp37ppq1AfFVYQ+OkmYa6kB4uSynYxtd4vYMO+V22Ywhl2AKcTcJJAUjxZOUcieILi9YuVC0yCNuQt/ltRi76BcJWwjEcR9tnOuemCa5oitQ9SPp9IfvPnERD259/KbLB9dKTlw+xedfnLDbO8UpBma15ecBctJ4TJa6vZD/uq0/GLYtEGnICyonoPvMbNVXuZbcGxOKdq709GPdYutom06nGgIK+Ly11Sf95T6nK4TATyTdJLTiKR/WhAJPlLSf/vMVP+J4wv/PFWOx0YBPyZzgnQbhhYdAavfVH2pv9A1xFL0dmZUgEN+syI2V+j83lsK+4CPBNCxZi2JBc7fEuyYFU9cLU+tspP0tJlFK3C1giisLZlv9BoLXfVoxo7XqCkw5ObFPYMRcJIUKUS8sqUkVSwy16FCkGybaPJvBfpNLJkZSNqPvpfR2vnR1JRw3coEArAFsbK+/a900eFw5qg4ACo/g6X/01JYl/EApOKRWx/NhHOBG705rBUn2TbzIRuD2PP6c702iBBPll8M5tPIBIbOyKTRtyU2ShhFIvYP8ZMNuf0clV1Ninn7PVERRVczvWKEbYX/Gri2nK0kPtcsaCVgnV32H3ibrK2pjYIqsF4a1RCw9lN /zOHYOLB 6a7+8k/i9zDmTfcfcHUEALuqU9zag8YWD7VCxb7Z/y5jHZTDTovXAgtkfxxUjY5dfnxTbfoSGvMqMvp/38SKjOvwZ2lBY9txT1aOaVhyuf4qFs2NlHmdEO4EyBqt5+VFEt2WsR38MwV3EsM0d8YHCKqInwHWWOFqDDXVuG9WadvBNNlE= 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. 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/x86/Kconfig | 3 ++- fs/Kconfig | 2 +- include/linux/mm.h | 2 +- mm/Kconfig | 5 ++++- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index d38b066fc931..2060990c4612 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -55,7 +55,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 5966ad97c30c..d8f3765ff115 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -50,7 +50,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/x86/Kconfig b/arch/x86/Kconfig index 53bab123a8ee..eb383960b6ee 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -127,7 +127,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 9a45e61cd83f..6e56ae09f0c1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3553,7 +3553,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 7672a22647b4..7b388c10baab 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -461,7 +461,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