pagecoloring: kernel 2.2 mm question: what is happening during fork ?

From: Cabaniols, Sebastien (Sebastien.Cabaniols@Compaq.com)
Date: Tue Jan 29 2002 - 08:36:24 EST


Hello lkml,

I have a few questions about memory management:

When I do a fork, which part of the kernel is allocating the memory for
the childs, where and when the memory copy takes place ? I know that
linux is doing copy on write but I don't know which part of the kernel
is really doing the page allocation when the copy on write understands
that the process really wants to write now. Then the second question is
how is the memory copy done ?

The third and last question is what is the role of the slab allocator ?
When does a process asks for memory from a slab ? Is it used to build
the stack the heap ?

I have looked many web pages but none of them were clear to me.

If you have time, my whole problem is described here:

More context:
-------------

I am currently working to add page coloring into the linux kernel
version 2.2.19 (I am using Alpha with big direct mapped L1 so
page coloring is really necessary to have good stable perfs)

I started from a patch found on the web and it basically just
rewrapps some get_free_page calls to a get_free_page_by_address
routine that checks the virtual address and looks for a page which
is correctly aligned.

To sumup:

All calls to get_free_page in filemap.c have been replaced by
get_free_page_by_address
In memory.c the do_anonymous contains a get_free_page replaced by a
get_free_page_by_address

The patch is really doing nice job on simple cases (fortran monothread
code) but it fails on the following code:

{
        char* a;
        int i,n=0;

        while(1)
        {
        
          a=malloc(sizeof(char)*1024*8*10); /*reserve ten pages (8k*10)
*/
 
          for(i=0;i<81920;i++)
                {
                  a[i]=i*n;
                }

          sleep (1<<n);
          n++;
          fork();

        }
}

It simply fails because the page_coloring_code is bypassed when doing
forks... but
I could not find which part of the linux kernel code is doing the memory
allocations
for the forked processes.

thanks for any help

Sebastien

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jan 31 2002 - 21:01:02 EST