linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Jan Stancek <jstancek@redhat.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 1/2] drivers/base/node.c: split loop in register_mem_sect_under_node
Date: Tue, 1 Sep 2015 15:15:33 +0800	[thread overview]
Message-ID: <20150901071533.GC23114@localhost.localdomain> (raw)
In-Reply-To: <1a7c81db42986a6fa27260fe189890bffc8a9cce.1440665740.git.jstancek@redhat.com>

Ccing linux-mm

On 08/27/15 at 04:43pm, Jan Stancek wrote:
> Split single loop going over all pfn in mem_blk into 2 loops,
> where outer loop goes over all sections and inner loop goes over
> pfn from that section.
> 
> This is preparatory patch for next patch:
>   "skip non-present sections in register_mem_sect_under_node"
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/base/node.c | 41 ++++++++++++++++++++++++-----------------
>  1 file changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 31df474d72f4..4c7423a4b5f4 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -379,33 +379,40 @@ static int __init_refok get_nid_for_pfn(unsigned long pfn)
>  int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
>  {
>  	int ret;
> -	unsigned long pfn, sect_start_pfn, sect_end_pfn;
> +	unsigned long pfn, sect_start_pfn, sect_end_pfn, sect_no;
>  
>  	if (!mem_blk)
>  		return -EFAULT;
>  	if (!node_online(nid))
>  		return 0;
>  
> -	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 page_nid;
> +	for (sect_no = mem_blk->start_section_nr;
> +		sect_no <= mem_blk->end_section_nr;
> +		sect_no++) {
>  
> -		page_nid = get_nid_for_pfn(pfn);
> -		if (page_nid < 0)
> -			continue;
> -		if (page_nid != nid)
> -			continue;
> -		ret = sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj,
> -					&mem_blk->dev.kobj,
> -					kobject_name(&mem_blk->dev.kobj));
> -		if (ret)
> -			return ret;
> +		sect_start_pfn = section_nr_to_pfn(sect_no);
> +		sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
> +
> +		for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
> +			int page_nid;
>  
> -		return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
> +			page_nid = get_nid_for_pfn(pfn);
> +			if (page_nid < 0)
> +				continue;
> +			if (page_nid != nid)
> +				continue;
> +
> +			ret = sysfs_create_link_nowarn(
> +				&node_devices[nid]->dev.kobj,
> +				&mem_blk->dev.kobj,
> +				kobject_name(&mem_blk->dev.kobj));
> +			if (ret)
> +				return ret;
> +
> +			return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
>  				&node_devices[nid]->dev.kobj,
>  				kobject_name(&node_devices[nid]->dev.kobj));
> +		}
>  	}
>  	/* mem section does not span the specified node */
>  	return 0;
> -- 
> 1.8.3.1
> 
> --
> 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/

--
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>

       reply	other threads:[~2015-09-01  7:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1a7c81db42986a6fa27260fe189890bffc8a9cce.1440665740.git.jstancek@redhat.com>
2015-09-01  7:15 ` Dave Young [this message]
     [not found] ` <b12da2996a30cb739146a5eccd068bbe650092a1.1440665740.git.jstancek@redhat.com>
2015-09-01  7:15   ` [PATCH 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node Dave Young
2015-09-09 11:11     ` Jan Stancek
2015-09-22  8:27       ` Jan Stancek
2015-10-04 12:06         ` Greg KH
2015-10-05  8:31           ` Jan Stancek

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=20150901071533.GC23114@localhost.localdomain \
    --to=dyoung@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jstancek@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).