Re: [PATCH] m68k: move to a single instance of free_initmem()

Greg Ungerer <[email protected]>
Newsgroups gmane.linux.uclinux.devel,gmane.linux.ports.m68k
Message-ID <[email protected]>
Hi Geert,

On 11/11/12 20:43, Geert Uytterhoeven wrote:
> On Tue, Oct 23, 2012 at 5:40 AM,  <[email protected]> wrote:
[snip]
>>   void free_initmem(void)
>>   {
>> -#ifdef CONFIG_RAMKERNEL
>> +#ifndef CONFIG_MMU_SUN3
>>          unsigned long addr;
>>
>> -       /*
>> -        * The following code should be cool even if these sections
>> -        * are not page aligned.
>> -        */
>> -       addr = PAGE_ALIGN((unsigned long) __init_begin);
>> -       /* next to check that the page we free is not a partial page */
>> -       for (; addr + PAGE_SIZE < ((unsigned long) __init_end); addr += PAGE_SIZE) {
>> +       addr = (unsigned long) __init_begin;
>> +       for (; addr < ((unsigned long) __init_end); addr += PAGE_SIZE) {
>>                  ClearPageReserved(virt_to_page(addr));
>>                  init_page_count(virt_to_page(addr));
>>                  free_page(addr);
>>                  totalram_pages++;
>>          }
>>          pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
>> -               (addr - PAGE_ALIGN((unsigned long) __init_begin)) >> 10,
>> -               (int)(PAGE_ALIGN((unsigned long) __init_begin)),
>> -               (int)(addr - PAGE_SIZE));
>> -#endif
>> +               (addr - (unsigned long) __init_begin) >> 10,
>> +               (unsigned int) __init_begin, (unsigned int) __init_end);
>
> Which is now BTW almost identical to free_initrd_mem(), so the common
> parts can be extracted in a helper function.

Indeed it can. Well spotted :-)

Patch coming up.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.