From: Wei Yang <richard.weiyang@gmail.com>
To: dave.hansen@linux.intel.com, akpm@linux-foundation.org,
mhocko@suse.com, rientjes@google.com
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>
Subject: [PATCH] mm: check __highest_present_sectioin_nr directly in memory_dev_init()
Date: Fri, 30 Mar 2018 11:20:44 +0800 [thread overview]
Message-ID: <20180330032044.21647-1-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20180326081956.75275-2-richard.weiyang@gmail.com>
__highest_present_section_nr is a more strict boundary than
NR_MEM_SECTIONS. So check __highest_present_sectioin_nr directly is enough.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
drivers/base/memory.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index fe4b24f05f6a..e79e3361f632 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -833,11 +833,8 @@ int __init memory_dev_init(void)
* during boot and have been initialized
*/
mutex_lock(&mem_sysfs_mutex);
- for (i = 0; i < NR_MEM_SECTIONS; i += sections_per_block) {
- /* Don't iterate over sections we know are !present: */
- if (i > __highest_present_section_nr)
- break;
-
+ for (i = 0; i <= __highest_present_section_nr;
+ i += sections_per_block) {
err = add_memory_block(i);
if (!ret)
ret = err;
--
2.15.1
next prev parent reply other threads:[~2018-03-30 3:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 8:19 [PATCH 1/2] mm/sparse: pass the __highest_present_section_nr + 1 to alloc_func() Wei Yang
2018-03-26 8:19 ` [PATCH 2/2] mm/sparse: check __highest_present_section_nr only for a present section Wei Yang
2018-03-30 3:20 ` Wei Yang [this message]
2018-03-26 20:56 ` [PATCH 1/2] mm/sparse: pass the __highest_present_section_nr + 1 to alloc_func() David Rientjes
2018-03-26 22:30 ` Wei Yang
2018-03-26 22:47 ` David Rientjes
2018-03-26 22:56 ` Wei Yang
2018-03-26 22:58 ` David Rientjes
2018-03-26 23:15 ` Wei Yang
2018-04-12 3:26 ` Wei Yang
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=20180330032044.21647-1-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
/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 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).