From: Andrew Morton <akpm@linux-foundation.org>
To: David Rientjes <rientjes@google.com>
Cc: Yinghai Lu <yinghai@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Tony Luck <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3] mm: Check if section present during memory block registering
Date: Wed, 26 Aug 2015 14:51:26 -0700 [thread overview]
Message-ID: <20150826145126.a85594b385b55057ec3fccdb@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1508261436300.19139@chino.kir.corp.google.com>
On Wed, 26 Aug 2015 14:38:35 -0700 (PDT) David Rientjes <rientjes@google.com> wrote:
> > --- linux-2.6.orig/drivers/base/node.c
> > +++ linux-2.6/drivers/base/node.c
> > @@ -390,7 +390,18 @@ int register_mem_sect_under_node(struct
> > sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
> > sect_end_pfn += PAGES_PER_SECTION - 1;
> > for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
> > - int page_nid;
> > + int page_nid, scn_nr;
> > +
> > + /*
> > + * memory block could have several absent sections from start.
> > + * skip pfn range from absent section
> > + */
> > + scn_nr = pfn_to_section_nr(pfn);
> > + if (!present_section_nr(scn_nr)) {
> > + pfn = round_down(pfn + PAGES_PER_SECTION,
> > + PAGES_PER_SECTION) - 1;
> > + continue;
> > + }
> >
> > page_nid = get_nid_for_pfn(pfn);
> > if (page_nid < 0)
>
> scn_nr should really be unsigned long, but it would probably be better to
> simply use if (!pfn_present(pfn)) rather than store the section number.
Yup. I was feeling lazy but you motivated me.
<grunt, wheeze>
--- a/drivers/base/node.c~mm-check-if-section-present-during-memory-block-registering-fix
+++ a/drivers/base/node.c
@@ -390,14 +390,13 @@ int register_mem_sect_under_node(struct
sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
sect_end_pfn += PAGES_PER_SECTION - 1;
for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
- int page_nid, scn_nr;
+ int page_nid;
/*
* memory block could have several absent sections from start.
* skip pfn range from absent section
*/
- scn_nr = pfn_to_section_nr(pfn);
- if (!present_section_nr(scn_nr)) {
+ if (!present_section_nr(pfn_to_section_nr(pfn))) {
pfn = round_down(pfn + PAGES_PER_SECTION,
PAGES_PER_SECTION) - 1;
continue;
_
next prev parent reply other threads:[~2015-08-26 21:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 21:01 [PATCH v3] mm: Check if section present during memory block registering Yinghai Lu
2015-08-26 21:38 ` David Rientjes
2015-08-26 21:51 ` Andrew Morton [this message]
2015-08-26 22:06 ` David Rientjes
2015-08-27 0:02 ` David Rientjes
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=20150826145126.a85594b385b55057ec3fccdb@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.com \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=yinghai@kernel.org \
/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