Messages in this thread | | | Date | Fri, 28 Mar 2008 10:34:51 +0900 | From | Yasunori Goto <> | Subject | Re: [PATCH 2 of 4] hotplug-memory: adding non-section-aligned memory is bad |
| |
> On Thu, 27 Mar 2008 17:28:38 -0700 > Jeremy Fitzhardinge <jeremy@goop.org> wrote: > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > > --- a/include/linux/mmzone.h > > +++ b/include/linux/mmzone.h > > @@ -784,6 +784,9 @@ > > #define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT) > > #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) > > > > +#define SECTION_SIZE (1UL << SECTION_SIZE_BITS) > > +#define SECTION_SIZE_MASK (SECTION_SIZE - 1) > > + > > #define SECTION_BLOCKFLAGS_BITS \ > > ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS) > > > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > > @@ -300,6 +300,11 @@ > > int ret; > > u64 start = res->start; > > u64 size = res->end - res->start + 1; > > + > > + /* Adding non-section-aligned memory will give unexpected > > + and unintuitive results. */ > > + WARN_ON((start & SECTION_SIZE_MASK) != 0); > > + WARN_ON((size & SECTION_SIZE_MASK) != 0); > > > Why just WARNING ? not BUG_ON?
Both Nack.
Because, firmware may occupy some area in the section. Firmware must exclude those area to notify kernel. So, E820, EFI, or _CRS of ACPI may return not aligned address and size. register_memory_resource() and walk_memory_resource() are to skip them silently. This is intended.
Bye.
-- Yasunori Goto
| |