Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755915AbbHZERX (ORCPT ); Wed, 26 Aug 2015 00:17:23 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:35295 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbbHZERV (ORCPT ); Wed, 26 Aug 2015 00:17:21 -0400 Date: Wed, 26 Aug 2015 06:17:16 +0200 From: Ingo Molnar To: Yinghai Lu Cc: Tony Luck , Daniel J Blueman , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Bjorn Helgaas , the arch/x86 maintainers , Linux Kernel Mailing List , "linux-pci@vger.kernel.org" , Steffen Persvold Subject: Re: [PATCH v4 4/4] Use 2GB memory block size on large-memory x86-64 systems Message-ID: <20150826041716.GA14102@gmail.com> References: <20150821202707.GA920@agluck-desk.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1752 Lines: 52 * Yinghai Lu wrote: > --- a/drivers/base/node.c > +++ b/drivers/base/node.c > @@ -390,8 +390,14 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid) > 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; > > + 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) > continue; > @@ -426,10 +432,18 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, > return -ENOMEM; > nodes_clear(*unlinked_nodes); > > - sect_start_pfn = section_nr_to_pfn(phys_index); > - sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; > + sect_start_pfn = section_nr_to_pfn(mem_blk->start_section_nr); > + 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 nid; > + int nid, scn_nr; > + > + 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; > + } NAK due to lack of cleanliness: the two loops look almost identical - this sure can be factored out... Thanks, Ingo -- 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/