2006-09-14 17:37:28

by Judith Lebzelter

[permalink] [raw]
Subject: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

Hello,

For ppc in our cross-compile build farm (PLM), there is an error
compiling file ppc/mm/init.c:

CC arch/ppc/mm/init.o
CC arch/powerpc/kernel/init_task.o
arch/ppc/mm/init.c: In function 'paging_init':
arch/ppc/mm/init.c:381: error: subscripted value is neither array nor pointer
arch/ppc/mm/init.c:383: warning: passing argument 1 of '/' makes pointer from integer without a cast
make[1]: [arch/ppc/mm/init.o] Error 1 (ignored)


This is caused by an error/oversight in file
'have-power-use-add_active_range-and-free_area_init_nodes.patch'

Here is a patch to fix that patch.

Thanks;
Judith Lebzelter
OSDL


--- arch/ppc/mm/init.c.old 2006-09-14 09:40:51.964543641 -0700
+++ arch/ppc/mm/init.c 2006-09-14 10:04:46.814015750 -0700
@@ -359,7 +359,7 @@
void __init paging_init(void)
{
unsigned long start_pfn, end_pfn;
- unsigned long max_zone_pfns;
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
#ifdef CONFIG_HIGHMEM
map_page(PKMAP_BASE, 0, 0); /* XXX gross */
pkmap_page_table = pte_offset_kernel(pmd_offset(pgd_offset_k


2006-09-14 18:11:34

by Mel Gorman

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

On Thu, 14 Sep 2006, Judith Lebzelter wrote:

> For ppc in our cross-compile build farm (PLM), there is an error
> compiling file ppc/mm/init.c:
>
> CC arch/ppc/mm/init.o
> CC arch/powerpc/kernel/init_task.o
> arch/ppc/mm/init.c: In function 'paging_init':
> arch/ppc/mm/init.c:381: error: subscripted value is neither array nor pointer
> arch/ppc/mm/init.c:383: warning: passing argument 1 of '/' makes pointer from integer without a cast
> make[1]: [arch/ppc/mm/init.o] Error 1 (ignored)
>
>
> This is caused by an error/oversight in file
> 'have-power-use-add_active_range-and-free_area_init_nodes.patch'
>
> Here is a patch to fix that patch.
>

Looks good. Thanks

Acked-by: Mel Gorman <[email protected]>


> Thanks;
> Judith Lebzelter
> OSDL
>
>
> --- arch/ppc/mm/init.c.old 2006-09-14 09:40:51.964543641 -0700
> +++ arch/ppc/mm/init.c 2006-09-14 10:04:46.814015750 -0700
> @@ -359,7 +359,7 @@
> void __init paging_init(void)
> {
> unsigned long start_pfn, end_pfn;
> - unsigned long max_zone_pfns;
> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> #ifdef CONFIG_HIGHMEM
> map_page(PKMAP_BASE, 0, 0); /* XXX gross */
> pkmap_page_table = pte_offset_kernel(pmd_offset(pgd_offset_k
>

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab

2006-10-03 04:28:09

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

On Thu, 2006-09-14 at 19:11 +0100, Mel Gorman wrote:
> On Thu, 14 Sep 2006, Judith Lebzelter wrote:
>
> > For ppc in our cross-compile build farm (PLM), there is an error
> > compiling file ppc/mm/init.c:
> >
> > CC arch/ppc/mm/init.o
> > CC arch/powerpc/kernel/init_task.o
> > arch/ppc/mm/init.c: In function 'paging_init':
> > arch/ppc/mm/init.c:381: error: subscripted value is neither array nor pointer
> > arch/ppc/mm/init.c:383: warning: passing argument 1 of '/' makes pointer from integer without a cast
> > make[1]: [arch/ppc/mm/init.o] Error 1 (ignored)
> >
> >
> > This is caused by an error/oversight in file
> > 'have-power-use-add_active_range-and-free_area_init_nodes.patch'
> >
> > Here is a patch to fix that patch.
> >
>
> Looks good. Thanks
>
> Acked-by: Mel Gorman <[email protected]>

Note that the whole ppc patch here seems broken. Sorry for not jumping
earlier, I've been swamped with other things.

First, why the heck do you use indices 0 and 1 explicitely rather than
the symbolic constants ? ppc doesn't have a ZONE_NORMAL, so we should be
filling ZONE_DMA and ZONE_HIGHMEM but you end up filling ZONE_DMA and
ZONE_NORMAL and leave ZONE_HIGHMEM alone. Also, you leave other entries
filled with crap (the array isn't initialized) which cause some strange
display of the PFN list, if not worse problems later, I don't know for
sure at this stage.

I've about to run some tests with this patch. Looks like we need give a
closer look at those patches, in case that breakage appears on other
archs as well (or similar).
---

New zone initialisation on powerpc is broken, especially with
CONFIG_HIGHMEM, this fixes it by initializing the array to 0 and filling
up the right entries.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>

Index: linux-work/arch/powerpc/mm/mem.c
===================================================================
--- linux-work.orig/arch/powerpc/mm/mem.c 2006-10-03 12:41:03.000000000 +1000
+++ linux-work/arch/powerpc/mm/mem.c 2006-10-03 14:08:30.000000000 +1000
@@ -307,11 +307,12 @@ void __init paging_init(void)
top_of_ram, total_ram);
printk(KERN_DEBUG "Memory hole size: %ldMB\n",
(top_of_ram - total_ram) >> 20);
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
#ifdef CONFIG_HIGHMEM
- max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
- max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
#else
- max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
#endif
free_area_init_nodes(max_zone_pfns);
}



2006-10-03 08:51:19

by Mel Gorman

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

On Tue, 3 Oct 2006, Benjamin Herrenschmidt wrote:

> On Thu, 2006-09-14 at 19:11 +0100, Mel Gorman wrote:
>> On Thu, 14 Sep 2006, Judith Lebzelter wrote:
>>
>>> For ppc in our cross-compile build farm (PLM), there is an error
>>> compiling file ppc/mm/init.c:
>>>
>>> CC arch/ppc/mm/init.o
>>> CC arch/powerpc/kernel/init_task.o
>>> arch/ppc/mm/init.c: In function 'paging_init':
>>> arch/ppc/mm/init.c:381: error: subscripted value is neither array nor pointer
>>> arch/ppc/mm/init.c:383: warning: passing argument 1 of '/' makes pointer from integer without a cast
>>> make[1]: [arch/ppc/mm/init.o] Error 1 (ignored)
>>>
>>>
>>> This is caused by an error/oversight in file
>>> 'have-power-use-add_active_range-and-free_area_init_nodes.patch'
>>>
>>> Here is a patch to fix that patch.
>>>
>>
>> Looks good. Thanks
>>
>> Acked-by: Mel Gorman <[email protected]>
>
> Note that the whole ppc patch here seems broken. Sorry for not jumping
> earlier, I've been swamped with other things.
>
> First, why the heck do you use indices 0 and 1 explicitely rather than
> the symbolic constants ?

Because in the -mm kernel the patches were rolled against, ZONE_DMA was
optional and MAX_NR_ZONES could change which led to this confusion. It is
wrong and thanks for catching it. However, this is a a fairly small part
of the whole patch, is it an exaggeration to call the whole patch broken?

On a semi-related (but not very important) note, why does PPC use ZONE_DMA
as it's lowest zone and not ZONE_NORMAL? I currently view zones as
meaning;

ZONE_DMA - The physical range of memory usable by a subset of devices
available on the target platform (usually considered to be ISA
devices). It is mapped into the kernel
virtual address space

ZONE_DMA32 - The physical range of memory usable by 32 bit devices on 64
bit platforms. It is mapped into the kernel virtual address space

ZONE_NORMAL - The physical range of memory excluding the lower
zones directly mapped into the kernel virtual address space.

ZONE_HIGHMEM - The higher physical address spaces not permanently mapped
into the kernel virtual address space

This is not 100% bullet-proof definition. For example, memmap can be
allocated from highmem and placed in the kernel virtual address space. But
by the definitions above, ppc would have no ZONE_DMA, only ZONE_NORMAL and
ZONE_HIGHMEM. Was ZONE_DMA used for any particular reason?

> ppc doesn't have a ZONE_NORMAL, so we should be
> filling ZONE_DMA and ZONE_HIGHMEM but you end up filling ZONE_DMA and
> ZONE_NORMAL and leave ZONE_HIGHMEM alone. Also, you leave other entries
> filled with crap (the array isn't initialized) which cause some strange
> display of the PFN list, if not worse problems later, I don't know for
> sure at this stage.
>

By the PFN list, I assume you mean the dmesg entry that starts with "Zone
PFN ranges:". If that is messed up, it is bad, but it should still boot
albeit with memory in the wrong zones.

> I've about to run some tests with this patch.

I made a minor comment on your patch below.

> Looks like we need give a
> closer look at those patches, in case that breakage appears on other
> archs as well (or similar).

I looked through the other patches for similar breakage. On x86,
max_zone_pfns is initialised as;

# x86 init
+ unsigned long max_zone_pfns[MAX_NR_ZONES] = {
+ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
+ max_low_pfn,
+ highend_pfn
+ };

as it does not have ZONE_DMA32, I believe it's ok. On x86_64, I used

# x86_64 init
+ unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
+ MAX_DMA32_PFN,
+ end_pfn};

This should be ok because x86_64 uses ZONE_NORMAL as the highest zone.

On ia64, there is

# ia64
+ max_zone_pfns[ZONE_DMA] = max_dma;
+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn;

That should also be ok because it doesn't use HIGHMEM.

How do they look to you?


> ---
>
> New zone initialisation on powerpc is broken, especially with
> CONFIG_HIGHMEM, this fixes it by initializing the array to 0 and filling
> up the right entries.
>
> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
>
> Index: linux-work/arch/powerpc/mm/mem.c
> ===================================================================
> --- linux-work.orig/arch/powerpc/mm/mem.c 2006-10-03 12:41:03.000000000 +1000
> +++ linux-work/arch/powerpc/mm/mem.c 2006-10-03 14:08:30.000000000 +1000
> @@ -307,11 +307,12 @@ void __init paging_init(void)
> top_of_ram, total_ram);
> printk(KERN_DEBUG "Memory hole size: %ldMB\n",
> (top_of_ram - total_ram) >> 20);
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> #ifdef CONFIG_HIGHMEM
> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
> - max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;

Add

max_zone_pfns[ZONE_NORMAL] = total_lowmem >> PAGE_SHIFT;

The effect will be that ZONE_NORMAL will be initialised as empty.

> + max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
> #else
> - max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
> #endif
> free_area_init_nodes(max_zone_pfns);
> }
>
>
>

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab

2006-10-03 09:20:06

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c


> Because in the -mm kernel the patches were rolled against, ZONE_DMA was
> optional and MAX_NR_ZONES could change which led to this confusion. It is
> wrong and thanks for catching it. However, this is a a fairly small part
> of the whole patch, is it an exaggeration to call the whole patch broken?

Well, that and the partially uninitialized array, that comprises most of
the ppc patch :) I wasn't talking about the other patches forming your
patch set, mostly the whole PPC... the lack of usage of symbolic
constants looked pretty bad to me, I didn't know there were those other
-mm related constraints.

> On a semi-related (but not very important) note, why does PPC use ZONE_DMA
> as it's lowest zone and not ZONE_NORMAL? I currently view zones as
> meaning;

History... A lot of driver used to request memory in ZONE_DMA "just in
case" (the SCSI subsystem for example). Not having one meant that those
drivers or subsystem would just not work on powerpc. I don't know if
they have all been fixed, but if that's the case, then we can move
everything to ZONE_NORMAL.

> ZONE_DMA32 - The physical range of memory usable by 32 bit devices on 64
> bit platforms. It is mapped into the kernel virtual address space

We haven't done a ZONE_DMA32 for now. Currently, all supported 64 bits
implementations have an iommu that makes this unnecessary, though the
thread of having to deal with an implementation without one is getting
more and more precise, so we may have to add it.

> This is not 100% bullet-proof definition. For example, memmap can be
> allocated from highmem and placed in the kernel virtual address space. But
> by the definitions above, ppc would have no ZONE_DMA, only ZONE_NORMAL and
> ZONE_HIGHMEM. Was ZONE_DMA used for any particular reason?

As explained above. Is that a problem ?

> By the PFN list, I assume you mean the dmesg entry that starts with "Zone
> PFN ranges:". If that is messed up, it is bad, but it should still boot
> albeit with memory in the wrong zones.

It was messed up with ZONE_DMA 0 -> xxx where xxx was my actual max_pfn,
and ZONE_NORMAL from xxx -> yyy where yyy was a random very big number.
That was with CONFIG_HIGHMEM off and it did boot. It didn't with
CONFIG_HIGHMEM on as the high memory was being put in ZONE_NORMAL and
ZONE_HIGHMEM left uninitialized.

> > I've about to run some tests with this patch.
>
> I made a minor comment on your patch below.
>
> > Looks like we need give a
> > closer look at those patches, in case that breakage appears on other
> > archs as well (or similar).
>
> I looked through the other patches for similar breakage. On x86,
> max_zone_pfns is initialised as;
>
> # x86 init
> + unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> + max_low_pfn,
> + highend_pfn
> + };
>
> as it does not have ZONE_DMA32, I believe it's ok. On x86_64, I used

I would much prefer to use explicit array index initializers... but ok.

> # x86_64 init
> + unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
> + MAX_DMA32_PFN,
> + end_pfn};
>
> This should be ok because x86_64 uses ZONE_NORMAL as the highest zone.

Same comment.

> On ia64, there is
>
> # ia64
> + max_zone_pfns[ZONE_DMA] = max_dma;
> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>
> That should also be ok because it doesn't use HIGHMEM.
>
> How do they look to you?

I suppose they are ok. I dislike this CONFIG_* variation of the
definition of the ZONE_* constants, it's error prone though.

> > ---
> >
> > New zone initialisation on powerpc is broken, especially with
> > CONFIG_HIGHMEM, this fixes it by initializing the array to 0 and filling
> > up the right entries.
> >
> > Signed-off-by: Benjamin Herrenschmidt <[email protected]>
> >
> > Index: linux-work/arch/powerpc/mm/mem.c
> > ===================================================================
> > --- linux-work.orig/arch/powerpc/mm/mem.c 2006-10-03 12:41:03.000000000 +1000
> > +++ linux-work/arch/powerpc/mm/mem.c 2006-10-03 14:08:30.000000000 +1000
> > @@ -307,11 +307,12 @@ void __init paging_init(void)
> > top_of_ram, total_ram);
> > printk(KERN_DEBUG "Memory hole size: %ldMB\n",
> > (top_of_ram - total_ram) >> 20);
> > + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> > #ifdef CONFIG_HIGHMEM
> > - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
> > - max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
> > + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
>
> Add
>
> max_zone_pfns[ZONE_NORMAL] = total_lowmem >> PAGE_SHIFT;
>
> The effect will be that ZONE_NORMAL will be initialised as empty.

Ok, but what happens with the patch code where it's 0 ? I much prefer,
in general, initializing an array to 0, and then only fill the entries
that matter. This avoids the problem of the ZONE_* constants floating
around (or adding a new one or whatever). It might make sense to have
the generic code handle that instead...

Cheers,
Ben.


2006-10-03 09:34:10

by Mel Gorman

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

On Tue, 3 Oct 2006, Benjamin Herrenschmidt wrote:

>
>> Because in the -mm kernel the patches were rolled against, ZONE_DMA was
>> optional and MAX_NR_ZONES could change which led to this confusion. It is
>> wrong and thanks for catching it. However, this is a a fairly small part
>> of the whole patch, is it an exaggeration to call the whole patch broken?
>
> Well, that and the partially uninitialized array, that comprises most of
> the ppc patch :)

ok, that's a fair enough point :) .

> I wasn't talking about the other patches forming your
> patch set, mostly the whole PPC... the lack of usage of symbolic
> constants looked pretty bad to me

Once we have a patch using symbolic names working on ppc, I'll make a
patch that uses symbolic names on the other architectures and post it.

>, I didn't know there were those other
> -mm related constraints.
>
>> On a semi-related (but not very important) note, why does PPC use ZONE_DMA
>> as it's lowest zone and not ZONE_NORMAL? I currently view zones as
>> meaning;
>
> History... A lot of driver used to request memory in ZONE_DMA "just in
> case" (the SCSI subsystem for example). Not having one meant that those
> drivers or subsystem would just not work on powerpc. I don't know if
> they have all been fixed, but if that's the case, then we can move
> everything to ZONE_NORMAL.
>

I don't know if it has been fixed either.

>> ZONE_DMA32 - The physical range of memory usable by 32 bit devices on 64
>> bit platforms. It is mapped into the kernel virtual address space
>
> We haven't done a ZONE_DMA32 for now. Currently, all supported 64 bits
> implementations have an iommu that makes this unnecessary, though the
> thread of having to deal with an implementation without one is getting
> more and more precise, so we may have to add it.
>
>> This is not 100% bullet-proof definition. For example, memmap can be
>> allocated from highmem and placed in the kernel virtual address space. But
>> by the definitions above, ppc would have no ZONE_DMA, only ZONE_NORMAL and
>> ZONE_HIGHMEM. Was ZONE_DMA used for any particular reason?
>
> As explained above. Is that a problem ?
>

No, it's not. It was out of curiousity more than anything else. I need to
update my definition of ZONE_DMA slightly, that's all.

>> By the PFN list, I assume you mean the dmesg entry that starts with "Zone
>> PFN ranges:". If that is messed up, it is bad, but it should still boot
>> albeit with memory in the wrong zones.
>
> It was messed up with ZONE_DMA 0 -> xxx where xxx was my actual max_pfn,
> and ZONE_NORMAL from xxx -> yyy where yyy was a random very big number.
> That was with CONFIG_HIGHMEM off and it did boot. It didn't with
> CONFIG_HIGHMEM on as the high memory was being put in ZONE_NORMAL and
> ZONE_HIGHMEM left uninitialized.
>

ok, the problem is pretty clear at least.

>>> I've about to run some tests with this patch.
>>
>> I made a minor comment on your patch below.
>>
>>> Looks like we need give a
>>> closer look at those patches, in case that breakage appears on other
>>> archs as well (or similar).
>>
>> I looked through the other patches for similar breakage. On x86,
>> max_zone_pfns is initialised as;
>>
>> # x86 init
>> + unsigned long max_zone_pfns[MAX_NR_ZONES] = {
>> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
>> + max_low_pfn,
>> + highend_pfn
>> + };
>>
>> as it does not have ZONE_DMA32, I believe it's ok. On x86_64, I used
>
> I would much prefer to use explicit array index initializers... but ok.
>

Once we get ppc sorted, I'll make a patch that uses explicit array
initialisation and symbolic index names on the other arches.

>> # x86_64 init
>> + unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
>> + MAX_DMA32_PFN,
>> + end_pfn};
>>
>> This should be ok because x86_64 uses ZONE_NORMAL as the highest zone.
>
> Same comment.
>
>> On ia64, there is
>>
>> # ia64
>> + max_zone_pfns[ZONE_DMA] = max_dma;
>> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>>
>> That should also be ok because it doesn't use HIGHMEM.
>>
>> How do they look to you?
>
> I suppose they are ok. I dislike this CONFIG_* variation of the
> definition of the ZONE_* constants, it's error prone though.
>

I believe it was to stop having more empty zones than was really
necessary. It was a saving on NUMA. I might be wrong, I'll need to check
the archives again.

>>> ---
>>>
>>> New zone initialisation on powerpc is broken, especially with
>>> CONFIG_HIGHMEM, this fixes it by initializing the array to 0 and filling
>>> up the right entries.
>>>
>>> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
>>>
>>> Index: linux-work/arch/powerpc/mm/mem.c
>>> ===================================================================
>>> --- linux-work.orig/arch/powerpc/mm/mem.c 2006-10-03 12:41:03.000000000 +1000
>>> +++ linux-work/arch/powerpc/mm/mem.c 2006-10-03 14:08:30.000000000 +1000
>>> @@ -307,11 +307,12 @@ void __init paging_init(void)
>>> top_of_ram, total_ram);
>>> printk(KERN_DEBUG "Memory hole size: %ldMB\n",
>>> (top_of_ram - total_ram) >> 20);
>>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>>> #ifdef CONFIG_HIGHMEM
>>> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
>>> - max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
>>> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
>>
>> Add
>>
>> max_zone_pfns[ZONE_NORMAL] = total_lowmem >> PAGE_SHIFT;
>>
>> The effect will be that ZONE_NORMAL will be initialised as empty.
>
> Ok, but what happens with the patch code where it's 0 ?

Ah (wipes egg off face). In free_area_init_nodes(), it will be set to
(total_lowmem >> PAGE_SHIFT) by this;

+ arch_zone_lowest_possible_pfn[i] =
+ arch_zone_highest_possible_pfn[i-1];
+ arch_zone_highest_possible_pfn[i] =
+ max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]);

so you can leave it as 0.

> I much prefer,
> in general, initializing an array to 0, and then only fill the entries
> that matter. This avoids the problem of the ZONE_* constants floating
> around (or adding a new one or whatever). It might make sense to have
> the generic code handle that instead...
>

You're right. The generic code does handle this case because at one point,
I remembered clearly that not all zones would be in use :/

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab

2006-10-03 12:13:45

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c


> Once we have a patch using symbolic names working on ppc, I'll make a
> patch that uses symbolic names on the other architectures and post it.

Ok, good :) I don't like magic numbers

> I don't know if it has been fixed either.

Yeah... I'm not in a mood to audit all of that for 2.6.19, so I'd rather
keep it the way it is for now.

> Once we get ppc sorted, I'll make a patch that uses explicit array
> initialisation and symbolic index names on the other arches.

Ok. Any reason why my current patch wouldn't be good then ? If it's ok
for you, I'll put it in paulus queue for merging.

> I believe it was to stop having more empty zones than was really
> necessary. It was a saving on NUMA. I might be wrong, I'll need to check
> the archives again.

Well, as long as we use named indices in the array and make sure it's
properly initialized to 0, that should be ok.

> You're right. The generic code does handle this case because at one point,
> I remembered clearly that not all zones would be in use :/

Good then :)

Cheers,
Ben.


2006-10-03 13:05:04

by mel

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

>
>> Once we have a patch using symbolic names working on ppc, I'll make a
>> patch that uses symbolic names on the other architectures and post it.
>
> Ok, good :) I don't like magic numbers
>

Yep, they can really kick you in the pants.

>> I don't know if it has been fixed either.
>
> Yeah... I'm not in a mood to audit all of that for 2.6.19, so I'd rather
> keep it the way it is for now.
>

Fully agreed. It would not be an easy job and doesn't win anything until
there is a 100%-agreed-by-everybody definition of what ZONE_DMA is.

>> Once we get ppc sorted, I'll make a patch that uses explicit array
>> initialisation and symbolic index names on the other arches.
>
> Ok. Any reason why my current patch wouldn't be good then ? If it's ok
> for you, I'll put it in paulus queue for merging.
>

Your patch may be incomplete for ppc and ppc64. I've included a patch
below which I'm currently testing. It's a superset of yours with changes to
arch/powerpc/mm/numa.c, arch/powerpc/mm/mem.c and arch/ppc/mm/init.c as well
as the other arches to use symbolic names. I can split the patch per-arch if
you want to take the power-related patches seperatly. Can you look through
it please?

It's currently being tested on the machines I have but I do not access
to a ppc that needs ZONE_HIGHMEM :(

>> I believe it was to stop having more empty zones than was really
>> necessary. It was a saving on NUMA. I might be wrong, I'll need to check
> the archives again.
>
> Well, as long as we use named indices in the array and make sure it's
> properly initialized to 0, that should be ok.
>

I think I have that.

>> You're right. The generic code does handle this case because at one point,
>> I remembered clearly that not all zones would be in use :/
>
> Good then :)
>

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/kernel/setup.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c
--- linux-2.6.18-git19-clean/arch/i386/kernel/setup.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c 2006-10-03 11:15:59.000000000 +0100
@@ -1083,16 +1083,15 @@ static unsigned long __init setup_memory

void __init zone_sizes_init(void)
{
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] =
+ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
- max_low_pfn,
- highend_pfn};
+ max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
add_active_range(0, 0, highend_pfn);
#else
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
- max_low_pfn};
add_active_range(0, 0, max_low_pfn);
#endif

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c
--- linux-2.6.18-git19-clean/arch/i386/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c 2006-10-03 11:17:27.000000000 +0100
@@ -357,11 +357,12 @@ void __init numa_kva_reserve(void)
void __init zone_sizes_init(void)
{
int nid;
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
- max_low_pfn,
- highend_pfn
- };
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] =
+ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
+ max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;

/* If SRAT has not registered memory, register it now */
if (find_max_pfn_with_active_regions() == 0) {
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/contig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c
--- linux-2.6.18-git19-clean/arch/ia64/mm/contig.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c 2006-10-03 11:21:09.000000000 +0100
@@ -233,6 +233,7 @@ paging_init (void)
efi_memmap_walk(count_pages, &num_physpages);

max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
max_zone_pfns[ZONE_DMA] = max_dma;
max_zone_pfns[ZONE_NORMAL] = max_low_pfn;

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c
--- linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c 2006-10-03 11:21:54.000000000 +0100
@@ -709,6 +709,7 @@ void __init paging_init(void)
max_pfn = mem_data[node].max_pfn;
}

+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
max_zone_pfns[ZONE_DMA] = max_dma;
max_zone_pfns[ZONE_NORMAL] = max_pfn;
free_area_init_nodes(max_zone_pfns);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c
--- linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c 2006-10-03 11:10:57.000000000 +0100
@@ -307,11 +307,12 @@ void __init paging_init(void)
top_of_ram, total_ram);
printk(KERN_DEBUG "Memory hole size: %ldMB\n",
(top_of_ram - total_ram) >> 20);
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
#ifdef CONFIG_HIGHMEM
- max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
- max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
#else
- max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
#endif
free_area_init_nodes(max_zone_pfns);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c
--- linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c 2006-10-03 11:12:01.000000000 +0100
@@ -617,9 +617,9 @@ void __init do_init_bootmem(void)

void __init paging_init(void)
{
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- lmb_end_of_DRAM() >> PAGE_SHIFT
- };
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT;
free_area_init_nodes(max_zone_pfns);
}

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ppc/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c
--- linux-2.6.18-git19-clean/arch/ppc/mm/init.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c 2006-10-03 11:13:46.000000000 +0100
@@ -374,11 +374,12 @@ void __init paging_init(void)
end_pfn = start_pfn + (total_memory >> PAGE_SHIFT);
add_active_range(0, start_pfn, end_pfn);

+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
#ifdef CONFIG_HIGHMEM
- max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
- max_zone_pfns[1] = total_memory >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_HIGHMEM] = total_memory >> PAGE_SHIFT;
#else
- max_zone_pfns[0] = total_memory >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_memory >> PAGE_SHIFT;
#endif /* CONFIG_HIGHMEM */
free_area_init_nodes(max_zone_pfns);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c
--- linux-2.6.18-git19-clean/arch/x86_64/mm/init.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c 2006-10-03 11:18:54.000000000 +0100
@@ -406,9 +406,12 @@ void __cpuinit zap_low_mappings(int cpu)
#ifndef CONFIG_NUMA
void __init paging_init(void)
{
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
- MAX_DMA32_PFN,
- end_pfn};
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+ max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
+ max_zone_pfns[ZONE_NORMAL] = end_pfn;
+
memory_present(0, 0, end_pfn);
sparse_init();
free_area_init_nodes(max_zone_pfns);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c
--- linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c 2006-10-03 11:19:47.000000000 +0100
@@ -338,9 +338,11 @@ static void __init arch_sparse_init(void
void __init paging_init(void)
{
int i;
- unsigned long max_zone_pfns[MAX_NR_ZONES] = { MAX_DMA_PFN,
- MAX_DMA32_PFN,
- end_pfn};
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+ max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
+ max_zone_pfns[ZONE_NORMAL] = end_pfn;

arch_sparse_init();

2006-10-04 04:07:04

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c


Patch looks good on a quick look. I will try to test later today at
which point, it should go in asap, current upstream doesn't boot on
CONFIG_HIGHMEM powerpc, which is a lot of them...

Ben.

>
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/kernel/setup.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c
> --- linux-2.6.18-git19-clean/arch/i386/kernel/setup.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c 2006-10-03 11:15:59.000000000 +0100
> @@ -1083,16 +1083,15 @@ static unsigned long __init setup_memory
>
> void __init zone_sizes_init(void)
> {
> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> + max_zone_pfns[ZONE_DMA] =
> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> #ifdef CONFIG_HIGHMEM
> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> - max_low_pfn,
> - highend_pfn};
> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
> add_active_range(0, 0, highend_pfn);
> #else
> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> - max_low_pfn};
> add_active_range(0, 0, max_low_pfn);
> #endif
>
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c
> --- linux-2.6.18-git19-clean/arch/i386/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c 2006-10-03 11:17:27.000000000 +0100
> @@ -357,11 +357,12 @@ void __init numa_kva_reserve(void)
> void __init zone_sizes_init(void)
> {
> int nid;
> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> - max_low_pfn,
> - highend_pfn
> - };
> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> + max_zone_pfns[ZONE_DMA] =
> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
>
> /* If SRAT has not registered memory, register it now */
> if (find_max_pfn_with_active_regions() == 0) {
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/contig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c
> --- linux-2.6.18-git19-clean/arch/ia64/mm/contig.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c 2006-10-03 11:21:09.000000000 +0100
> @@ -233,6 +233,7 @@ paging_init (void)
> efi_memmap_walk(count_pages, &num_physpages);
>
> max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> max_zone_pfns[ZONE_DMA] = max_dma;
> max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c
> --- linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c 2006-10-03 11:21:54.000000000 +0100
> @@ -709,6 +709,7 @@ void __init paging_init(void)
> max_pfn = mem_data[node].max_pfn;
> }
>
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> max_zone_pfns[ZONE_DMA] = max_dma;
> max_zone_pfns[ZONE_NORMAL] = max_pfn;
> free_area_init_nodes(max_zone_pfns);
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c
> --- linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c 2006-10-03 11:10:57.000000000 +0100
> @@ -307,11 +307,12 @@ void __init paging_init(void)
> top_of_ram, total_ram);
> printk(KERN_DEBUG "Memory hole size: %ldMB\n",
> (top_of_ram - total_ram) >> 20);
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> #ifdef CONFIG_HIGHMEM
> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
> - max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
> #else
> - max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
> #endif
> free_area_init_nodes(max_zone_pfns);
> }
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c
> --- linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c 2006-10-03 11:12:01.000000000 +0100
> @@ -617,9 +617,9 @@ void __init do_init_bootmem(void)
>
> void __init paging_init(void)
> {
> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> - lmb_end_of_DRAM() >> PAGE_SHIFT
> - };
> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> + max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT;
> free_area_init_nodes(max_zone_pfns);
> }
>
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ppc/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c
> --- linux-2.6.18-git19-clean/arch/ppc/mm/init.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c 2006-10-03 11:13:46.000000000 +0100
> @@ -374,11 +374,12 @@ void __init paging_init(void)
> end_pfn = start_pfn + (total_memory >> PAGE_SHIFT);
> add_active_range(0, start_pfn, end_pfn);
>
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> #ifdef CONFIG_HIGHMEM
> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
> - max_zone_pfns[1] = total_memory >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_HIGHMEM] = total_memory >> PAGE_SHIFT;
> #else
> - max_zone_pfns[0] = total_memory >> PAGE_SHIFT;
> + max_zone_pfns[ZONE_DMA] = total_memory >> PAGE_SHIFT;
> #endif /* CONFIG_HIGHMEM */
> free_area_init_nodes(max_zone_pfns);
> }
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c
> --- linux-2.6.18-git19-clean/arch/x86_64/mm/init.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c 2006-10-03 11:18:54.000000000 +0100
> @@ -406,9 +406,12 @@ void __cpuinit zap_low_mappings(int cpu)
> #ifndef CONFIG_NUMA
> void __init paging_init(void)
> {
> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
> - MAX_DMA32_PFN,
> - end_pfn};
> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> + max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
> + max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
> + max_zone_pfns[ZONE_NORMAL] = end_pfn;
> +
> memory_present(0, 0, end_pfn);
> sparse_init();
> free_area_init_nodes(max_zone_pfns);
> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c
> --- linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c 2006-10-03 11:19:47.000000000 +0100
> @@ -338,9 +338,11 @@ static void __init arch_sparse_init(void
> void __init paging_init(void)
> {
> int i;
> - unsigned long max_zone_pfns[MAX_NR_ZONES] = { MAX_DMA_PFN,
> - MAX_DMA32_PFN,
> - end_pfn};
> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> + max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
> + max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
> + max_zone_pfns[ZONE_NORMAL] = end_pfn;
>
> arch_sparse_init();
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2006-10-04 14:12:16

by Mel Gorman

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

On Wed, 4 Oct 2006, Benjamin Herrenschmidt wrote:

>
> Patch looks good on a quick look. I will try to test later today at
> which point, it should go in asap, current upstream doesn't boot on
> CONFIG_HIGHMEM powerpc, which is a lot of them...
>

The patch has passed tests here on x86, x86_64, ia64 and ppc64. Testing on
powerpc with HIGHMEM is a configuration I cannot test. If you say it
passes, I'll see can I get it pushed before 2.6.19-rc1

Thanks

>>
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/kernel/setup.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c
>> --- linux-2.6.18-git19-clean/arch/i386/kernel/setup.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c 2006-10-03 11:15:59.000000000 +0100
>> @@ -1083,16 +1083,15 @@ static unsigned long __init setup_memory
>>
>> void __init zone_sizes_init(void)
>> {
>> + unsigned long max_zone_pfns[MAX_NR_ZONES];
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> + max_zone_pfns[ZONE_DMA] =
>> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>> #ifdef CONFIG_HIGHMEM
>> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
>> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
>> - max_low_pfn,
>> - highend_pfn};
>> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
>> add_active_range(0, 0, highend_pfn);
>> #else
>> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
>> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
>> - max_low_pfn};
>> add_active_range(0, 0, max_low_pfn);
>> #endif
>>
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c
>> --- linux-2.6.18-git19-clean/arch/i386/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c 2006-10-03 11:17:27.000000000 +0100
>> @@ -357,11 +357,12 @@ void __init numa_kva_reserve(void)
>> void __init zone_sizes_init(void)
>> {
>> int nid;
>> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
>> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
>> - max_low_pfn,
>> - highend_pfn
>> - };
>> + unsigned long max_zone_pfns[MAX_NR_ZONES];
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> + max_zone_pfns[ZONE_DMA] =
>> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
>>
>> /* If SRAT has not registered memory, register it now */
>> if (find_max_pfn_with_active_regions() == 0) {
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/contig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c
>> --- linux-2.6.18-git19-clean/arch/ia64/mm/contig.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c 2006-10-03 11:21:09.000000000 +0100
>> @@ -233,6 +233,7 @@ paging_init (void)
>> efi_memmap_walk(count_pages, &num_physpages);
>>
>> max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> max_zone_pfns[ZONE_DMA] = max_dma;
>> max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>>
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c
>> --- linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c 2006-10-03 11:21:54.000000000 +0100
>> @@ -709,6 +709,7 @@ void __init paging_init(void)
>> max_pfn = mem_data[node].max_pfn;
>> }
>>
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> max_zone_pfns[ZONE_DMA] = max_dma;
>> max_zone_pfns[ZONE_NORMAL] = max_pfn;
>> free_area_init_nodes(max_zone_pfns);
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c
>> --- linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c 2006-10-03 11:10:57.000000000 +0100
>> @@ -307,11 +307,12 @@ void __init paging_init(void)
>> top_of_ram, total_ram);
>> printk(KERN_DEBUG "Memory hole size: %ldMB\n",
>> (top_of_ram - total_ram) >> 20);
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> #ifdef CONFIG_HIGHMEM
>> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
>> - max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
>> #else
>> - max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
>> #endif
>> free_area_init_nodes(max_zone_pfns);
>> }
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c
>> --- linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c 2006-10-03 11:12:01.000000000 +0100
>> @@ -617,9 +617,9 @@ void __init do_init_bootmem(void)
>>
>> void __init paging_init(void)
>> {
>> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
>> - lmb_end_of_DRAM() >> PAGE_SHIFT
>> - };
>> + unsigned long max_zone_pfns[MAX_NR_ZONES];
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> + max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT;
>> free_area_init_nodes(max_zone_pfns);
>> }
>>
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ppc/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c
>> --- linux-2.6.18-git19-clean/arch/ppc/mm/init.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c 2006-10-03 11:13:46.000000000 +0100
>> @@ -374,11 +374,12 @@ void __init paging_init(void)
>> end_pfn = start_pfn + (total_memory >> PAGE_SHIFT);
>> add_active_range(0, start_pfn, end_pfn);
>>
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> #ifdef CONFIG_HIGHMEM
>> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
>> - max_zone_pfns[1] = total_memory >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_HIGHMEM] = total_memory >> PAGE_SHIFT;
>> #else
>> - max_zone_pfns[0] = total_memory >> PAGE_SHIFT;
>> + max_zone_pfns[ZONE_DMA] = total_memory >> PAGE_SHIFT;
>> #endif /* CONFIG_HIGHMEM */
>> free_area_init_nodes(max_zone_pfns);
>> }
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c
>> --- linux-2.6.18-git19-clean/arch/x86_64/mm/init.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c 2006-10-03 11:18:54.000000000 +0100
>> @@ -406,9 +406,12 @@ void __cpuinit zap_low_mappings(int cpu)
>> #ifndef CONFIG_NUMA
>> void __init paging_init(void)
>> {
>> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
>> - MAX_DMA32_PFN,
>> - end_pfn};
>> + unsigned long max_zone_pfns[MAX_NR_ZONES];
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> + max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
>> + max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
>> + max_zone_pfns[ZONE_NORMAL] = end_pfn;
>> +
>> memory_present(0, 0, end_pfn);
>> sparse_init();
>> free_area_init_nodes(max_zone_pfns);
>> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c
>> --- linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
>> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c 2006-10-03 11:19:47.000000000 +0100
>> @@ -338,9 +338,11 @@ static void __init arch_sparse_init(void
>> void __init paging_init(void)
>> {
>> int i;
>> - unsigned long max_zone_pfns[MAX_NR_ZONES] = { MAX_DMA_PFN,
>> - MAX_DMA32_PFN,
>> - end_pfn};
>> + unsigned long max_zone_pfns[MAX_NR_ZONES];
>> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>> + max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
>> + max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
>> + max_zone_pfns[ZONE_NORMAL] = end_pfn;
>>
>> arch_sparse_init();
>>

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab

2006-10-05 09:10:14

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

On Wed, 2006-10-04 at 15:12 +0100, Mel Gorman wrote:
> On Wed, 4 Oct 2006, Benjamin Herrenschmidt wrote:
>
> >
> > Patch looks good on a quick look. I will try to test later today at
> > which point, it should go in asap, current upstream doesn't boot on
> > CONFIG_HIGHMEM powerpc, which is a lot of them...
> >
>
> The patch has passed tests here on x86, x86_64, ia64 and ppc64. Testing on
> powerpc with HIGHMEM is a configuration I cannot test. If you say it
> passes, I'll see can I get it pushed before 2.6.19-rc1

Too late for rc1 :( I'll ask Johannes to test as I don't have access to
the box atm.

Thanks.
Ben.

> Thanks
>
> >>
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/kernel/setup.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c
> >> --- linux-2.6.18-git19-clean/arch/i386/kernel/setup.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c 2006-10-03 11:15:59.000000000 +0100
> >> @@ -1083,16 +1083,15 @@ static unsigned long __init setup_memory
> >>
> >> void __init zone_sizes_init(void)
> >> {
> >> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> + max_zone_pfns[ZONE_DMA] =
> >> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> >> #ifdef CONFIG_HIGHMEM
> >> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> >> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> >> - max_low_pfn,
> >> - highend_pfn};
> >> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
> >> add_active_range(0, 0, highend_pfn);
> >> #else
> >> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> >> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> >> - max_low_pfn};
> >> add_active_range(0, 0, max_low_pfn);
> >> #endif
> >>
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c
> >> --- linux-2.6.18-git19-clean/arch/i386/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c 2006-10-03 11:17:27.000000000 +0100
> >> @@ -357,11 +357,12 @@ void __init numa_kva_reserve(void)
> >> void __init zone_sizes_init(void)
> >> {
> >> int nid;
> >> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> >> - virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
> >> - max_low_pfn,
> >> - highend_pfn
> >> - };
> >> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> + max_zone_pfns[ZONE_DMA] =
> >> + virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> >> + max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
> >>
> >> /* If SRAT has not registered memory, register it now */
> >> if (find_max_pfn_with_active_regions() == 0) {
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/contig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c
> >> --- linux-2.6.18-git19-clean/arch/ia64/mm/contig.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c 2006-10-03 11:21:09.000000000 +0100
> >> @@ -233,6 +233,7 @@ paging_init (void)
> >> efi_memmap_walk(count_pages, &num_physpages);
> >>
> >> max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> max_zone_pfns[ZONE_DMA] = max_dma;
> >> max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> >>
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c
> >> --- linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c 2006-10-03 11:21:54.000000000 +0100
> >> @@ -709,6 +709,7 @@ void __init paging_init(void)
> >> max_pfn = mem_data[node].max_pfn;
> >> }
> >>
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> max_zone_pfns[ZONE_DMA] = max_dma;
> >> max_zone_pfns[ZONE_NORMAL] = max_pfn;
> >> free_area_init_nodes(max_zone_pfns);
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c
> >> --- linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c 2006-10-03 11:10:57.000000000 +0100
> >> @@ -307,11 +307,12 @@ void __init paging_init(void)
> >> top_of_ram, total_ram);
> >> printk(KERN_DEBUG "Memory hole size: %ldMB\n",
> >> (top_of_ram - total_ram) >> 20);
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> #ifdef CONFIG_HIGHMEM
> >> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
> >> - max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
> >> #else
> >> - max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
> >> #endif
> >> free_area_init_nodes(max_zone_pfns);
> >> }
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c
> >> --- linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c 2006-10-03 11:12:01.000000000 +0100
> >> @@ -617,9 +617,9 @@ void __init do_init_bootmem(void)
> >>
> >> void __init paging_init(void)
> >> {
> >> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {
> >> - lmb_end_of_DRAM() >> PAGE_SHIFT
> >> - };
> >> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> + max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT;
> >> free_area_init_nodes(max_zone_pfns);
> >> }
> >>
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ppc/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c
> >> --- linux-2.6.18-git19-clean/arch/ppc/mm/init.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c 2006-10-03 11:13:46.000000000 +0100
> >> @@ -374,11 +374,12 @@ void __init paging_init(void)
> >> end_pfn = start_pfn + (total_memory >> PAGE_SHIFT);
> >> add_active_range(0, start_pfn, end_pfn);
> >>
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> #ifdef CONFIG_HIGHMEM
> >> - max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
> >> - max_zone_pfns[1] = total_memory >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_HIGHMEM] = total_memory >> PAGE_SHIFT;
> >> #else
> >> - max_zone_pfns[0] = total_memory >> PAGE_SHIFT;
> >> + max_zone_pfns[ZONE_DMA] = total_memory >> PAGE_SHIFT;
> >> #endif /* CONFIG_HIGHMEM */
> >> free_area_init_nodes(max_zone_pfns);
> >> }
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c
> >> --- linux-2.6.18-git19-clean/arch/x86_64/mm/init.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c 2006-10-03 11:18:54.000000000 +0100
> >> @@ -406,9 +406,12 @@ void __cpuinit zap_low_mappings(int cpu)
> >> #ifndef CONFIG_NUMA
> >> void __init paging_init(void)
> >> {
> >> - unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
> >> - MAX_DMA32_PFN,
> >> - end_pfn};
> >> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> + max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
> >> + max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
> >> + max_zone_pfns[ZONE_NORMAL] = end_pfn;
> >> +
> >> memory_present(0, 0, end_pfn);
> >> sparse_init();
> >> free_area_init_nodes(max_zone_pfns);
> >> diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c
> >> --- linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
> >> +++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c 2006-10-03 11:19:47.000000000 +0100
> >> @@ -338,9 +338,11 @@ static void __init arch_sparse_init(void
> >> void __init paging_init(void)
> >> {
> >> int i;
> >> - unsigned long max_zone_pfns[MAX_NR_ZONES] = { MAX_DMA_PFN,
> >> - MAX_DMA32_PFN,
> >> - end_pfn};
> >> + unsigned long max_zone_pfns[MAX_NR_ZONES];
> >> + memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
> >> + max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
> >> + max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
> >> + max_zone_pfns[ZONE_NORMAL] = end_pfn;
> >>
> >> arch_sparse_init();
> >>
>

2006-10-09 23:25:26

by Paul Mackerras

[permalink] [raw]
Subject: Re: 2.6.18-rc6-mm2: fix for error compiling ppc/mm/init.c

Mel Gorman writes:

> The patch has passed tests here on x86, x86_64, ia64 and ppc64. Testing on
> powerpc with HIGHMEM is a configuration I cannot test. If you say it
> passes, I'll see can I get it pushed before 2.6.19-rc1

Seems fine on my powerbook with 1G of RAM, with 768M lowmem and 256M
highmem.

Paul.