Skip to content
  • Charlie Jacobsen's avatar
    Linux slab allocator and page allocator inside LCDs. · 35ed57d7
    Charlie Jacobsen authored and Vikram Narayanan's avatar Vikram Narayanan committed
    Single threaded, no locks, no fancy NUMA/percpu.
    
    Passing some simple examples. Added a memory management
    example module, in test-mods/mm, that exercises a lot
    of this new code.
    
    1:
    
    I moved in and adapted our existing guest virtual
    paging code from kliblcd.c. I'm using statically
    allocated bitmaps and arrays for tracking allocations
    in the guest virtual and physical address spaces.
    Using identity mapping for ease. (I decided not to
    use Linux's page allocator since it's too intertwined
    with the boot process - percpu variables, freeing
    init mem, boot allocator, all kinds of complexity ...)
    It might not be too hard to reimplement the buddy
    allocator algorithms, since I had to include a
    statically allocated array of struct pages anyway.
    
    I've set aside about 16 MBs for dynamic page allocations,
    but this can be changed using macros. You can allocate
    1, 2, 4, 8, etc. pages at a time. (The slab allocator
    requires this.)
    
    2:
    
    I finally broke down and set up boot info pages - 4
    boot pages right now, can be adjusted with a macro.
    Whoever boots the lcd needs to pack in information about the
    lcd's address space, initial cspace, and so on. 4 pages
    is enough to pack in information for larger modules
    like the mm example.
    
    3:
    
    I moved liblcd to a separate directory, and hacked the
    build system so that we can build liblcd as a static
    library and link it with example modules.
    
    liblcd/ contains lcd/, which has code for interacting
    with the microkernel and my simple page allocator.
    
    The Linux slab allocator is inside mm/, and some
    needed dependencies are in lib/. I made very few
    changes to the source code itself, but used some
    preprocessor/compiler hacks to make everything work. See
    Documentation/lcd-domains/liblcd.txt. I elided all of
    the locking and made it single core, single NUMA node.
    It's possible we'll see some bigs in the future, in code I haven't
    excerised yet (will probably manifest themselves as
    page faults).
    
    Ideally, we should have a separate tree for liblcd
    and building modules. That way we can avoid some of these
    hacks (maybe not all).
    
    4:
    
    Updated a lot of the documentation in
    Documentation/lcd-domains/.
    35ed57d7