From patchwork Tue Jul 31 12:45:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10550783 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 BA84113B8 for ; Tue, 31 Jul 2018 12:45:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7CA12A447 for ; Tue, 31 Jul 2018 12:45:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BCE32A452; Tue, 31 Jul 2018 12:45:18 +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 33CBD2A447 for ; Tue, 31 Jul 2018 12:45:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D1DD76B0003; Tue, 31 Jul 2018 08:45:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CCAC76B0005; Tue, 31 Jul 2018 08:45:16 -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 BE13B6B0007; Tue, 31 Jul 2018 08:45:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 63DE16B0003 for ; Tue, 31 Jul 2018 08:45:16 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id p3-v6so1497493wmc.7 for ; Tue, 31 Jul 2018 05:45:16 -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; bh=r1CBh5En4n4Wn7J9Am2n5DoLoLM4u1BZ9VrK61wlxgE=; b=iGuOuMXwFcpVS6cMoGMjLK/H2I/2vhv6im85HV0/Ihq9Ip31hQ1OaQp/7jjT7W/JkW on51sZGF+ZHu009BC4T401cv/DnFTAbCOIpH8rcJNPOk7qHKD+dVVZD9wCn/ZpMunG9k +klEzG2HB1+ShJZP5KI4UQGkIC9bwLTHIjUE6rvCzadJc2XSFKRY+uMWe6/UDXzyR0pK RWUGuU4cAPvR2qtwqPRQkb8GBc5dgHNT0VMJGG752F9CfSnd7U3dDMbYZP3V4b88pZ+c UbWWYfDwGqi7KW/YziagRBTondxI+b3NMN8Tvs1lQvfdXnj2ZwnQms6fSLZQfXcdjNsF Lghg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlG97oQVVB+phorV+KfBEUiMhEXuVpws0qvuM+d54mDSVu8w986q bkxnx9w4wR90dtxBgYxI2GGGV94tdrMLDusCZTZxfOInza6lcB6PkP/Vmd3V1SinGpju8OCtjRI hHR3EbyQ3h0uWbQtqhgJvRIxis6Bm4Qo0Ej0lK0wB/xM5eV9nePs9TPdcYDBRNJrtzHqlYOp+id cUIbxuhkJWGOZSJr7tx9MWEQaK/D7v6G/DOCRzfJ4A1ueynKn7wSHx4WsydBEyjq+F6iMS41Mdx cGEIRUC2w1OI4X/7GPbzRg+8PboOnMNvrpTu0vky/WD/EGe/qRCjWbCXY26bKNx8LK9GBFZWqAT 0pwcuoHMa+KxCpItC3ysCYvO65fc4Bj1J/kaqSzlURQSH8r/LR55gmcWWogzvm73WpYLFEhOZg= = X-Received: by 2002:adf:80aa:: with SMTP id 39-v6mr21511856wrl.57.1533041115746; Tue, 31 Jul 2018 05:45:15 -0700 (PDT) X-Received: by 2002:adf:80aa:: with SMTP id 39-v6mr21511808wrl.57.1533041114888; Tue, 31 Jul 2018 05:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533041114; cv=none; d=google.com; s=arc-20160816; b=AaxDlxEIYZxaN+VpxU4IJdI5cb0AXtRvQTJI0N8Dx44NBtdUovgj1lzkwMP0Pn43rI q4uOHYnt786srXuultI9Y95AvoTUlCjlpV26GTv+GPU/kWfaY2kvDGwLW3HFc4F8T3vq DVT1IjQ1UX7456WxMvvYrQ3OXaVvEI78/yzN38ML3HkBoq+XB27WlwxKlGT7uhdnR3DM QrAF9+69FQE+/7n/YFSaypxXmuBvRDueEJ+0I9G2oa6q1htiMMIJj+09NRy2uFMmo+q8 x/9wM4vr09SeMsqKZ3CxPVC9yUPxabDZ7HEwGUkdjz98VOS8xTrjNQxVPn55TguUzJMr DIiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=r1CBh5En4n4Wn7J9Am2n5DoLoLM4u1BZ9VrK61wlxgE=; b=xbGCjfWSukHnQbF6CWk41Pdj79zfgv4MOYgonUWQJBYHCkv0XopLiiAm14QhqamxDn Tdi5R3vKubX4ohV1uMOY+hfvZ7/kecdX94LEcDXww5MGbS6lyCTr7sf7lQp3sQV47TxA 8kdxmeE/wdSxlmzSXE+YB37LPN6BKvkhE1GOh6cmmfsxdMCth442cG7LuLVOR0gLFT15 TWdrJlTll9DuEMvV+2fOj0AT/KubGLN1I44IOPHDWvtuHwlV3qGb25zP3gTUktZ0xEuQ LnR1FLbBq0nGsTcI4HC8vqe4u093KK0mzMslWlUe27MAp8oRNNE2/2FWL/E3XdHOQjlp 9SWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y5-v6sor5893295wrn.69.2018.07.31.05.45.14 for (Google Transport Security); Tue, 31 Jul 2018 05:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AAOMgpcW1KXz68RKY5jX8yJSJULd+rFg25AeMBH/XsUlVSl/lA3W7jZRQS+2Gq1ZlWvEHHkAkgy4sA== X-Received: by 2002:adf:cc0a:: with SMTP id x10-v6mr19939564wrh.242.1533041114347; Tue, 31 Jul 2018 05:45:14 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id h5-v6sm17333140wrr.19.2018.07.31.05.45.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 05:45:13 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id EBE2F1244CC; Tue, 31 Jul 2018 14:45:12 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, kirill.shutemov@linux.intel.com, pasha.tatashin@oracle.com, iamjoonsoo.kim@lge.com, mgorman@suse.de, jrdr.linux@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH] mm: make __paginginit based on CONFIG_MEMORY_HOTPLUG Date: Tue, 31 Jul 2018 14:45:04 +0200 Message-Id: <20180731124504.27582-1-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 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 From: Oscar Salvador __pagininit macro is being used to mark functions for: a) Functions that we do not need to keep once the system is fully initialized with regard to memory. b) Functions that will be needed for the memory-hotplug code, and because of that we need to keep them after initialization. Right now, the condition to choose between one or the other is based on CONFIG_SPARSEMEM, but I think that this should be changed to be based on CONFIG_MEMORY_HOTPLUG. The reason behind this is that it can very well be that we have CONFIG_SPARSEMEM enabled, but not CONFIG_MEMORY_HOTPLUG, and thus, we will not need the functions marked as __paginginit to stay around, since no memory-hotplug code will call them. Although the amount of freed bytes is not that big, I think it will become more clear what __paginginit is used for. Signed-off-by: Oscar Salvador Signed-off-by: Pavel Tatashin --- mm/internal.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 33c22754d282..c9170b4f7699 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -392,10 +392,11 @@ static inline struct page *mem_map_next(struct page *iter, /* * FLATMEM and DISCONTIGMEM configurations use alloc_bootmem_node, * so all functions starting at paging_init should be marked __init - * in those cases. SPARSEMEM, however, allows for memory hotplug, - * and alloc_bootmem_node is not used. + * in those cases. + * In case that MEMORY_HOTPLUG is enabled, we need to keep those + * functions around since they can be called when hot-adding memory. */ -#ifdef CONFIG_SPARSEMEM +#ifdef CONFIG_MEMORY_HOTPLUG #define __paginginit __meminit #else #define __paginginit __init