Re: [PATCH 2/2] mm: remove_memory: Fix end_pfn setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx> 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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]