From patchwork Wed Sep 5 15:59:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10589139 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 3FA14112B for ; Wed, 5 Sep 2018 16:01:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20C892A747 for ; Wed, 5 Sep 2018 16:00:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6E22A713; Wed, 5 Sep 2018 16:00:55 +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 71F482A64F for ; Wed, 5 Sep 2018 16:00:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50E2A6B7413; Wed, 5 Sep 2018 12:00:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 41D2D6B7414; Wed, 5 Sep 2018 12:00:47 -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 295726B7416; Wed, 5 Sep 2018 12:00:47 -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 E9B3A6B7414 for ; Wed, 5 Sep 2018 12:00:46 -0400 (EDT) Received: by mail-oi0-f70.google.com with SMTP id j17-v6so8988958oii.8 for ; Wed, 05 Sep 2018 09:00:46 -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=O3HhXyIyLwtOvtBTggJXTDnAw3xgRvRvXHFqWKdUjgE=; b=V7XrvgsYYaVCYIob+o9JtVWrBB6DqIVvW5pMlJ+emivyyNNfF9rWms5WlqcrUYkIoO pP+smL1cE1TF74F5efoo1TyXb6ZTZP6zjo3zPcE7oXzpABx/aASj8jggC7S0VMWqSdYN A+xsVrEbTENywTl87/xXAxReXSu3UF3cuzIEg2mcMVQf/rV3UrGwTI7SRBLiQ+lmyp6k ek+YJ6eJWGBYnGZq5NkBQ4d24rn8Rd+Q9J0O+Wgtn/7NA0PCzBVEGm4+zDvNwLKHNg3n vjjjSwDdRTUfTrsEWxX/MkRpYkMd3kIqsL6lnj6NF0pj89qU1yT7aqseq28R4Is9NJXu iigg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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: APzg51DRH+TtKGGfrqrYOy6si8oGQa6imZh04M4AOew2B6kd677aYKvV H6Vq4anZdnzO3T4F88FBhTGDmyJMZ4coG41QU8Ix3a/Mpnplf8hp1d4gI1jl3/O5NYo7+a/LTbO Fk4N+SdD/IsoD+DZNO7DB7U6Tkdh68uUIO1ewijhJXR7emoulAcLyHJdfR3lVo9Q= X-Received: by 2002:a54:4192:: with SMTP id 18-v6mr3519003oiy.105.1536163246689; Wed, 05 Sep 2018 09:00:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaGfpg/sXoaoKJ7GnZdjbCbqBt6lLa2htbBzLHniSLl42u5L80u+PWY9iFzaHZ6DHhDHaqi X-Received: by 2002:a54:4192:: with SMTP id 18-v6mr3518915oiy.105.1536163245617; Wed, 05 Sep 2018 09:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536163245; cv=none; d=google.com; s=arc-20160816; b=EZnZ/ufrAQdPOFCLqXrCpLh0grO23XVsUtkMAYuLgDBiys2bXVG4JRAg6fj1vBNWlp cZz/1Ihoo42rKU5PznfiTlJFxbtnuTHXR0B17C4kNxUq3gpbKKRKrnfvktQ5AqohLLN7 4UuDCAvlO7sKIbl9lUF4oPIWUcKlbyTl1Zo+8l5ABdcLHS32EIAVTVMckiW0k9mfFqlV sVog+jfX1bmeWpxQRxYbSDU68Jhr1cJ7ct9iMR52XQ7/Xfe0lNaMxw5LzLVvWAjYSgtV u+GgkIQI/2gSDq0piCdJ/fHEb/TI4swexI6ITnVOvRZUR7VQMnj/nTMmYouFcE6WEJ6s KbMw== 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=O3HhXyIyLwtOvtBTggJXTDnAw3xgRvRvXHFqWKdUjgE=; b=Y8lIM6e1Rk4CjPHnK+gKPYGChLsRPdBGHPpRHuDjZpa+E5lV7sCBVhMPYRbaBww7hn VFrU9OONW+w6LWlmG4oJUHLOkDL7EPl+tsYyoDENM5V3ej1Oo7NnIMo0oHZrduy/DFLW e6bglBevcwA7vJCLS1yCVCGCzVnK7gHbAxUdFkVgZVWaUjdhsiW7qST2ZQLrbWpdK2/Z +LCxoSwFXGMOnVtwGn1al0OWVM+cZBo10GJ1cd04HUYKe2QHWNa8Vir2mAIVyScFpr6E 5ruv2ya0U6kG2NmpHJ6+ozX+ZHI0phAK4bakF+j0JjokvWvppeV3EKw/YE3y38lFLSyr ZTLA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id j12-v6si1484466oib.280.2018.09.05.09.00.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 09:00:45 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.158.5 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w85Fvvqp104025 for ; Wed, 5 Sep 2018 12:00:45 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2maj3wrjx1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 05 Sep 2018 12:00:39 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 5 Sep 2018 17:00:37 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 5 Sep 2018 17:00:33 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w85G0WcD43122784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 5 Sep 2018 16:00:32 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A64115205F; Wed, 5 Sep 2018 19:00:24 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.92]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 8F8455204F; Wed, 5 Sep 2018 19:00:22 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Wed, 05 Sep 2018 19:00:29 +0300 From: Mike Rapoport To: linux-mm@kvack.org Cc: Andrew Morton , "David S. Miller" , Greg Kroah-Hartman , Ingo Molnar , Michael Ellerman , Michal Hocko , Paul Burton , Thomas Gleixner , Tony Luck , linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [RFC PATCH 16/29] memblock: replace __alloc_bootmem_node with appropriate memblock_ API Date: Wed, 5 Sep 2018 18:59:31 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536163184-26356-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1536163184-26356-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18090516-0016-0000-0000-00000200C38E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18090516-0017-0000-0000-000032576838 Message-Id: <1536163184-26356-17-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-05_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809050164 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 Use memblock_alloc_try_nid whenever goal (i.e. mininal address is specified) and memblock_alloc_node otherwise. Signed-off-by: Mike Rapoport Acked-by: Michal Hocko --- arch/ia64/mm/discontig.c | 6 ++++-- arch/ia64/mm/init.c | 2 +- arch/powerpc/kernel/setup_64.c | 6 ++++-- arch/sparc/kernel/setup_64.c | 10 ++++------ arch/sparc/kernel/smp_64.c | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index 1928d57..918dda9 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c @@ -451,8 +451,10 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize) if (bestnode == -1) bestnode = anynode; - ptr = __alloc_bootmem_node(pgdat_list[bestnode], pernodesize, - PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); + ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE, + __pa(MAX_DMA_ADDRESS), + BOOTMEM_ALLOC_ACCESSIBLE, + bestnode); return ptr; } diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index ffcc358..2169ca5 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -459,7 +459,7 @@ int __init create_mem_map_page_table(u64 start, u64 end, void *arg) pte = pte_offset_kernel(pmd, address); if (pte_none(*pte)) - set_pte(pte, pfn_pte(__pa(memblock_alloc_node(PAGE_SIZE, PAGE_SIZE, node))) >> PAGE_SHIFT, + set_pte(pte, pfn_pte(__pa(memblock_alloc_node(PAGE_SIZE, PAGE_SIZE, node)) >> PAGE_SHIFT, PAGE_KERNEL)); } return 0; diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 6a501b2..6add560 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -757,8 +757,10 @@ void __init emergency_stack_init(void) static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align) { - return __alloc_bootmem_node(NODE_DATA(early_cpu_to_node(cpu)), size, align, - __pa(MAX_DMA_ADDRESS)); + return memblock_alloc_try_nid(size, align, __pa(MAX_DMA_ADDRESS), + BOOTMEM_ALLOC_ACCESSIBLE, + early_cpu_to_node(cpu)); + } static void __init pcpu_fc_free(void *ptr, size_t size) diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 206bf81..5fb11ea 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c @@ -622,12 +622,10 @@ void __init alloc_irqstack_bootmem(void) for_each_possible_cpu(i) { node = cpu_to_node(i); - softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), - THREAD_SIZE, - THREAD_SIZE, 0); - hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node), - THREAD_SIZE, - THREAD_SIZE, 0); + softirq_stack[i] = memblock_alloc_node(THREAD_SIZE, + THREAD_SIZE, node); + hardirq_stack[i] = memblock_alloc_node(THREAD_SIZE, + THREAD_SIZE, node); } } diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index d3ea1f3..83ff88d 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -1594,8 +1594,8 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size, pr_debug("per cpu data for cpu%d %lu bytes at %016lx\n", cpu, size, __pa(ptr)); } else { - ptr = __alloc_bootmem_node(NODE_DATA(node), - size, align, goal); + ptr = memblock_alloc_try_nid(size, align, goal, + BOOTMEM_ALLOC_ACCESSIBLE, node); pr_debug("per cpu data for cpu%d %lu bytes on node%d at " "%016lx\n", cpu, size, node, __pa(ptr)); }