Received: by 10.223.185.116 with SMTP id b49csp1690054wrg; Thu, 22 Feb 2018 01:14:22 -0800 (PST) X-Google-Smtp-Source: AH8x227Tx6WaHScTLq59hjxog+TSPzRSdAyqi3NakqXZWCEGsqENl0tYUjzNpraQo/V5GmTDMwl7 X-Received: by 10.101.64.194 with SMTP id u2mr3297651pgp.280.1519290862261; Thu, 22 Feb 2018 01:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519290862; cv=none; d=google.com; s=arc-20160816; b=i/kEeuroqa4AtJnHWuOfmEmSKODdxe8j0+FY2oVjRq1rCe9RVV8wRHWiUGdSnKyOw4 55KED8ufWAWMFe5kdxOz4R5CzIyOm3le7N9bfPYtRIgt8qQ05+lUiESJrucvWSCHre5x /r3Ls5fYm/h+wpMu9Peb6otEkJiWU5ljzYcKsoAbuek0R5+7aq42iNGp1Ww1Eglj0VWq H2ItUEcif5V0PqY9xE4x4awYYpl3hnHPUgWUm2q0c+UgIz4XU7oKEfJU4S51c+/rY4rJ kAL0XsFvGBIFRZRv9XF/XU7UILt4HvOGJfGhNbSKs4XV+wLHKVn6IG1SvpflZ/eHcRSr Qr4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZuFsFncWJvsZRMns1JZ8t8+QI3QhsgVY1dNfsxFpg6A=; b=U7tqI59+3IohpGYOpEaPgaD2+Ywnc8x3pySED1fTbmCr87y1p09HREYs523vcixTG8 vw5a3sDURb1bZkdkZ1fXKgBM0a/IzEClUI3uvmDrtgPpmX4Vv4HkzHeKa7QlnGZBt8vL W9PBPMKlF9hHtA7Spzu8usL8zEctKdvwXvupImnMc1J0d6UAhda+jzAbNEXttBfAcVl2 /qLHc2eJhFvfvhpE8XyY36CikGeCfS64sUT6eDEkMmWhzwPrNl28Yyx8VnaoP2L7t9zH Uwj1fQuEE8Ka/p25IiOulo5QIJymu4FDyx9Ijyyv2JHgxgJxiCkw2tgLBaXOL/tzefta wKXg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l80si1200588pfb.178.2018.02.22.01.14.07; Thu, 22 Feb 2018 01:14:22 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752998AbeBVJLm (ORCPT + 99 others); Thu, 22 Feb 2018 04:11:42 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57822 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752643AbeBVJLl (ORCPT ); Thu, 22 Feb 2018 04:11:41 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C15140753A2; Thu, 22 Feb 2018 09:11:40 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DA7E2024CA9; Thu, 22 Feb 2018 09:11:34 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org, dave.hansen@intel.com Cc: linux-mm@kvack.org, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, mhocko@suse.com, tglx@linutronix.de, Baoquan He Subject: [PATCH v2 0/3] mm/sparse: Optimize memmap allocation during sparse_init() Date: Thu, 22 Feb 2018 17:11:27 +0800 Message-Id: <20180222091130.32165-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 22 Feb 2018 09:11:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 22 Feb 2018 09:11:40 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is v2 post. V1 can be found here: https://www.spinics.net/lists/linux-mm/msg144486.html In sparse_init(), two temporary pointer arrays, usemap_map and map_map are allocated with the size of NR_MEM_SECTIONS. They are used to store each memory section's usemap and mem map if marked as present. In 5-level paging mode, this will cost 512M memory though they will be released at the end of sparse_init(). System with few memory, like kdump kernel which usually only has about 256M, will fail to boot because of allocation failure if CONFIG_X86_5LEVEL=y. In this patchset, optimize the memmap allocation code to only use usemap_map and map_map with the size of nr_present_sections. This makes kdump kernel boot up with normal crashkernel='' setting when CONFIG_X86_5LEVEL=y. Baoquan He (3): mm/sparse: Add a static variable nr_present_sections mm/sparsemem: Defer the ms->section_mem_map clearing mm/sparse: Optimize memmap allocation during sparse_init() mm/sparse-vmemmap.c | 9 +++++---- mm/sparse.c | 54 +++++++++++++++++++++++++++++++++++------------------ 2 files changed, 41 insertions(+), 22 deletions(-) -- 2.13.6