* [PATCH 1/2] mm: walk_memory_range: Fix typo in comment @ 2013-03-08 15:41 Toshi Kani 2013-03-08 15:41 ` [PATCH 2/2] mm: remove_memory: Fix end_pfn setting Toshi Kani 0 siblings, 1 reply; 4+ messages in thread From: Toshi Kani @ 2013-03-08 15:41 UTC (permalink / raw) To: akpm; +Cc: linux-mm, linux-kernel, isimatu.yasuaki, wency, tangchen, Toshi Kani Fix a typo "end_pft" in the comment of walk_memory_range(). Signed-off-by: Toshi Kani <toshi.kani@hp.com> --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b81a367b..ae7bcba 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1613,7 +1613,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages) /** * walk_memory_range - walks through all mem sections in [start_pfn, end_pfn) * @start_pfn: start pfn of the memory range - * @end_pfn: end pft of the memory range + * @end_pfn: end pfn of the memory range * @arg: argument passed to func * @func: callback for each memory section walked * ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] mm: remove_memory: Fix end_pfn setting 2013-03-08 15:41 [PATCH 1/2] mm: walk_memory_range: Fix typo in comment Toshi Kani @ 2013-03-08 15:41 ` Toshi Kani 2013-03-08 21:31 ` Andrew Morton 0 siblings, 1 reply; 4+ messages in thread From: Toshi Kani @ 2013-03-08 15:41 UTC (permalink / raw) To: akpm; +Cc: linux-mm, linux-kernel, isimatu.yasuaki, wency, tangchen, Toshi Kani 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. Signed-off-by: Toshi Kani <toshi.kani@hp.com> --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index ae7bcba..3e2ab7b 100644 --- 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mm: remove_memory: Fix end_pfn setting 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 0 siblings, 1 reply; 4+ messages in thread From: Andrew Morton @ 2013-03-08 21:31 UTC (permalink / raw) To: Toshi Kani; +Cc: linux-mm, linux-kernel, isimatu.yasuaki, wency, tangchen 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mm: remove_memory: Fix end_pfn setting 2013-03-08 21:31 ` Andrew Morton @ 2013-03-08 21:55 ` Toshi Kani 0 siblings, 0 replies; 4+ messages in thread From: Toshi Kani @ 2013-03-08 21:55 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-mm, linux-kernel, isimatu.yasuaki, wency, tangchen 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-08 22:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox