linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: make __paginginit based on CONFIG_MEMORY_HOTPLUG
@ 2018-07-31 12:45 osalvador
  2018-07-31 12:49 ` Pavel Tatashin
  0 siblings, 1 reply; 15+ messages in thread
From: osalvador @ 2018-07-31 12:45 UTC (permalink / raw)
  To: akpm
  Cc: mhocko, vbabka, kirill.shutemov, pasha.tatashin, iamjoonsoo.kim,
	mgorman, jrdr.linux, linux-mm, linux-kernel, Oscar Salvador

From: Oscar Salvador <osalvador@suse.de>

__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 <osalvador@suse.de>
---
 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
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-07-31 21:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31 12:45 [PATCH] mm: make __paginginit based on CONFIG_MEMORY_HOTPLUG osalvador
2018-07-31 12:49 ` Pavel Tatashin
2018-07-31 13:04   ` Michal Hocko
2018-07-31 13:17     ` Oscar Salvador
2018-07-31 14:41   ` Oscar Salvador
2018-07-31 14:43     ` Pavel Tatashin
2018-07-31 14:43       ` Pavel Tatashin
2018-07-31 14:45     ` Pavel Tatashin
2018-07-31 14:51       ` Oscar Salvador
2018-07-31 14:53         ` Pavel Tatashin
2018-07-31 15:01           ` Oscar Salvador
2018-07-31 15:06             ` Pavel Tatashin
2018-07-31 15:23               ` Pavel Tatashin
2018-07-31 20:50                 ` Oscar Salvador
2018-07-31 21:33                   ` Pavel Tatashin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).