lkml.org 
[lkml]   [2008]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH]Fix usemap for DISCONTIG/FLATMEM with not-aligned zone initilaization.
From
Date

On Fri, 2008-04-18 at 17:15 +0100, Mel Gorman wrote:
> -void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
> +void __meminit memmap_init_zone(unsigned long size, int nid, struct zone *zone,
> unsigned long start_pfn, enum memmap_context context)
> {
> struct page *page;
> unsigned long end_pfn = start_pfn + size;
> unsigned long pfn;
> + int zoneidx = zone_idx(zone);
> +
> + /*
> + * Sanity check the values passed in. It is possible an architecture
> + * calling this function directly will use values outside of the memory
> + * they registered
> + */
> + if (start_pfn < zone->zone_start_pfn) {
> + WARN_ON_ONCE(1);
> + start_pfn = zone->zone_start_pfn;
> + }
> +
> + if (size > zone->spanned_pages) {
> + WARN_ON_ONCE(1);
> + size = zone->spanned_pages;
> + }

I was thinking about whether size needs to be modified in there like
this:

if (start_pfn < zone->zone_start_pfn) {
WARN_ON_ONCE(1);
+ size -= zone->zone_start_pfn - start_pfn;
start_pfn = zone->zone_start_pfn;
}

and I realized that your modification of size actually happens after its
only use in the function (to calculate end_pfn). Seems like we either
be error-checking end_pfn or delaying its calculation until after 'size'
is fixed.

-- Dave



\
 
 \ /
  Last update: 2008-04-18 19:45    [W:0.117 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site