linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Toshi Kani <toshi.kani@hp.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	isimatu.yasuaki@jp.fujitsu.com, wency@cn.fujitsu.com,
	tangchen@cn.fujitsu.com
Subject: Re: [PATCH 2/2] mm: remove_memory: Fix end_pfn setting
Date: Fri, 8 Mar 2013 13:31:06 -0800	[thread overview]
Message-ID: <20130308133106.ec4f9810b69b105b8f70d82a@linux-foundation.org> (raw)
In-Reply-To: <1362757301-18550-2-git-send-email-toshi.kani@hp.com>

On Fri,  8 Mar 2013 08:41:41 -0700 Toshi Kani <toshi.kani@hp.com> wrote:

> remove_memory() calls walk_memory_range() with [start_pfn, end_pfn),
> where end_pfn is exclusive in this range.  Therefore, end_pfn needs
> to be set to the next page of the end address.
> 
> ...
>
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1801,7 +1801,7 @@ int __ref remove_memory(int nid, u64 start, u64 size)
>  	int retry = 1;
>  
>  	start_pfn = PFN_DOWN(start);
> -	end_pfn = start_pfn + PFN_DOWN(size);
> +	end_pfn = PFN_UP(start + size - 1);
>  
>  	/*
>  	 * When CONFIG_MEMCG is on, one memory block may be used by other

That looks right, although these rounding/boundary things are always
hard.  I wonder if `start' and `size' are ever not multiples of
PAGE_SIZE..

How did you discover this?  Code inspection, or some runtime
malfunction?  Please always include this info when fixing bugs.

--
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:[~2013-03-08 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-08 15:41 [PATCH 1/2] mm: walk_memory_range: Fix typo in comment Toshi Kani
2013-03-08 15:41 ` [PATCH 2/2] mm: remove_memory: Fix end_pfn setting Toshi Kani
2013-03-08 21:31   ` Andrew Morton [this message]
2013-03-08 21:55     ` Toshi Kani

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=20130308133106.ec4f9810b69b105b8f70d82a@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tangchen@cn.fujitsu.com \
    --cc=toshi.kani@hp.com \
    --cc=wency@cn.fujitsu.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