Changeset 086a600 in mainline for test/mm/slab2/test.c


Ignore:
Timestamp:
2006-02-02T23:54:42Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fb10289b
Parents:
4a5b2b0e
Message:

Debugged slab allocator. It currently supports per-CPU cache on 1 cpu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mm/slab2/test.c

    r4a5b2b0e r086a600  
    3434#include <panic.h>
    3535#include <mm/frame.h>
     36#include <memstr.h>
    3637
    3738#define ITEM_SIZE 256
     
    6566                        break;
    6667                }
    67 
     68                memsetb((__address)data1, ITEM_SIZE, 0);
     69                memsetb((__address)data2, ITEM_SIZE, 0);
    6870                *((void **)data1) = olddata1;
    6971                *((void **)data2) = olddata2;
     
    8991                        panic("Incorrect memory size - use another test.");
    9092                }
     93                memsetb((__address)data1, ITEM_SIZE, 0);
    9194                *((void **)data1) = olddata1;
    9295                olddata1 = data1;
     
    98101                        break;
    99102                }
     103                memsetb((__address)data1, ITEM_SIZE, 0);
    100104                *((void **)data1) = olddata1;
    101105                olddata1 = data1;
    102106        }
    103107        slab_print_list();
    104        
     108        printf("Deallocating cache1...");
     109        while (olddata1) {
     110                data1 = *((void **)olddata1);
     111                slab_free(cache1, olddata1);
     112                olddata1 = data1;
     113        }
     114        printf("done.\n");
     115        slab_print_list();
     116        slab_cache_destroy(cache1);
     117        slab_cache_destroy(cache2);
    105118}
    106119
    107120void test(void)
    108121{
     122        printf("Running reclaim test .. pass1\n");
    109123        totalmemtest();
     124        printf("Running reclaim test .. pass2\n");
     125        totalmemtest();
     126        printf("Reclaim test OK.\n");
    110127}
Note: See TracChangeset for help on using the changeset viewer.