From patchwork Thu Aug 2 11:53:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10553521 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 9FC6D139A for ; Thu, 2 Aug 2018 11:54:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BB812BD0E for ; Thu, 2 Aug 2018 11:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CEED2BD0A; Thu, 2 Aug 2018 11:54:15 +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 D46A62BD03 for ; Thu, 2 Aug 2018 11:54:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19FCB6B000C; Thu, 2 Aug 2018 07:54:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1272F6B000E; Thu, 2 Aug 2018 07:54:14 -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 EE37E6B0010; Thu, 2 Aug 2018 07:54:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 8B2AF6B000C for ; Thu, 2 Aug 2018 07:54:13 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id b25-v6so718789eds.17 for ; Thu, 02 Aug 2018 04:54:13 -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=zD2I0gNwEOekiIcWSWa6zYlpmyOsP0ickGuIRjuAwEw=; b=DRUmHC5accAOeFb/gzzuvcbW9winznw+N2ApZNfFQanPk0flM1zvjEOVG105uhetlJ 1dmFihnpLU2vB3WejeCp33Kufx7M4Sn4NzVXXmWLK0kSRYHz8xwmOSbRvn2R6Zo9T5GQ 6F7Stu4u1Ad0wL8SL3OeiiqmpUoknD9bslnoM8iJXBeTmTDa4hwc47zg2bXuKbcYCvns EPMp/0qZQEEWuhrBrkFbWBwvX+Znq3tbiJVOH7cPlebp2kKN7cfhqlZTo2oDEkIDSUZ1 mESnMbkPkEATSeGNm86QVSeiXJWOGsgB4bDZ2c7XLH91JYCsAkStEw6W/Hjw43/VTgiI kWlQ== 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: AOUpUlGn29kZvEXG4m9Df9x2oQiTrvwkwgVfo5VU0fA7GnVM/UkdBr4S LPrMngHbvqZwQHQmtlNX5ZHjy69vdfTEzuvJOXHvzQQZZweYYyctbsBmh7gP+bltia3fffH/Rcq gyqJOdSKli5FV/PiHuA3WIVjQ5M5jqHtoA4WQJ8t2NdwRuQ8e5hI1UgpHJYh0weU= X-Received: by 2002:aa7:d5d6:: with SMTP id d22-v6mr2911852eds.161.1533210853068; Thu, 02 Aug 2018 04:54:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpffXTYYdrHigESc16sMoHz71UTCm0usReLyCnc0+v9irwAYm+EZTIIbSNdsFDGPVt+sHKVm X-Received: by 2002:aa7:d5d6:: with SMTP id d22-v6mr2911806eds.161.1533210852100; Thu, 02 Aug 2018 04:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533210852; cv=none; d=google.com; s=arc-20160816; b=mvH17vI7/PBuKXV1t2oY71QMiuborSjXvUXaxpESnz5Nx9Pzj/g+HG7MDqZoE4bHDx SCGSx3gI/zJSWUbpqd0MJt6G8DrH6M/wUlyqJlVsx8mU7igOlfA5Kt50f8qBacj2/9E2 leeEl6jOHDwpLZ2+K9dGTSkaQ0vg6hyUt1m1utZSRd3Xm1yOG8mVhNiIo4UXR2lSCEGr Tjrs5pGRy59BOkJS9FQ/Un5ZkxLgLYp6zk5JDLP2BWB+ZFqvy1A9vyR1LafmVVs/vjqr +nZvO2L34/YWqxyoFbeEz6FJRJ1bXfaU/9RQELnEVcPOkT0DY9o2uEQDimyxo/gJyooc ELuQ== 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 :arc-authentication-results; bh=zD2I0gNwEOekiIcWSWa6zYlpmyOsP0ickGuIRjuAwEw=; b=jufC5wXtvAKbswU4ACmg4JZQrF1FsHdv9U20rYR5YWqCXZO5a80QzVbQWjD45dGElN wpEt/kc+w7AKJK8LuxggHQwqJvpfkTkzuntagknNrs4Sl+1DxCYJty8hO5wFzjLnJzuf REbqKnMDNetlCcx3/0HqXe9t8Ht69yW13btBrkumhguG/dsghpjsI93lk0wtEry49AM1 eFh3zByEb+GUGnEBrdFWzjQjbg4c8TJnrZM7IjVYqCSuZSjoxWHPA1F0ZrWBMVTbxN3Z lTcbQHuVbCMwhMwdrqGCNYmBfQoWLpBkfWs19KAAbnhl5ujfg4EArPE3q8u+yGcw/MRc 4ipg== 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 v2-v6si1781675edm.144.2018.08.02.04.54.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 04:54:12 -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 (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w72BsA93132023 for ; Thu, 2 Aug 2018 07:54:10 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kkx7h8g0n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 Aug 2018 07:54:10 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Aug 2018 12:54:03 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 2 Aug 2018 12:54:00 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w72Bs0bm43319414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 2 Aug 2018 11:54:00 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26764A4040; Thu, 2 Aug 2018 14:54:10 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C16FA4053; Thu, 2 Aug 2018 14:54:08 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.207.181]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 2 Aug 2018 14:54:08 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Thu, 02 Aug 2018 14:53:57 +0300 From: Mike Rapoport To: "David S. Miller" Cc: Sam Ravnborg , Michal Hocko , sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH 1/2] sparc32: switch to NO_BOOTMEM Date: Thu, 2 Aug 2018 14:53:52 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533210833-14748-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1533210833-14748-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18080211-0028-0000-0000-000002E43037 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080211-0029-0000-0000-0000239C41B3 Message-Id: <1533210833-14748-2-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-02_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1808020125 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 Each populated sparc_phys_bank is added to memblock.memory. The reserve_bootmem() calls are replaced with memblock_reserve(), and the bootmem bitmap initialization is droppped. Signed-off-by: Mike Rapoport --- arch/sparc/Kconfig | 4 +-- arch/sparc/mm/init_32.c | 74 ++++++++++++++----------------------------------- 2 files changed, 23 insertions(+), 55 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 0f535de..0a874c8 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -45,6 +45,8 @@ config SPARC select LOCKDEP_SMALL if LOCKDEP select NEED_DMA_MAP_STATE select NEED_SG_DMA_LENGTH + select HAVE_MEMBLOCK + select NO_BOOTMEM config SPARC32 def_bool !64BIT @@ -60,7 +62,6 @@ config SPARC64 select HAVE_KRETPROBES select HAVE_KPROBES select HAVE_RCU_TABLE_FREE if SMP - select HAVE_MEMBLOCK select HAVE_MEMBLOCK_NODE_MAP select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_DYNAMIC_FTRACE @@ -79,7 +80,6 @@ config SPARC64 select IRQ_PREFLOW_FASTEOI select ARCH_HAVE_NMI_SAFE_CMPXCHG select HAVE_C_RECORDMCOUNT - select NO_BOOTMEM select HAVE_ARCH_AUDITSYSCALL select ARCH_SUPPORTS_ATOMIC_RMW select HAVE_NMI diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 95fe4f0..5117a5e 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -103,11 +104,15 @@ static unsigned long calc_max_low_pfn(void) unsigned long __init bootmem_init(unsigned long *pages_avail) { - unsigned long bootmap_size, start_pfn; + unsigned long start_pfn; unsigned long end_of_phys_memory = 0UL; - unsigned long bootmap_pfn, bytes_avail, size; + unsigned long bytes_avail, size; + unsigned long high_pages = 0UL; int i; + memblock_set_bottom_up(true); + memblock_allow_resize(); + bytes_avail = 0UL; for (i = 0; sp_banks[i].num_bytes != 0; i++) { end_of_phys_memory = sp_banks[i].base_addr + @@ -124,12 +129,15 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) if (sp_banks[i].num_bytes == 0) { sp_banks[i].base_addr = 0xdeadbeef; } else { + memblock_add(sp_banks[i].base_addr, + sp_banks[i].num_bytes); sp_banks[i+1].num_bytes = 0; sp_banks[i+1].base_addr = 0xdeadbeef; } break; } } + memblock_add(sp_banks[i].base_addr, sp_banks[i].num_bytes); } /* Start with page aligned address of last symbol in kernel @@ -140,8 +148,6 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) /* Now shift down to get the real physical page frame number. */ start_pfn >>= PAGE_SHIFT; - bootmap_pfn = start_pfn; - max_pfn = end_of_phys_memory >> PAGE_SHIFT; max_low_pfn = max_pfn; @@ -150,12 +156,16 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) if (max_low_pfn > pfn_base + (SRMMU_MAXMEM >> PAGE_SHIFT)) { highstart_pfn = pfn_base + (SRMMU_MAXMEM >> PAGE_SHIFT); max_low_pfn = calc_max_low_pfn(); + high_pages = calc_highpages(); printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", - calc_highpages() >> (20 - PAGE_SHIFT)); + high_pages >> (20 - PAGE_SHIFT)); } #ifdef CONFIG_BLK_DEV_INITRD - /* Now have to check initial ramdisk, so that bootmap does not overwrite it */ + /* + * Now have to check initial ramdisk, so that it won't pass + * the end of memory + */ if (sparc_ramdisk_image) { if (sparc_ramdisk_image >= (unsigned long)&_end - 2 * PAGE_SIZE) sparc_ramdisk_image -= KERNBASE; @@ -167,67 +177,25 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) initrd_end, end_of_phys_memory); initrd_start = 0; } - if (initrd_start) { - if (initrd_start >= (start_pfn << PAGE_SHIFT) && - initrd_start < (start_pfn << PAGE_SHIFT) + 2 * PAGE_SIZE) - bootmap_pfn = PAGE_ALIGN (initrd_end) >> PAGE_SHIFT; - } } -#endif - /* Initialize the boot-time allocator. */ - bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn, pfn_base, - max_low_pfn); - - /* Now register the available physical memory with the - * allocator. - */ - *pages_avail = 0; - for (i = 0; sp_banks[i].num_bytes != 0; i++) { - unsigned long curr_pfn, last_pfn; - - curr_pfn = sp_banks[i].base_addr >> PAGE_SHIFT; - if (curr_pfn >= max_low_pfn) - break; - - last_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT; - if (last_pfn > max_low_pfn) - last_pfn = max_low_pfn; - - /* - * .. finally, did all the rounding and playing - * around just make the area go away? - */ - if (last_pfn <= curr_pfn) - continue; +#endif - size = (last_pfn - curr_pfn) << PAGE_SHIFT; - *pages_avail += last_pfn - curr_pfn; - - free_bootmem(sp_banks[i].base_addr, size); - } + *pages_avail = (memblock_phys_mem_size() >> PAGE_SHIFT) - high_pages; #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { /* Reserve the initrd image area. */ size = initrd_end - initrd_start; - reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT); + memblock_reserve(initrd_start, size); *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; initrd_start = (initrd_start - phys_base) + PAGE_OFFSET; - initrd_end = (initrd_end - phys_base) + PAGE_OFFSET; + initrd_end = (initrd_end - phys_base) + PAGE_OFFSET; } #endif /* Reserve the kernel text/data/bss. */ size = (start_pfn << PAGE_SHIFT) - phys_base; - reserve_bootmem(phys_base, size, BOOTMEM_DEFAULT); - *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; - - /* Reserve the bootmem map. We do not account for it - * in pages_avail because we will release that memory - * in free_all_bootmem. - */ - size = bootmap_size; - reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT); + memblock_reserve(phys_base, size); *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; return max_pfn; From patchwork Thu Aug 2 11:53:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10553525 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 358B0174A for ; Thu, 2 Aug 2018 11:56:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 229E72BD0E for ; Thu, 2 Aug 2018 11:56:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16C9F2BD10; Thu, 2 Aug 2018 11:56:24 +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 997832BD0E for ; Thu, 2 Aug 2018 11:56:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B39646B026D; Thu, 2 Aug 2018 07:56:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AE94D6B026E; Thu, 2 Aug 2018 07:56:22 -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 98C626B026F; Thu, 2 Aug 2018 07:56:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f72.google.com (mail-oi0-f72.google.com [209.85.218.72]) by kanga.kvack.org (Postfix) with ESMTP id 686796B026D for ; Thu, 2 Aug 2018 07:56:22 -0400 (EDT) Received: by mail-oi0-f72.google.com with SMTP id w185-v6so1653016oig.19 for ; Thu, 02 Aug 2018 04:56:22 -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=8Q/DTBXfiqQFx1JkU/h8bYjJ9ccm6XR5dsQ+GZ5JJeA=; b=plBRaIHavXsll1AA0uUOySyE4qIYz5OPvQ02YtI9RccVXeDHOKICXuSJhSjcpsgPXo vBAPii1Z74x/AmACEwkEx4KPauBEI6GyMZPyvTnNA7L7gOBmiag6adiNU8OECQMutNsl FfcVJgQxE/j5mcY6m82TIrj8LBOEP2qihpT2SpWcR+gznPiGA7ANVXiXwmZLyjAoX/Yu xAtmXN2c38iZplBHK+gOvSYYInEn0AZMbneTTpFOvaL5eA8Nvx++UInsQPbvkxltEnnz pNbeHcYpqM8H3r781sGyC1+xC3WXtgqN9+VcSvXsRbTMnPOO/DDqxxDHTa9UaRPUg8ZM KBhw== 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: AOUpUlH/WwwKziDCCMm7wo1KL7qSvQHyLdiH7kvXgooFBwkMo/zmsIcH 0f3JJZ3yYLL0+AZYYBFiy7a4KPQGLiXk6s6w0JTag/v5TvEhBh6TikB3NI4nOLPfcEmz+bphMh+ 4fgr65yQLp2kzBVuGZvbIMIx+J9iGmVEj61Vwx+WHo0atL+oPbESM/iCvkay+6qw= X-Received: by 2002:aca:ce85:: with SMTP id e127-v6mr1068486oig.169.1533210982224; Thu, 02 Aug 2018 04:56:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe76TRA9c0Aua4BNpzSQIiDbplWqTmhg/FMffNaaszQyKQ0Vj7u3MRE88KHKU8dmJRCV2bM X-Received: by 2002:aca:ce85:: with SMTP id e127-v6mr1068430oig.169.1533210981391; Thu, 02 Aug 2018 04:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533210981; cv=none; d=google.com; s=arc-20160816; b=egcPokXlUp8qco4H+I2KA8spDwcWA9ZASRu3NxkIMLVSBLAAFYMJf/XTbYWo5H8V8J fegCx1BPyAl1JDj+Gx0HnzSoQEYtYT0vjd/MNmGlzzhjMSIDpN5drkm3VBKE0BAO9+IB KzC3v9N+gde6Uwz/GPTgR1zHYVrsjrxDfda5kuX21/QUFyGygkeSjIaecLRhbJRj1lKt KbD8CzS3+m0g//h52NICjoyw0K4gC2xcnwGSPmQwtcWKxiGzlmdCDvyJYUNXI5+OW3uu TLq9l/+3uESv8eVJdfGBoRtJJQCKbp6JLvOdijNQ2KY1VGqhO1Oyl455K3oXQX44lA7w +smg== 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 :arc-authentication-results; bh=8Q/DTBXfiqQFx1JkU/h8bYjJ9ccm6XR5dsQ+GZ5JJeA=; b=J1qFzU4uDG7XftvsV59UMo+jZ1lieqgiMfrIeh36sgTQNwgMGKW+oyeApVY0d1cRGo UvFxfVM3VAATsqTYh/7bJJfQbWzHwvmt3z46CL5xPZaMaI2BxZ6Zb2i1Wq683+7c+rkX tBetw/x4DsolM9Rqo+n+cW6umHZn40M7m6TVLtao4Ga+VffSWHV8j73RViWC+FPbqLuj 5/rFMRXjgVuqEhLqLXGsnNouWOXoD4SO1bdzDo0SB0BQmd6XSp79rjeKrrBMRZOIBdIZ AGvZu/JmxYwcIE7/nB779nUDwx34n7802W3cz3OaElzNH1LLa5R1btgnlX9oMzMqTWLr 3yzg== 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 c134-v6si1048834oig.261.2018.08.02.04.56.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 04:56:21 -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 (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w72Bu0QD137890 for ; Thu, 2 Aug 2018 07:56:20 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kky4qe8j0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 Aug 2018 07:56:13 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Aug 2018 12:54:07 +0100 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) Thu, 2 Aug 2018 12:54:04 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w72Bs32U28639266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 2 Aug 2018 11:54:03 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E74C42042; Thu, 2 Aug 2018 14:54:14 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 88E4B4204B; Thu, 2 Aug 2018 14:54:12 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.207.181]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 2 Aug 2018 14:54:12 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Thu, 02 Aug 2018 14:54:00 +0300 From: Mike Rapoport To: "David S. Miller" Cc: Sam Ravnborg , Michal Hocko , sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH 2/2] sparc32: tidy up ramdisk memory reservation Date: Thu, 2 Aug 2018 14:53:53 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533210833-14748-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1533210833-14748-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18080211-0020-0000-0000-000002AFF0A7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080211-0021-0000-0000-000020FC1D25 Message-Id: <1533210833-14748-3-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-02_03:,, 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=896 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1808020125 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 The detection and reservation of ramdisk memory were separated to allow bootmem bitmap initialization after the ramdisk boundaries are detected. Since the bootmem initialization is removed, the reservation of ramdisk memory can be done immediately after its boundaries are found. Signed-off-by: Mike Rapoport --- arch/sparc/mm/init_32.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 5117a5e..b5d8f90 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -161,6 +161,8 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) high_pages >> (20 - PAGE_SHIFT)); } + *pages_avail = (memblock_phys_mem_size() >> PAGE_SHIFT) - high_pages; + #ifdef CONFIG_BLK_DEV_INITRD /* * Now have to check initial ramdisk, so that it won't pass @@ -176,23 +178,17 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) "(0x%016lx > 0x%016lx)\ndisabling initrd\n", initrd_end, end_of_phys_memory); initrd_start = 0; + } else { + /* Reserve the initrd image area. */ + size = initrd_end - initrd_start; + memblock_reserve(initrd_start, size); + *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; + + initrd_start = (initrd_start - phys_base) + PAGE_OFFSET; + initrd_end = (initrd_end - phys_base) + PAGE_OFFSET; } } #endif - - *pages_avail = (memblock_phys_mem_size() >> PAGE_SHIFT) - high_pages; - -#ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start) { - /* Reserve the initrd image area. */ - size = initrd_end - initrd_start; - memblock_reserve(initrd_start, size); - *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; - - initrd_start = (initrd_start - phys_base) + PAGE_OFFSET; - initrd_end = (initrd_end - phys_base) + PAGE_OFFSET; - } -#endif /* Reserve the kernel text/data/bss. */ size = (start_pfn << PAGE_SHIFT) - phys_base; memblock_reserve(phys_base, size);