From patchwork Wed Jul 26 10:52:36 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: 13327834 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 D5CE6C0015E for ; Wed, 26 Jul 2023 10:53:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64BAB6B0075; Wed, 26 Jul 2023 06:53:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F9C86B007B; Wed, 26 Jul 2023 06:53:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C2926B007D; Wed, 26 Jul 2023 06:53:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3C40F6B0075 for ; Wed, 26 Jul 2023 06:53:00 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0B94240E86 for ; Wed, 26 Jul 2023 10:53:00 +0000 (UTC) X-FDA: 81053450520.09.DE18DDC Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf13.hostedemail.com (Postfix) with ESMTP id 423A120029 for ; Wed, 26 Jul 2023 10:52:56 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hsEWGdoV; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf13.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 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=1690368777; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=d5+2tdYkbIJbO93wUKLyfjaX00W9SSUF9S8RoyA4BHI=; b=AAl33OxYm9tAjHz5qFdhmOgm/KLAilg6J7kEOYXhmFrM2KR091cglEh7d/idd1Yu7hoDWB DAeT735ym0vNj3JwMvYV5oQEWBkKvsUK7HTtbObR6i4fRxI2MSuZp1FHurquWVFrqGadaa 79OQb2HVLjcsk9QMFdXLSLvZZBAD9I4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hsEWGdoV; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf13.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690368777; a=rsa-sha256; cv=none; b=m2yP4NeKzfR/4Pl8OY/X1var+iKXNTSw/6BgQgCoEMikt3BPdihVXeLVBi3TVFgQC3Ecs1 QdKgbLRA0AFkvJUYWOwHc1XKRJLiTqaKjFus4JyNIYWnUfpoG7qiZp9PakoyqFl+CnoKfn DN2YOCrPdJjQPV7GoqOb8m7PdtDtIX8= Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36QAoXIJ001055; Wed, 26 Jul 2023 10:52:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=pp1; bh=d5+2tdYkbIJbO93wUKLyfjaX00W9SSUF9S8RoyA4BHI=; b=hsEWGdoVwFNE+TLOs4xN6UeiLwVa/yV3b4X+cnnxQOXnbk0QLB0LjP4LJnUioolI6vpx VcLZoBIqOAxSRljRhYgqbFoY99cxkdUCX0mywH43SXQod/1Ygh+LA1cAfIYUTkpXyxEn hlZvIgEgU7cf2TK8kUeCK6Fa4zsdhQuWFEcpWN3TmF5z3x/pT54AEqzsUQ6kLjXTNzXI vrFtJX/GkMgDMV3hVCnDLwJcPn9wN5EPAJeuZCgdkNU2VgEEsUPL+JBWh3aZaU7PeY5Q eDGwAVHnMvA6t35IBmfmAVyctw18pTv7sYIE1D4zxUUlqjxNurOTsqtK/nSIbKkPq1zj Uw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s323dg1w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 10:52:45 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36QAonCL002066; Wed, 26 Jul 2023 10:52:44 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s323dg1vx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 10:52:44 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36Q8mMni003624; Wed, 26 Jul 2023 10:52:44 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3s0txk3y7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 10:52:44 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36QAqhwE66322706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jul 2023 10:52:43 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 470245805E; Wed, 26 Jul 2023 10:52:43 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9300358051; Wed, 26 Jul 2023 10:52:38 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.89.11]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 26 Jul 2023 10:52:38 +0000 (GMT) X-Mailer: emacs 29.0.91 (via feedmail 11-beta-1 I) 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 Subject: [PATCH v6 01/13 -fix] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support In-Reply-To: <20230724190759.483013-2-aneesh.kumar@linux.ibm.com> References: <20230724190759.483013-1-aneesh.kumar@linux.ibm.com> <20230724190759.483013-2-aneesh.kumar@linux.ibm.com> Date: Wed, 26 Jul 2023 16:22:36 +0530 Message-ID: <87tttrvtaj.fsf@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: OKgz1UCF95wC0drZObshdaGpAaaTmzGR X-Proofpoint-GUID: xa9FGuP4-aeZMH_H1FH9DGC5qvT2TV7r 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-26_04,2023-07-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307260094 X-Rspam-User: X-Stat-Signature: jsh7c77c9a5gmgxy5k7z5zhwxnfow1ga X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 423A120029 X-HE-Tag: 1690368776-31276 X-HE-Meta: U2FsdGVkX19zLfrA7bpB0A61BtfHG9tcOz512zymveHl6mYS0aZSVUgTVIJn7H1yv+14XkE0UQBeWl8BOfigNu8NYzsnsOPmCBq3TOStPovP65RwEdyenawJqF7dIg+U7anrBA+w1h4yJR7TTRHnIIg4/bWBr0KuQykQDl18QQlYrx/U8Ups3QYVNtZMNLMQ5PrXRV/W0VXJD1uHGJacEqhsdm2/orrecbeRJIfq4WStfvKuOs9ccYF85+xkchcGoMtLr9qMhE0sykRhiy1e1LHnKbO9SvlZ2umEFBQfp7N722N3WTYtid/h/Kwn9EXfmTX6N6z2dDBojYju8VuwOj8loM5DksNr9wDKZvYRZp+k3YWGr6p53m7mOVIRMhsDnwhkJT88D+ONdDUv3RnSTyIWzmbFSlZpfbdhacWm0O75qeLyqd8EpCIUA1nY+fD9i3Gvj/bk9QDRddcYANFo62auoxIoPcHfH945y94V0EU7U1LUQZ06bRRyEJajTK8U+e0I3fvwbx9mBRxXStnE3bY62+5O9pOMEnhwWaIVavAlIhhjsNXFZYB+f7oMaMFZIuVCpLerJacxn3zhO1cOjB56u/YB+Vrwn6FPwFgjRSjF4XJ18Kzq3tXD8Yn1E2Fus0Sy+CVSAVVnWlthyI4XLWXAqvPYMfaXdbsc9LSK1/yw6AKq34KLbHgfaZ0+3QKqTmTW98aljFpRrJSJU/WOVGnMqy4bfvJh6LTc9/kW2WVCY5D/4gljJMF4OV8FgIgICdtj3YzatXk28it9int2JF918mYFwXJaQHRdTl1MfzXJeqPVjFhqSeN9/Ja9VkFZ/5JifqFqpjEm6bYjCXbfqGTMqkiVLcfpSjq5JbI21dkE18g+IJFsuAJftz0Ki3RxQXl8FRXvloriJDUzRJXrc+cKXDWE70dzlz4v5DpRWsRWGu70l/KF1PRWYtMXT1PJpkk0dIEOMR+32KrWYBM QfiNvWcu OcTTxBseLoFuiWM891Fp+Q/5wPnopPvzmTDSLlOJgjkEo/HMZSjpT08Cjts7/rE0bPQsDg9eFfb2Fw5k9KpYMIMJlm7qrV1S5/f55UUJ762VE+bY= 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: From 81719b31a4e86d2f7352da653175b7c508a94303 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Wed, 26 Jul 2023 13:45:28 +0530 Subject: [PATCH] mm/debug_vm_pgtable: Use the new has_transparent_pud_hugepage() Use the new helper to check pud hugepage support. Architecture like ppc64 will enable the config value CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD and can still have pud hugepage support disabled for hash translation. Signed-off-by: Aneesh Kumar K.V --- mm/debug_vm_pgtable.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index ee2c4c1dcfc8..d61eaa075c75 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -302,7 +302,7 @@ static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) unsigned long val = idx, *ptr = &val; pud_t pud; - if (!has_transparent_hugepage()) + if (!has_transparent_pud_hugepage()) return; pr_debug("Validating PUD basic (%pGv)\n", ptr); @@ -343,7 +343,7 @@ static void __init pud_advanced_tests(struct pgtable_debug_args *args) unsigned long vaddr = args->vaddr; pud_t pud; - if (!has_transparent_hugepage()) + if (!has_transparent_pud_hugepage()) return; page = (args->pud_pfn != ULONG_MAX) ? pfn_to_page(args->pud_pfn) : NULL; @@ -405,7 +405,7 @@ static void __init pud_leaf_tests(struct pgtable_debug_args *args) { pud_t pud; - if (!has_transparent_hugepage()) + if (!has_transparent_pud_hugepage()) return; pr_debug("Validating PUD leaf\n"); @@ -732,7 +732,7 @@ static void __init pud_devmap_tests(struct pgtable_debug_args *args) { pud_t pud; - if (!has_transparent_hugepage()) + if (!has_transparent_pud_hugepage()) return; pr_debug("Validating PUD devmap\n"); @@ -981,7 +981,7 @@ static void __init pud_thp_tests(struct pgtable_debug_args *args) { pud_t pud; - if (!has_transparent_hugepage()) + if (!has_transparent_pud_hugepage()) return; pr_debug("Validating PUD based THP\n"); @@ -1022,8 +1022,7 @@ static void __init destroy_args(struct pgtable_debug_args *args) /* Free (huge) page */ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && - IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) && - has_transparent_hugepage() && + has_transparent_pud_hugepage() && args->pud_pfn != ULONG_MAX) { if (args->is_contiguous_page) { free_contig_range(args->pud_pfn, @@ -1274,8 +1273,7 @@ static int __init init_args(struct pgtable_debug_args *args) * if we fail to allocate (huge) pages. */ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && - IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) && - has_transparent_hugepage()) { + has_transparent_pud_hugepage()) { page = debug_vm_pgtable_alloc_huge_page(args, HPAGE_PUD_SHIFT - PAGE_SHIFT); if (page) {