Who is 'Freeing init memory ...'

Woody Wu narkewoody at gmail.com
Thu Aug 15 05:40:39 EDT 2013


On Thu, Aug 15, 2013 at 05:29:05PM +0800, bill4carson wrote:
> 
> 
> On 2013年08月15日 16:51, Woody Wu wrote:
> >On Thu, Aug 15, 2013 at 10:41:39AM +0200, Belisko Marek wrote:
> >>Hi,
> >>
> >>On Thu, Aug 15, 2013 at 10:08 AM, Woody Wu<narkewoody at gmail.com>  wrote:
> >>>Hi,
> >>>
> >>>Near the end of kernel startup, there is a message 'Freeing init memory
> >>>..'. This process on embedded system takes several seconds. After
> >>>searched kernel source, however, I cannot find the same literal text in
> >>>all the .c files.
> >>rgrep 'Freeing' . on kernell source give me a lot of output. I believe
> >>you're looking on arm for that one:
> >>arch/arm/mm/init.c:             printk(KERN_INFO "Freeing %s memory:
> >>%dK\n", s, size);
> >
> >Yes, thank you very much!  Now I want to disable the 'Freeing' behavior
> >to reduce boot time, is there a kernel config or cmdline option? I am
> >not sure if I can disable CONFIG_HIGHMEM to archive this purpose.
> 
> 
> Why not bother to read the code?
> 
> 712 void free_initmem(void)
> 713 {
> 714 #ifdef CONFIG_HAVE_TCM
> 715         extern char __tcm_start, __tcm_end;
> 716
> 717         totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
> 718                                     __phys_to_pfn(__pa(&__tcm_end)),
> 719                                     "TCM link");
> 720 #endif
> 721
> 722         if (!machine_is_integrator() && !machine_is_cintegrator())
> 723                 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
> 724                                             __phys_to_pfn(__pa(__init_end)),
> 725                                             "init");
> 726 }
> 727
> 
> 
> 
> 478 static inline int free_area(unsigned long pfn, unsigned long end, char *s)
> 479 {
> 480         unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
> 481
> 482         for (; pfn < end; pfn++) {
> 483                 struct page *page = pfn_to_page(pfn);
> 484                 ClearPageReserved(page);
> 485                 init_page_count(page);
> 486                 __free_page(page);
> 487                 pages++;
> 488         }
> 489
> 490         if (size && s)
> 491                 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Does this really mean operations before the "Freeing init memory" cause the delay????
> You want to bypass "Now I want to disable the 'Freeing' behavior", are you kidding?
> 

I also quickly go through the code, also found that the message was
printed after the freeing job was done. At that moment I did not think
too carefully, just wanted to disable the 'freeing' procedure then see
what will happen.  Yes, you are right, delay should caused by things
afterwards. I will check that with printk timing.  See you & thanks!


> Please select printk timing the kernel hacking to find out where the delay actually lies.
> 
> 
> 
> >>So, I want to know, who was printing this message and
> >>>how can I disable the behavior to save some boot time since I don't care
> >>>losting of several hundreds kilo bytes of memory.
> >>>
> >>>Thanks in advance.
> >>>woody
> >>>
> >>>--
> >>>I can't go back to yesterday - because I was a different person then
> >>>
> >>>_______________________________________________
> >>>Kernelnewbies mailing list
> >>>Kernelnewbies at kernelnewbies.org
> >>>http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >>
> >>Cheers,
> >>
> >>marek
> >>
> >>--
> >>as simple and primitive as possible
> >>-------------------------------------------------
> >>Marek Belisko - OPEN-NANDRA
> >>Freelance Developer
> >>
> >>Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
> >>Tel: +421 915 052 184
> >>skype: marekwhite
> >>twitter: #opennandra
> >>web: http://open-nandra.com
> >
> 
> -- 
> 八百里秦川尘土飞扬,三千万老陕齐吼秦腔。
> 
> --bill

-- 
I can't go back to yesterday - because I was a different person then



More information about the Kernelnewbies mailing list