Changeset 0773396 in mainline for kernel/test/mm/falloc1.c


Ignore:
Timestamp:
2013-12-25T13:05:25Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bc54126c
Parents:
f4a47e52 (diff), 6946f23 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/mm/falloc1.c

    rf4a47e52 r0773396  
    3737#include <align.h>
    3838
    39 #define MAX_FRAMES  1024U
     39#define MAX_FRAMES  1024
    4040#define MAX_ORDER   8
    4141#define TEST_RUNS   2
     
    5151                return "Unable to allocate frames";
    5252       
    53         unsigned int results[MAX_ORDER + 1];
     53        unsigned int results[MAX_FRAMES + 1];
     54       
    5455        for (unsigned int run = 0; run < TEST_RUNS; run++) {
    55                 for (unsigned int order = 0; order <= MAX_ORDER; order++) {
    56                         TPRINTF("Allocating %u frames blocks ... ", 1 << order);
     56                for (size_t count = 1; count <= MAX_FRAMES; count++) {
     57                        size_t bytes = FRAMES2SIZE(count);
     58                       
     59                        TPRINTF("Allocating %zu frames blocks (%zu bytes) ... ",
     60                            count, bytes);
    5761                       
    5862                        unsigned int allocated = 0;
    59                         for (unsigned int i = 0; i < (MAX_FRAMES >> order); i++) {
    60                                 frames[allocated] = (uintptr_t)
    61                                     frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
    62                                
    63                                 if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) !=
    64                                     frames[allocated]) {
    65                                         TPRINTF("Block at address %p (size %u) is not aligned\n",
    66                                             (void *) frames[allocated], (FRAME_SIZE << order) >> 10);
    67                                         return "Test failed";
    68                                 }
    69                                
    70                                 if (frames[allocated])
     63                        for (unsigned int i = 0; i < (MAX_FRAMES / count); i++) {
     64                                frames[allocated] = frame_alloc(count, FRAME_ATOMIC, 0);
     65                                if (frames[allocated]) {
    7166                                        allocated++;
    72                                 else {
     67                                } else {
    7368                                        TPRINTF("done. ");
    7469                                        break;
     
    7873                        TPRINTF("%d blocks allocated.\n", allocated);
    7974                       
    80                         if (run) {
    81                                 if (results[order] != allocated)
     75                        if (run > 0) {
     76                                if (results[count] != allocated)
    8277                                        return "Possible frame leak";
    8378                        } else
    84                                 results[order] = allocated;
     79                                results[count] = allocated;
    8580                       
    8681                        TPRINTF("Deallocating ... ");
    8782                       
    8883                        for (unsigned int i = 0; i < allocated; i++)
    89                                 frame_free(KA2PA(frames[i]));
     84                                frame_free(frames[i], count);
    9085                       
    9186                        TPRINTF("done.\n");
Note: See TracChangeset for help on using the changeset viewer.