Changeset 4e147a6 in mainline


Ignore:
Timestamp:
2006-02-02T01:51:25Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ea8a7ca
Parents:
b5e0bb8
Message:

Skeleton of SLAB allocator.

Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rb5e0bb8 r4e147a6  
    116116        generic/src/mm/tlb.c \
    117117        generic/src/mm/as.c \
     118        generic/src/mm/slab.c \
    118119        generic/src/lib/func.c \
    119120        generic/src/lib/list.c \
  • generic/include/mm/frame.h

    rb5e0bb8 r4e147a6  
    3636#include <synch/spinlock.h>
    3737#include <mm/buddy.h>
     38#include <mm/slab.h>
    3839
    3940#define ONE_FRAME       0
     
    4142#define FRAME_KA                1       /* skip frames conflicting with user address space */
    4243#define FRAME_PANIC             2       /* panic on failure */
    43 #define FRAME_NON_BLOCKING      4       /* do not panic and do not sleep on failure */
     44#define FRAME_ATOMIC            4       /* do not panic and do not sleep on failure */
    4445
    4546#define FRAME_OK                0       /* frame_alloc return status */
     
    7879        __u8 buddy_order;       /**< buddy system block order */
    7980        link_t buddy_link;      /**< link to the next free block inside one order */
     81        slab_slab_t *slab;      /**< If allocated by slab, this points there */
    8082};
    8183
  • generic/src/console/cmd.c

    rb5e0bb8 r4e147a6  
    5151#include <mm/frame.h>
    5252#include <main/version.h>
     53#include <mm/slab.h>
    5354
    5455/** Data and methods for 'help' command. */
     
    244245
    245246
     247static int cmd_slabs(cmd_arg_t *argv);
     248static cmd_info_t slabs_info = {
     249        .name = "slabs",
     250        .description = "List SLAB caches.",
     251        .func = cmd_slabs,
     252        .argc = 0
     253};
     254
    246255/** Data and methods for 'zones' command */
    247256static int cmd_zones(cmd_arg_t *argv);
     
    353362        if (!cmd_register(&zones_info))
    354363                panic("could not register command %s\n", zones_info.name);
     364
     365        cmd_initialize(&slabs_info);
     366        if (!cmd_register(&slabs_info))
     367                panic("could not register command %s\n", slabs_info.name);
    355368
    356369        cmd_initialize(&zone_info);
     
    604617}
    605618
     619/** Command for listings SLAB caches
     620 *
     621 * @param argv Ignores
     622 *
     623 * @return Always 1
     624 */
     625int cmd_slabs(cmd_arg_t * argv) {
     626        slab_print_list();
     627        return 1;
     628}
     629
    606630/** Command for listing memory zones
    607631 *
  • generic/src/main/main.c

    rb5e0bb8 r4e147a6  
    5050#include <mm/tlb.h>
    5151#include <mm/as.h>
     52#include <mm/slab.h>
    5253#include <synch/waitq.h>
    5354#include <arch/arch.h>
     
    163164        page_init();
    164165        tlb_init();
     166        slab_cache_init();
    165167        arch_post_mm_init();
    166168
  • generic/src/mm/frame.c

    rb5e0bb8 r4e147a6  
    124124                interrupts_restore(ipl);
    125125
    126                 if (flags & FRAME_NON_BLOCKING) {
     126                if (flags & FRAME_ATOMIC) {
    127127                        ASSERT(status != NULL);
    128128                        *status = FRAME_NO_MEMORY;
     
    158158                v = PA2KA(v);
    159159       
    160         if (flags & FRAME_NON_BLOCKING) {
     160        if (flags & FRAME_ATOMIC) {
    161161                ASSERT(status != NULL);
    162162                *status = FRAME_OK;
  • kernel.config

    rb5e0bb8 r4e147a6  
    8181@ "mm/falloc1" Frame Allocation test 1
    8282@ "mm/falloc2" Frame Allocation test 2
     83@ "mm/slab1" SLAB Allocator test 1
    8384@ [ARCH=mips32] "debug/mips1" Mips breakpoint-debug test
    8485! CONFIG_TEST (choice)
  • test/mm/falloc1/test.c

    rb5e0bb8 r4e147a6  
    5656                        allocated = 0;
    5757                        for (i = 0; i < MAX_FRAMES >> order; i++) {
    58                                 frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA, order, &status);
     58                                frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status);
    5959                               
    6060                                if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
  • test/mm/falloc2/test.c

    rb5e0bb8 r4e147a6  
    6464                        allocated = 0;
    6565                        for (i = 0; i < (MAX_FRAMES >> order); i++) {
    66                                 frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA, order, &status);
     66                                frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status);
    6767                                if (status == 0) {
    6868                                        memsetb(frames[allocated], FRAME_SIZE << order, val);
Note: See TracChangeset for help on using the changeset viewer.