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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

On 11/11/12 20:43, Geert Uytterhoeven wrote:
On Tue, Oct 23, 2012 at 5:40 AM,  <gerg@xxxxxxxxxxxx> 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:     gerg@xxxxxxxxxxxx
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
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux