mohan kumar wrote: > > Hi, > If you remember, i started with some linux MM > documentation. Well, i was kinda busy and could not > continue. now iam free and am continuing the work. As > a start i have converted the existing docs into latex > and made them available at > http://mmdoc.sourceforge.net > For the documentation i need some clarification and if > possible please say weather iam correct when i say > these things. > > 1. The memory in linux is maintained as pages of 4k. Depending on the architecture. On x86, pages are 4k; on Pentium the kernel memory map uses 4M pages but all normal VM activity uses 4k pages; on Alpha pages are 8k. > 2. The linux memory is split into various zones (link > from riks "zone based allocator" doc). Yes. > 3. The buddy allocator is the main memory allocator > that serves ...physical... > memory pages. The buddy system keeps in > mind about the various zones. This means that the > buddy allocator is a zoned buddy allocator. Yes. > 4. The slab allocator is used to allocate memory > inside the kernel. kmalloc, kfree. Memory got by this > allocator is physicaly contigoues. The slab allocator is an "object oriented" allocator. It allows one to build in-memory caches of memory objects with destructors and constructors; so there are different kinds of slabs for different kinds of objects. Slabs are built on top of physical pages allocated by the buddy allocator. > 5. The vmalloc alloctor (ok no such thing as a vmalloc > allocator but it helps to understand) allocates > non-contiguoues kernel memory. And maps it contiguously into kernel VM. The pages that it maps, it gets from the buddy allocator. > 6. user-space memory is allocated usong the sys_brk() > which in-turn uses the slab allocator. No. There are lots of ways user-space memory can be allocated, but none of them involve physical memory allocation. The kernel just manipulates the mm_structs of the user process, so that when a page fault occurs on the newly "allocated" space, the kernel can service the fault with an appropriate page. So all user-space memory allocation is really handled by the VM layer, which gets individual pages directly from the buddy allocator (or possibly by reclaiming pages from the LRU). The slab allocator is for internal use by kernel subsystems only; the VM layer does not use it to get user pages. Cheers, -- Joe "I'd rather chew my leg off than maintain Java code, which sucks, 'cause I have a lot of Java code to maintain and the leg surgery is starting to get expensive." - Me -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/