Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1214214
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] mm: Check if section present during memory block registering |
| Date | 2015-08-27 00:00 +0200 |
| Message-ID | <q1QTE-1pv-1@gated-at.bofh.it> (permalink) |
| References | <q1Q7g-vc-5@gated-at.bofh.it> <q1QAi-12Y-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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;
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3] mm: Check if section present during memory block registering Yinghai Lu <yinghai@kernel.org> - 2015-08-26 23:10 +0200
Re: [PATCH v3] mm: Check if section present during memory block registering David Rientjes <rientjes@google.com> - 2015-08-26 23:40 +0200
Re: [PATCH v3] mm: Check if section present during memory block registering Andrew Morton <akpm@linux-foundation.org> - 2015-08-27 00:00 +0200
Re: [PATCH v3] mm: Check if section present during memory block registering David Rientjes <rientjes@google.com> - 2015-08-27 00:10 +0200
Re: [PATCH v3] mm: Check if section present during memory block registering David Rientjes <rientjes@google.com> - 2015-08-27 02:10 +0200
csiph-web