From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
kirill.shutemov@linux.intel.com, mhocko@suse.com,
tglx@linutronix.de, douly.fnst@cn.fujitsu.com,
Baoquan He <bhe@redhat.com>
Subject: [PATCH 1/2] mm/sparsemem: Defer the ms->section_mem_map clearing a little later
Date: Thu, 1 Feb 2018 15:19:55 +0800 [thread overview]
Message-ID: <20180201071956.14365-2-bhe@redhat.com> (raw)
In-Reply-To: <20180201071956.14365-1-bhe@redhat.com>
This will make sure number of sections marked as present won't be changed
in sparse_init(), so that for_each_present_section_nr() can iterate
each of them. This is preparation for later fix.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
mm/sparse-vmemmap.c | 1 -
mm/sparse.c | 15 ++++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 17acf01791fa..315bea91e276 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -324,7 +324,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
ms = __nr_to_section(pnum);
pr_err("%s: sparsemem memory map backing failed some memory will not be available\n",
__func__);
- ms->section_mem_map = 0;
}
if (vmemmap_buf_start) {
diff --git a/mm/sparse.c b/mm/sparse.c
index 2609aba121e8..54eba92b72a1 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -478,7 +478,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
ms = __nr_to_section(pnum);
pr_err("%s: sparsemem memory map backing failed some memory will not be available\n",
__func__);
- ms->section_mem_map = 0;
}
}
#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
@@ -610,17 +609,27 @@ void __init sparse_init(void)
#endif
for_each_present_section_nr(0, pnum) {
+ struct mem_section *ms;
+ ms = __nr_to_section(pnum);
usemap = usemap_map[pnum];
- if (!usemap)
+ if (!usemap) {
+#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
+ ms->section_mem_map = 0;
+#endif
continue;
+ }
#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
map = map_map[pnum];
#else
map = sparse_early_mem_map_alloc(pnum);
#endif
- if (!map)
+ if (!map) {
+#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
+ ms->section_mem_map = 0;
+#endif
continue;
+ }
sparse_init_one_section(__nr_to_section(pnum), pnum, map,
usemap);
--
2.13.6
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
kirill.shutemov@linux.intel.com, mhocko@suse.com,
tglx@linutronix.de, douly.fnst@cn.fujitsu.com,
Baoquan He <bhe@redhat.com>
Subject: [PATCH 1/2] mm/sparsemem: Defer the ms->section_mem_map clearing a little later
Date: Thu, 1 Feb 2018 15:19:55 +0800 [thread overview]
Message-ID: <20180201071956.14365-2-bhe@redhat.com> (raw)
In-Reply-To: <20180201071956.14365-1-bhe@redhat.com>
This will make sure number of sections marked as present won't be changed
in sparse_init(), so that for_each_present_section_nr() can iterate
each of them. This is preparation for later fix.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
mm/sparse-vmemmap.c | 1 -
mm/sparse.c | 15 ++++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 17acf01791fa..315bea91e276 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -324,7 +324,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
ms = __nr_to_section(pnum);
pr_err("%s: sparsemem memory map backing failed some memory will not be available\n",
__func__);
- ms->section_mem_map = 0;
}
if (vmemmap_buf_start) {
diff --git a/mm/sparse.c b/mm/sparse.c
index 2609aba121e8..54eba92b72a1 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -478,7 +478,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
ms = __nr_to_section(pnum);
pr_err("%s: sparsemem memory map backing failed some memory will not be available\n",
__func__);
- ms->section_mem_map = 0;
}
}
#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
@@ -610,17 +609,27 @@ void __init sparse_init(void)
#endif
for_each_present_section_nr(0, pnum) {
+ struct mem_section *ms;
+ ms = __nr_to_section(pnum);
usemap = usemap_map[pnum];
- if (!usemap)
+ if (!usemap) {
+#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
+ ms->section_mem_map = 0;
+#endif
continue;
+ }
#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
map = map_map[pnum];
#else
map = sparse_early_mem_map_alloc(pnum);
#endif
- if (!map)
+ if (!map) {
+#ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
+ ms->section_mem_map = 0;
+#endif
continue;
+ }
sparse_init_one_section(__nr_to_section(pnum), pnum, map,
usemap);
--
2.13.6
next prev parent reply other threads:[~2018-02-01 7:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 7:19 [PATCH 0/2] Optimize the code of mem_map allocation in Baoquan He
2018-02-01 7:19 ` Baoquan He
2018-02-01 7:19 ` Baoquan He [this message]
2018-02-01 7:19 ` [PATCH 1/2] mm/sparsemem: Defer the ms->section_mem_map clearing a little later Baoquan He
2018-02-01 14:15 ` Dave Hansen
2018-02-01 14:15 ` Dave Hansen
2018-02-01 14:38 ` Baoquan He
2018-02-01 14:38 ` Baoquan He
2018-02-01 7:19 ` [PATCH 2/2] mm/sparse.c: Add nr_present_sections to change the mem_map allocation Baoquan He
2018-02-01 7:19 ` Baoquan He
2018-02-01 10:16 ` Kirill A. Shutemov
2018-02-01 10:16 ` Kirill A. Shutemov
2018-02-01 13:49 ` Dave Hansen
2018-02-01 13:49 ` Dave Hansen
2018-02-01 14:19 ` Baoquan He
2018-02-01 14:19 ` Baoquan He
2018-02-01 14:23 ` Dave Hansen
2018-02-01 14:23 ` Dave Hansen
2018-02-01 14:33 ` Baoquan He
2018-02-01 14:33 ` Baoquan He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180201071956.14365-2-bhe@redhat.com \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=douly.fnst@cn.fujitsu.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.