linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hp.com>
To: Andrew Morton <akpm@linux-foundation.org>
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, 08 Mar 2013 14:55:49 -0700	[thread overview]
Message-ID: <1362779749.12845.171.camel@misato.fc.hp.com> (raw)
In-Reply-To: <20130308133106.ec4f9810b69b105b8f70d82a@linux-foundation.org>

On Fri, 2013-03-08 at 13:31 -0800, Andrew Morton wrote:
> 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.

It was found in code inspection.  For ACPI memory hot-delete, both start
and size values are obtained from ACPI, and should always be
page-aligned.  So, this issue is not exposed at this point.  That said,
it should handle the boundary condition correctly since it might be
called from other path in future.  Yes, I will include such info when
fixing bugs.

Thanks,
-Toshi


--
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 22:06 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
2013-03-08 21:55     ` Toshi Kani [this message]

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=1362779749.12845.171.camel@misato.fc.hp.com \
    --to=toshi.kani@hp.com \
    --cc=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=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