From patchwork Thu Jun 28 06:28:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 10493157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2453D601BE for ; Thu, 28 Jun 2018 06:29:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1482329D95 for ; Thu, 28 Jun 2018 06:29:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07DC329DA1; Thu, 28 Jun 2018 06:29:35 +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 79B9729D95 for ; Thu, 28 Jun 2018 06:29:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5682E6B026F; Thu, 28 Jun 2018 02:29:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4F2C66B0270; Thu, 28 Jun 2018 02:29:33 -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 393446B0271; Thu, 28 Jun 2018 02:29:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id 0B16C6B0270 for ; Thu, 28 Jun 2018 02:29:33 -0400 (EDT) Received: by mail-qt0-f200.google.com with SMTP id v14-v6so4491266qto.5 for ; Wed, 27 Jun 2018 23:29:33 -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:message-id:in-reply-to:references; bh=xlAk8ynNDAUZSjeGC1Xm2vssS6oyGpHPYE8a0xIV4Mw=; b=H3Y2PMH6qWp0s8jEiwOa9dVeP7D9jn8+M5jp8km7jl82enFAzViAdH3xYRKgXMzpB0 snIwYOt1RKDpHii/2qCk+f5TMFuJOPxEKuTw4ScTCu1lgCQBLxuXfv31a8fJ57Q9Fg7U hSGC//UDsGmzf9Hb88B396zHJAV5oZj+zFIVVJbFkZoQ0I/TcjQ/Qx7qnJxzB+nuumm7 zG5+WwVljhnbxRlKdqELIBlnV2etQ+F9beP8LkA1CwizfmbZ4E7jD36hO+8sDnVmFwzO cSDJJW0V1Iag3LhfH8CNZILGPLi7HBJsh5jklyZsAtIL4GMbzefxrZ1reCy/6b2iK/HQ iQSQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APt69E03g1F4ksnhhWepsKTJkUOyS+NqaNYCwOSJ9BnOqWPUfdNnm82/ UtI0eH96+SGcZccwdUj/YOPnkqlK3Va2o8etqOmhjbtevEkk2YoCYOMZBqT+0SaeOyvwgmmvTC4 rKOimIjFZKCp8tFohjkwZE/2RWh76bCuPTo4yTpQB0/kJLUJKryDGWzoLgpR8LQMpGw== X-Received: by 2002:ac8:24d1:: with SMTP id t17-v6mr8426148qtt.281.1530167372823; Wed, 27 Jun 2018 23:29:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd94ZdvnaWZ2xfLIYQIGVsU+yDAWazcOYG9wwBCRmCB60CJIX3J34IOSQ6xA/tiP9h+5ZzF X-Received: by 2002:ac8:24d1:: with SMTP id t17-v6mr8426122qtt.281.1530167372231; Wed, 27 Jun 2018 23:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530167372; cv=none; d=google.com; s=arc-20160816; b=jkLMiS46/A6fu0hq2TX5GZFUYS+wkfE+W4ytxKFgFLngxf6/I0jLG6Zex8bnxQ419P xJV2G5cX5Y+x+fJCPeDuCSbKdy68CvfkUMDv+PreCVQsaaAjS0sgMnbqDRPhMIJM0scK jGCIFTUEkR/AZJuS1cGrzwxYH4QJE7W7OVpEKGSXxVCj7iDCmDYWpOCah3Q84O2Z+uq3 EevJvc/DznIXdRPr9xnQ/19+SnC59UfHOKL2s/2HAj6GYZMeJzzipFSeGpjBQ867cIJu z1Wi1qwRDr5Y3GGsUSVWNaOJ8jpTwYCITuDLmDJVBajGdmN+6wnn9ob32oJtNcO9Qp3a VpCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xlAk8ynNDAUZSjeGC1Xm2vssS6oyGpHPYE8a0xIV4Mw=; b=i4Rsf0eIS6741QcfsXPT6QhaWLsTw3iEtLv7Eb+AYIVHNuDNhr+6vviRoIgw4drrdl o4CLaM19RGw2ab8hqCmOOnQxDc86icJPAFrbKmPSLV9bGnzg1Ap+bgPjnnhPlTLBGsHE 8Gh0vLRHbbRnCWI9B/xHorNjAkKG8Ut+bkoHNxEigzzeawLbj0xVRvW/WJmElWo1Crbj nLjA8ajVkfDnOOX5vh/mfukTaIvf+hC/OMqWwCu8ezBGLCk/B4g81hMEwIR+XyCFBSTL tCM6k7F+bJ6JKCRhKwhqBNKQ8RPzMf5R9JbH7UjsOw4idfmAM+MPUpe8MwvM4b8BSdyd M4zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id l63-v6si5571904qkd.301.2018.06.27.23.29.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 23:29:32 -0700 (PDT) Received-SPF: pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD26B8E7B0; Thu, 28 Jun 2018 06:29:31 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35A4F2156880; Thu, 28 Jun 2018 06:29:26 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, pagupta@redhat.com, Pavel Tatashin , Oscar Salvador Cc: linux-mm@kvack.org, kirill.shutemov@linux.intel.com, Baoquan He Subject: [PATCH v6 5/5] mm/sparse: Remove CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER Date: Thu, 28 Jun 2018 14:28:57 +0800 Message-Id: <20180628062857.29658-6-bhe@redhat.com> In-Reply-To: <20180628062857.29658-1-bhe@redhat.com> References: <20180628062857.29658-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 28 Jun 2018 06:29:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 28 Jun 2018 06:29:31 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' 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 Pavel pointed out that the behaviour of allocating memmap together for one node should be defaulted for all ARCH-es. It won't break anything because it will drop to the fallback action to allocate imemmap for each section at one time if failed on large chunk of memory. So remove CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER and clean up the related codes. Signed-off-by: Baoquan He Cc: Pavel Tatashin Reviewed-by: Pavel Tatashin --- mm/Kconfig | 4 ---- mm/sparse.c | 32 ++------------------------------ 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/mm/Kconfig b/mm/Kconfig index ce95491abd6a..75a196bf83e6 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -115,10 +115,6 @@ config SPARSEMEM_EXTREME config SPARSEMEM_VMEMMAP_ENABLE bool -config SPARSEMEM_ALLOC_MEM_MAP_TOGETHER - def_bool y - depends on SPARSEMEM && X86_64 - config SPARSEMEM_VMEMMAP bool "Sparse Memory virtual memmap" depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE diff --git a/mm/sparse.c b/mm/sparse.c index e1767d9fe4f3..d18e2697a781 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -458,7 +458,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map, } #endif /* !CONFIG_SPARSEMEM_VMEMMAP */ -#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER static void __init sparse_early_mem_maps_alloc_node(void *data, unsigned long pnum_begin, unsigned long pnum_end, @@ -468,22 +467,6 @@ static void __init sparse_early_mem_maps_alloc_node(void *data, sparse_mem_maps_populate_node(map_map, pnum_begin, pnum_end, map_count, nodeid); } -#else -static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) -{ - struct page *map; - struct mem_section *ms = __nr_to_section(pnum); - int nid = sparse_early_nid(ms); - - map = sparse_mem_map_populate(pnum, nid, NULL); - if (map) - return map; - - pr_err("%s: sparsemem memory map backing failed some memory will not be available\n", - __func__); - return NULL; -} -#endif void __weak __meminit vmemmap_populate_print_last(void) { @@ -545,14 +528,11 @@ void __init sparse_init(void) { unsigned long pnum; struct page *map; + struct page **map_map; unsigned long *usemap; unsigned long **usemap_map; - int size; + int size, size2; int nr_consumed_maps = 0; -#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER - int size2; - struct page **map_map; -#endif /* see include/linux/mmzone.h 'struct mem_section' definition */ BUILD_BUG_ON(!is_power_of_2(sizeof(struct mem_section))); @@ -579,7 +559,6 @@ void __init sparse_init(void) (void *)usemap_map, sizeof(usemap_map[0])); -#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER size2 = sizeof(struct page *) * nr_present_sections; map_map = memblock_virt_alloc(size2, 0); if (!map_map) @@ -587,7 +566,6 @@ void __init sparse_init(void) alloc_usemap_and_memmap(sparse_early_mem_maps_alloc_node, (void *)map_map, sizeof(map_map[0])); -#endif /* The numner of present sections stored in nr_present_sections * are kept the same since mem sections are marked as present in @@ -613,11 +591,7 @@ void __init sparse_init(void) continue; } -#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER map = map_map[nr_consumed_maps]; -#else - map = sparse_early_mem_map_alloc(pnum); -#endif if (!map) { ms->section_mem_map = 0; nr_consumed_maps++; @@ -631,9 +605,7 @@ void __init sparse_init(void) vmemmap_populate_print_last(); -#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER memblock_free_early(__pa(map_map), size2); -#endif memblock_free_early(__pa(usemap_map), size); }