Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10538036imu; Mon, 31 Dec 2018 01:33:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/UzfhC0xaCRBXQnwZ/wHi6QfYkfqO5rHeWLRf6rmtdMiFDORNIm+INnUCqzpaySq4XV2OQ7 X-Received: by 2002:a62:59c9:: with SMTP id k70mr37332121pfj.243.1546248816193; Mon, 31 Dec 2018 01:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546248816; cv=none; d=google.com; s=arc-20160816; b=I9SHnBUQ2LppB6pT7PrcHJ+3KtS3Gsx9iXEnFzGfdB6rmNhDPKF1absD5RQZy4Q9Ak DRZP2n3lXKpWq55eaHFci3PpfNb4t0jDZNhTA3jPTDhdBgvImh78upGR1Cri65HpFrzJ tgznbzqP4ssL4Ha3pH/9wRufjng4ypEryqa2eyx0Ata+syRer3C5ws7Tks4bfrNimgH2 72adxbtWL38rh+Jd43CPMLyyTyEUgbvemQq8JFzBL4em7uUVhdE4m5JIS3TNxz6gQvGj xyInQtiX0a4R9Zm9qszcLJl1IQlPwbODvEkWgdmEyn1E0GXBVyIBjBkXQnhpj3POCpCW fD8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=RSWpoazd14FAcfjcBb75vyVh1/BvE/SvNzm1xU5rXtU=; b=XD3oo9tM6GvwHOjyXeWPCH4Iz5cBqHp0ujfp8w4iyhfwRqPdoNcOTHqtjWCHc9QU8z 7/drMJJ9m3UU+x+k0DCkd4k3dGQJwvNGUafBrmK11qfjICMicO/e+jt7/NL+whIMrO6e xw+1pzjjmIkzeFmCFNGBiEmL+KMjIEnDGY9QXYiYQVJREHQMiMhsP1qcTlvVScA7xBTo M1fwL9IiFcqWxC9EA/EA9yIsShnKW4ZPGjqFv3F4MSvu22fI12db9mt81ht2KbFJFh/y F2s4asqGkyCnNJV0QVEERC8xo7Z6aEJsiaqEH9E9pSuXvuAEPKgbqOlKXaZGKGnEhCOS 5+Dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36si1462834plc.300.2018.12.31.01.33.21; Mon, 31 Dec 2018 01:33:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbeLaJ37 (ORCPT + 99 others); Mon, 31 Dec 2018 04:29:59 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33816 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727164AbeLaJ36 (ORCPT ); Mon, 31 Dec 2018 04:29:58 -0500 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 wBV9Si0M020529 for ; Mon, 31 Dec 2018 04:29:57 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pqg850h4j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Dec 2018 04:29:56 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 31 Dec 2018 09:29:54 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 31 Dec 2018 09:29:48 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBV9TlgC5636522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 31 Dec 2018 09:29:47 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED91411C050; Mon, 31 Dec 2018 09:29:46 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 276E811C04A; Mon, 31 Dec 2018 09:29:43 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.181]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 31 Dec 2018 09:29:43 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Mon, 31 Dec 2018 11:29:42 +0200 From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Heiko Carstens , Jonas Bonn , Martin Schwidefsky , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH v4 3/6] sh: prefer memblock APIs returning virtual address Date: Mon, 31 Dec 2018 11:29:23 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546248566-14910-1-git-send-email-rppt@linux.ibm.com> References: <1546248566-14910-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18123109-0020-0000-0000-000002FE3658 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18123109-0021-0000-0000-0000214E6FCA Message-Id: <1546248566-14910-4-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-31_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=920 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812310088 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rather than use the memblock_alloc_base that returns a physical address and then convert this address to the virtual one, use appropriate memblock function that returns a virtual address. There is a small functional change in the allocation of then NODE_DATA(). Instead of panicing if the local allocation failed, the non-local allocation attempt will be made. Signed-off-by: Mike Rapoport --- arch/sh/mm/init.c | 18 +++++------------- arch/sh/mm/numa.c | 5 ++--- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index a8e5c0e..a0fa4de 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -192,24 +192,16 @@ void __init page_table_range_init(unsigned long start, unsigned long end, void __init allocate_pgdat(unsigned int nid) { unsigned long start_pfn, end_pfn; -#ifdef CONFIG_NEED_MULTIPLE_NODES - unsigned long phys; -#endif get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); #ifdef CONFIG_NEED_MULTIPLE_NODES - phys = __memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, end_pfn << PAGE_SHIFT); - /* Retry with all of system memory */ - if (!phys) - phys = __memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, memblock_end_of_DRAM()); - if (!phys) + NODE_DATA(nid) = memblock_alloc_try_nid_nopanic( + sizeof(struct pglist_data), + SMP_CACHE_BYTES, MEMBLOCK_LOW_LIMIT, + MEMBLOCK_ALLOC_ACCESSIBLE, nid); + if (!NODE_DATA(nid)) panic("Can't allocate pgdat for node %d\n", nid); - - NODE_DATA(nid) = __va(phys); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); #endif NODE_DATA(nid)->node_start_pfn = start_pfn; diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 830e8b3..c4bde61 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c @@ -41,9 +41,8 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) __add_active_range(nid, start_pfn, end_pfn); /* Node-local pgdat */ - NODE_DATA(nid) = __va(memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, end)); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); + NODE_DATA(nid) = memblock_alloc_node(sizeof(struct pglist_data), + SMP_CACHE_BYTES, nid); NODE_DATA(nid)->node_start_pfn = start_pfn; NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; -- 2.7.4