From patchwork Fri Sep 14 12:10:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10600677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2C8D112B for ; Fri, 14 Sep 2018 12:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC45128405 for ; Fri, 14 Sep 2018 12:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE23F2B2F5; Fri, 14 Sep 2018 12:12:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1987228564 for ; Fri, 14 Sep 2018 12:12:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F98F8E0013; Fri, 14 Sep 2018 08:12:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 981CD8E0001; Fri, 14 Sep 2018 08:12:54 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8237B8E0013; Fri, 14 Sep 2018 08:12:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by kanga.kvack.org (Postfix) with ESMTP id 5236F8E0001 for ; Fri, 14 Sep 2018 08:12:54 -0400 (EDT) Received: by mail-oi0-f70.google.com with SMTP id w185-v6so9286681oig.19 for ; Fri, 14 Sep 2018 05:12:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=xR8bwUEyU2VIEEpj0+rBcxHbSlYCYYCWX+raUfGdbtE=; b=CWK1c/QDxH9193G1b9Wvu/+4OewjDMmNyKEigeORYEgatfnRlESGUxR4GNDSedXW1L c9ixzoEA4qCuJRyCkQWirCGBbsMgNdskuj+6z3iTt78J0kEjKKbGCPEGeJXEHTjx1/aW CU1DlYXzfKWkCutlg8qNg3csizh5jj2NC6fPdx/OsA94ZAX0MaGYBAhGSwUHRz57gKja b63CNDzEtBQSJn0uG0qrfgBdYPJRqZ9qCgmNoljeafqtPpsW2gfwiXceg1iw6lt/aUO3 LJ+xsjtsMAytmCo8FKY5xNeuCez1t8kTxWhuKpovzySbIyTl6tpJ7/Ryl/xhSoFqhERh QHJg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: APzg51DUgOeqbw/XtFnmLiqx7GrUB+8WIoHJFEDIy8KNvUlRaQRkyQz4 PTz3iXSgoyWa3nXUw9qTMNhgLFRxDhcpKWEpYi/0BK4lr2Mh5HDNS0QJvvkjh6ytBTwEVWGPlfZ 3bPBEEipedzkafhx/PcuX3b97c5FSz11q+XlYsmI+UpEWtm0fUbxUb4skLf/cTps= X-Received: by 2002:a9d:49aa:: with SMTP id g42-v6mr4438389otf.106.1536927174091; Fri, 14 Sep 2018 05:12:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZa64XA3r+dU8sMzsDK/LD0nSnq3Q5S9eUcNKgiS+bYYtZfrVyTdIoswFfVyf/YRj6lHEAB X-Received: by 2002:a9d:49aa:: with SMTP id g42-v6mr4438336otf.106.1536927173054; Fri, 14 Sep 2018 05:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536927173; cv=none; d=google.com; s=arc-20160816; b=iBG7wPf+JeNaJ8AXQC3vkKdmqJiSpZoQrOB9xqdPoQCBOf93oEAVUX06caPqgNdfJ2 rfffHlWVBdgvyCnQ0yJoku5/a0J7YoQfFxmy9Ufsvb+ZGs8kWOly+xUg/d0iGTiNtRQH op02Wv0fzavsbMCi45Vgw72eNqjaCOxrQv6PuULPt6Nc52e4k9vKm1Xp1sK3Xlox+ZE+ +zj3qjvekAHEF3mdJhL3dR/U/HqM2hvMVEvO+KtORQWWZi4c/jZDTBequuoT4SdXFX7L 52UleS0li7kwxPHJrFcJ6sCdAD4hg2xlOYC8BP9q9prcZqN5cwlnpwLTA/td3VSvn5Tq k2vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=xR8bwUEyU2VIEEpj0+rBcxHbSlYCYYCWX+raUfGdbtE=; b=BGy2uiAyx5LCR9R/RYnXGgsg2GsgW/PwAHGtOyEKApV91C5TgvRrQFx3c5BVZq3qpz IUQhFaC4/xV42fH4stzWtzr1mAs51eixqjdJvVRr+0qijm1qIfSVxX3rlUBH17PQJ1rC YwjpR09dlsVvOnM1RbsTyCRjD0DG+FJMghbIIPXEKSZBWw8iEOQ4tfh8RZLVkk2XFSTF 9U74OwEW+6XLaHhZoBAlJ328kRGQPRGadyU6bBuBRvU6MkyH6SgOHBmPerDgdAflXFzT BQdw7xbfjuTshMTaSZJI+m8hrdPb7NdughTtMY13aGVsNrfvlwF6KtMypl5/dXFGXyPn 55fg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id 88-v6si1421296otw.234.2018.09.14.05.12.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Sep 2018 05:12:53 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8EC5Fmb093368 for ; Fri, 14 Sep 2018 08:12:52 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mg9yyetuj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Sep 2018 08:12:51 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Sep 2018 13:12:48 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 14 Sep 2018 13:12:36 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8ECCaS061931626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 14 Sep 2018 12:12:36 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09DA442041; Fri, 14 Sep 2018 15:12:26 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC5144204B; Fri, 14 Sep 2018 15:12:20 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.207.116]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 14 Sep 2018 15:12:20 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 14 Sep 2018 15:12:29 +0300 From: Mike Rapoport To: linux-mm@kvack.org Cc: Andrew Morton , Catalin Marinas , Chris Zankel , "David S. Miller" , Geert Uytterhoeven , Greentime Hu , Greg Kroah-Hartman , Guan Xuetao , Ingo Molnar , "James E.J. Bottomley" , Jonas Bonn , Jonathan Corbet , Ley Foon Tan , Mark Salter , Martin Schwidefsky , Matt Turner , Michael Ellerman , Michal Hocko , Michal Simek , Palmer Dabbelt , Paul Burton , Richard Kuo , Richard Weinberger , Rich Felker , Russell King , Serge Semin , Thomas Gleixner , Tony Luck , Vineet Gupta , Yoshinori Sato , linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, Mike Rapoport Subject: [PATCH 17/30] memblock: replace alloc_bootmem_node with memblock_alloc_node Date: Fri, 14 Sep 2018 15:10:32 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536927045-23536-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1536927045-23536-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18091412-0008-0000-0000-000002715A75 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18091412-0009-0000-0000-000021D9A057 Message-Id: <1536927045-23536-18-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-14_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=697 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809140129 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: X-Virus-Scanned: ClamAV using ClamSMTP Both functions attempt to allocate memory with specified alignment from a particular node. If the allocation from that node fails, they both fall back to allocating from any node in the system. Usage of native memblock API eliminates the nobootmem translation layer. Signed-off-by: Mike Rapoport Acked-by: Michal Hocko --- arch/alpha/kernel/pci_iommu.c | 4 ++-- arch/ia64/sn/kernel/io_common.c | 7 ++----- arch/ia64/sn/kernel/setup.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index 6923b0d..b52d76f 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c @@ -74,7 +74,7 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base, #ifdef CONFIG_DISCONTIGMEM - arena = alloc_bootmem_node(NODE_DATA(nid), sizeof(*arena)); + arena = memblock_alloc_node(sizeof(*arena), align, nid); if (!NODE_DATA(nid) || !arena) { printk("%s: couldn't allocate arena from node %d\n" " falling back to system-wide allocation\n", @@ -82,7 +82,7 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base, arena = alloc_bootmem(sizeof(*arena)); } - arena->ptes = __alloc_bootmem_node(NODE_DATA(nid), mem_size, align, 0); + arena->ptes = memblock_alloc_node(sizeof(*arena), align, nid); if (!NODE_DATA(nid) || !arena->ptes) { printk("%s: couldn't allocate arena ptes from node %d\n" " falling back to system-wide allocation\n", diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c index 102aaba..8b05d55 100644 --- a/arch/ia64/sn/kernel/io_common.c +++ b/arch/ia64/sn/kernel/io_common.c @@ -385,16 +385,13 @@ void __init hubdev_init_node(nodepda_t * npda, cnodeid_t node) { struct hubdev_info *hubdev_info; int size; - pg_data_t *pg; size = sizeof(struct hubdev_info); if (node >= num_online_nodes()) /* Headless/memless IO nodes */ - pg = NODE_DATA(0); - else - pg = NODE_DATA(node); + node = 0; - hubdev_info = (struct hubdev_info *)alloc_bootmem_node(pg, size); + hubdev_info = (struct hubdev_info *)memblock_alloc_node(size, 0, node); npda->pdinfo = (void *)hubdev_info; } diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index 5f6b6b4..ab2564f 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c @@ -511,7 +511,7 @@ static void __init sn_init_pdas(char **cmdline_p) */ for_each_online_node(cnode) { nodepdaindr[cnode] = - alloc_bootmem_node(NODE_DATA(cnode), sizeof(nodepda_t)); + memblock_alloc_node(sizeof(nodepda_t), 0, cnode); memset(nodepdaindr[cnode]->phys_cpuid, -1, sizeof(nodepdaindr[cnode]->phys_cpuid)); spin_lock_init(&nodepdaindr[cnode]->ptc_lock); @@ -522,7 +522,7 @@ static void __init sn_init_pdas(char **cmdline_p) */ for (cnode = num_online_nodes(); cnode < num_cnodes; cnode++) nodepdaindr[cnode] = - alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t)); + memblock_alloc_node(sizeof(nodepda_t), 0, 0); /* * Now copy the array of nodepda pointers to each nodepda.