Message ID | 20210617184507.3662-7-joao.m.martins@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=AOS9=LL=kvack.org=owner-linux-mm@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21F6CC48BE5 for <linux-mm@archiver.kernel.org>; Thu, 17 Jun 2021 18:46:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0933613E9 for <linux-mm@archiver.kernel.org>; Thu, 17 Jun 2021 18:46:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0933613E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 43DD26B0071; Thu, 17 Jun 2021 14:46:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4183A6B0072; Thu, 17 Jun 2021 14:46:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DE4D6B0073; Thu, 17 Jun 2021 14:46:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id EF21E6B0071 for <linux-mm@kvack.org>; Thu, 17 Jun 2021 14:46:01 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 81AFF10F02 for <linux-mm@kvack.org>; Thu, 17 Jun 2021 18:46:01 +0000 (UTC) X-FDA: 78264095322.23.8F64338 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf20.hostedemail.com (Postfix) with ESMTP id 013AF552 for <linux-mm@kvack.org>; Thu, 17 Jun 2021 18:46:00 +0000 (UTC) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15HIam6B020296; Thu, 17 Jun 2021 18:45:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=+Di/bDAXE43OnWt5MOHanBvl+EkBqkE3LqLc4QmEmeY=; b=fTwQvBPq7I4wQxxeWN2dyis1BOck+IbHvpnBjwppe6weHWyTrmO1IV8M+S0nUsSxaZyb aEuGEK1yCT6YJ8geTmJkecsAy3gaeJSv0/zg1hUy+F9J5E/Me/zNUqqfeNwMuUkjrtk3 /qVCjH9ksyEkvUkpSIiB20S8m32mVMGvLcP2Mez0jg+IGRXzi9Cx8fDw5bs/fxIA8wgq jt5dcVBKgNUoPJNamE6LEg0/lemy7FzsMkjcc4wwqYwRzWTPBStQfao//mPP3XFl2+PS PDDc7gfgTg8i91oUHJGlDEyijpP3S+HEa55QlU25XrDHocyWfb2UZ6szd6+ehB6Ow5Kz PQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 39770hby05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Jun 2021 18:45:45 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15HIjMmu165499; Thu, 17 Jun 2021 18:45:44 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3030.oracle.com with ESMTP id 396wavvr6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Jun 2021 18:45:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mL2qrYm/8rSFAGQAUGVv0ejZB82qdfebNhG352xVnEZcurpW/BZGcsIEvYXq+jroj9J+a44Wy11l+smnwMOLGo3ZTLK5XoYB7E2ksJpP49Zyjek0lT7qKuBiHBxScuro5PuDVyTBmtbIEFuU1I3t1DFABpPy5ZMUTQLezpquVSlduAntLH6+0rmg1KpEt899YfBp8lUgbVZhxiN3w8OyE5kzETiHDUpdpAHnyBVMEmgWfdofnaF1F8DWyDmwz1QSVz9IBtKZ40s1BcoN0KmGK3keZGFcx8t6swj+L5efs7XM3nlo8iY63AMBlT6idlha0/HeRSfKwncW+HXEzlLnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+Di/bDAXE43OnWt5MOHanBvl+EkBqkE3LqLc4QmEmeY=; b=JzVX7YunTqtlKwh9sZeKYHlW9opNJrG95ZoPvfMbdL7lqOc0oAAQSpB/XKFlorCo/GoS8k7ZaJW5w6k0lfzCeNQuYWSfZINgJady4sz8+8OXYgbrAxBHsYnCDeul6WqDcAdGgD1gQPYYGDhhA5O0vtqtqbQY/RjFQrW/DnYKYFTjWQEHECjewD1DeXP9sCjuCaViBNdjHMuwq0qt7ouVzhMZJ546PM0FChBKzG2rXZaCJeYbdniWycQbTqNWsD052FeyRo8mfKpmqIiS9vZygiHuZbj52xWM045HDOkBKg+R3U4ZUzstzIKByt3U7Sz2nrjMgZvRC2aBqWFABayG1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+Di/bDAXE43OnWt5MOHanBvl+EkBqkE3LqLc4QmEmeY=; b=teU9lVbwLHL8fccoSqDDZByE87FUi7xl70Lm5dpEY8qUvxlkTT/fp8TGJzrPgM3wsYzp9dQ84soFA69Zf6yhVNfphBRi8sSF+ci40ixNxdGRiPPNwLLxRiiOuEWZNQlokcpDotMXeJMk0ajH9dorIL5lvrWvlikPWhAWtMazWtI= Received: from BLAPR10MB4835.namprd10.prod.outlook.com (2603:10b6:208:331::11) by MN2PR10MB4365.namprd10.prod.outlook.com (2603:10b6:208:199::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Thu, 17 Jun 2021 18:45:40 +0000 Received: from BLAPR10MB4835.namprd10.prod.outlook.com ([fe80::d875:3dd7:c053:6582]) by BLAPR10MB4835.namprd10.prod.outlook.com ([fe80::d875:3dd7:c053:6582%7]) with mapi id 15.20.4242.021; Thu, 17 Jun 2021 18:45:40 +0000 From: Joao Martins <joao.m.martins@oracle.com> To: linux-mm@kvack.org Cc: Dan Williams <dan.j.williams@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com>, Naoya Horiguchi <naoya.horiguchi@nec.com>, Matthew Wilcox <willy@infradead.org>, Jason Gunthorpe <jgg@ziepe.ca>, John Hubbard <jhubbard@nvidia.com>, Jane Chu <jane.chu@oracle.com>, Muchun Song <songmuchun@bytedance.com>, Mike Kravetz <mike.kravetz@oracle.com>, Andrew Morton <akpm@linux-foundation.org>, Jonathan Corbet <corbet@lwn.net>, nvdimm@lists.linux.dev, linux-doc@vger.kernel.org, Joao Martins <joao.m.martins@oracle.com> Subject: [PATCH v2 06/14] mm/sparse-vmemmap: refactor core of vmemmap_populate_basepages() to helper Date: Thu, 17 Jun 2021 19:44:59 +0100 Message-Id: <20210617184507.3662-7-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210617184507.3662-1-joao.m.martins@oracle.com> References: <20210617184507.3662-1-joao.m.martins@oracle.com> Content-Type: text/plain X-Originating-IP: [94.61.1.144] X-ClientProxiedBy: LO2P265CA0113.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::29) To BLAPR10MB4835.namprd10.prod.outlook.com (2603:10b6:208:331::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from paddy.uk.oracle.com (94.61.1.144) by LO2P265CA0113.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4242.16 via Frontend Transport; Thu, 17 Jun 2021 18:45:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13f03156-e50d-4f1c-c178-08d931c01abe X-MS-TrafficTypeDiagnostic: MN2PR10MB4365: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <MN2PR10MB43650E545424A97F9F4C89DBBB0E9@MN2PR10MB4365.namprd10.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vQk4kcpMYlyXwaHABt+Rtdy2YtYvUk5V53SKDI6+himylDBpQTP9LZY0zODNyNCA8aTxI7ygD/IsBPyqA8pG3CHeWLEuyvK3wVR44KMxDSlEPCnXJVkGN2Nnbhnh+78oidWgWlV4IHfsM3qUGamYHDHNS7zrDRWCyLmW+L0YYbK+KxebotWFX6Qf1j6tKxvB1wy0VhzcZUyzNIW4Eha9UTAgSIrGYS6djU2ZI3YBVa33bGrQ5VeH8GTs0h87YdQ9D4Q1VDPGvYjZnTPxab/wUdgZ75qav3+FLtFshEf07jqMd3DQjlKEiucxKcYkziT1Eez488BXZQyCkkF6RkNz/QsN1EqOJkfTtL8qyNf8a4jOxhaTufLjX4psKWUM2zhOPX1q0IekXTGyIew0AaYPfS69MB1dmCKt2PpOSgYCM9JT8V2LjIy5Uw58+fkMW2WDk9GVgLiAFmkSWUIf4a6HRH9/vbodOaQ0LRoMQgFR3d5HAo2r0kR4mGQOLiXxled9plQU0yn9xjPYqv3HezK3TGLJ3ndeCcbsA7n1e1lCq/RBcXxmcXFM6Trt0jRirWQ58pn4EHM+r0PuotAltDB28vxqy4Pm5pdaq2+QZjwIbQ6ATs35zimAIS+rheH78rXVisD/eV2W7A+T6G/qhCYzLFYrRWymQbrIwGqTa81SeFU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB4835.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(366004)(346002)(39860400002)(136003)(376002)(2906002)(16526019)(316002)(186003)(86362001)(26005)(83380400001)(1076003)(956004)(66476007)(66946007)(8676002)(103116003)(6916009)(8936002)(5660300002)(38100700002)(7416002)(66556008)(54906003)(38350700002)(7696005)(52116002)(6486002)(107886003)(6666004)(4326008)(478600001)(36756003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8Y/JqGwER7veMjI4Ba4xouIC1Q+jWsAv8B7iziHRr8Gho4YLPNB2+E8GsqE0qRA/8cpd7ZpW/8RsfwjvbHRkAMTODZE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qF1+/7RRrcYfiOnH/UBe370EMToHeZ/QGnW2X66vGsdgQi/I4idUxm2zDadJkVrAC9eTGzVUp0P58MSRJ/gS9RxN4+PeDcY4shduAXqSBSE3TXY7Qrrw1X4FDDyyusSroDVw3iLtJhYHMVucCbG2yQfPFnjPrf8oq7ApyjIqlQ+R9NI X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13f03156-e50d-4f1c-c178-08d931c01abe X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB4835.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 18:45:40.3160 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fAOlPGBv8USXstf49nD0FgXgZ7M6ofqUlBrcQLHNGpeuAcVrzA2Ku0rdUj8w4jxr1/JMkLsjpVen4KRucH/SLWLz6zfMN9PuZ6e7xF35azc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4365 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10018 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106170117 X-Proofpoint-GUID: 6a6TrCDbiXdyIACpoxPDiHzUZhAgiP4X X-Proofpoint-ORIG-GUID: 6a6TrCDbiXdyIACpoxPDiHzUZhAgiP4X X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 013AF552 X-Stat-Signature: sz4kjj1f6fbiw6qi1xpcy3bhg38j3g18 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=fTwQvBPq; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=teU9lVbw; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf20.hostedemail.com: domain of joao.m.martins@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=joao.m.martins@oracle.com X-HE-Tag: 1623955560-286769 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: <linux-mm.kvack.org> |
Series |
mm, sparse-vmemmap: Introduce compound pagemaps
|
expand
|
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index 80d3ba30d345..76f4158f6301 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -570,33 +570,41 @@ pgd_t * __meminit vmemmap_pgd_populate(unsigned long addr, int node) return pgd; } -int __meminit vmemmap_populate_basepages(unsigned long start, unsigned long end, - int node, struct vmem_altmap *altmap) +static int __meminit vmemmap_populate_address(unsigned long addr, int node, + struct vmem_altmap *altmap) { - unsigned long addr = start; pgd_t *pgd; p4d_t *p4d; pud_t *pud; pmd_t *pmd; pte_t *pte; + pgd = vmemmap_pgd_populate(addr, node); + if (!pgd) + return -ENOMEM; + p4d = vmemmap_p4d_populate(pgd, addr, node); + if (!p4d) + return -ENOMEM; + pud = vmemmap_pud_populate(p4d, addr, node); + if (!pud) + return -ENOMEM; + pmd = vmemmap_pmd_populate(pud, addr, node); + if (!pmd) + return -ENOMEM; + pte = vmemmap_pte_populate(pmd, addr, node, altmap); + if (!pte) + return -ENOMEM; + vmemmap_verify(pte, node, addr, addr + PAGE_SIZE); +} + +int __meminit vmemmap_populate_basepages(unsigned long start, unsigned long end, + int node, struct vmem_altmap *altmap) +{ + unsigned long addr = start; + for (; addr < end; addr += PAGE_SIZE) { - pgd = vmemmap_pgd_populate(addr, node); - if (!pgd) - return -ENOMEM; - p4d = vmemmap_p4d_populate(pgd, addr, node); - if (!p4d) - return -ENOMEM; - pud = vmemmap_pud_populate(p4d, addr, node); - if (!pud) - return -ENOMEM; - pmd = vmemmap_pmd_populate(pud, addr, node); - if (!pmd) - return -ENOMEM; - pte = vmemmap_pte_populate(pmd, addr, node, altmap); - if (!pte) + if (vmemmap_populate_address(addr, node, altmap)) return -ENOMEM; - vmemmap_verify(pte, node, addr, addr + PAGE_SIZE); } return 0;
In preparation for describing a memmap with compound pages, move the actual pte population logic into a separate function vmemmap_populate_address() and have vmemmap_populate_basepages() walk through all base pages it needs to populate. Signed-off-by: Joao Martins <joao.m.martins@oracle.com> --- mm/sparse-vmemmap.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-)