All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Why does mem_init call map_cb twice?
@ 2007-12-14 17:31 John Reiser
  2007-12-14 19:34 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: John Reiser @ 2007-12-14 17:31 UTC (permalink / raw)
  To: uml-devel

In arch/um/kernel/mem.c, mem_init calls map_cb twice:
once directly and once indirectly via initial_thread_cb.  Why?

-----
void mem_init(void)
{
        /* clear the zero-page */
        memset((void *) empty_zero_page, 0, PAGE_SIZE);

        /* Map in the area just after the brk now that kmalloc is about
         * to be turned on.
         */
        brk_end = (unsigned long) UML_ROUND_UP(sbrk(0));
        map_cb(NULL);
        initial_thread_cb(map_cb, NULL);
-----

-- 
John Reiser, jreiser@BitWagon.com

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [uml-devel] Why does mem_init call map_cb twice?
  2007-12-14 17:31 [uml-devel] Why does mem_init call map_cb twice? John Reiser
@ 2007-12-14 19:34 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2007-12-14 19:34 UTC (permalink / raw)
  To: John Reiser; +Cc: uml-devel

On Fri, Dec 14, 2007 at 09:31:27AM -0800, John Reiser wrote:
> In arch/um/kernel/mem.c, mem_init calls map_cb twice:
> once directly and once indirectly via initial_thread_cb.  Why?
> 
> -----
> void mem_init(void)
> {
>         /* clear the zero-page */
>         memset((void *) empty_zero_page, 0, PAGE_SIZE);
> 
>         /* Map in the area just after the brk now that kmalloc is about
>          * to be turned on.
>          */
>         brk_end = (unsigned long) UML_ROUND_UP(sbrk(0));
>         map_cb(NULL);
>         initial_thread_cb(map_cb, NULL);
> -----

It's a bug.  That's left over from the tt mode days, when the kernel
ran in the same address spaces as its processes and there was a
separate thread ptracing everything.  The tracing thread address space
needed to be kept in sync with the others, and this was one part of
that.

				Jeff

-- 
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-14 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 17:31 [uml-devel] Why does mem_init call map_cb twice? John Reiser
2007-12-14 19:34 ` Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.