Changes in kernel/test/mm/falloc1.c [cd3b380:abfc9f3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc1.c
rcd3b380 rabfc9f3 37 37 #include <align.h> 38 38 39 #define MAX_FRAMES 1024 39 #define MAX_FRAMES 1024U 40 40 #define MAX_ORDER 8 41 41 #define TEST_RUNS 2 … … 51 51 return "Unable to allocate frames"; 52 52 53 unsigned int results[MAX_FRAMES + 1]; 54 53 unsigned int results[MAX_ORDER + 1]; 55 54 for (unsigned int run = 0; run < TEST_RUNS; run++) { 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); 55 for (unsigned int order = 0; order <= MAX_ORDER; order++) { 56 TPRINTF("Allocating %u frames blocks ... ", 1 << order); 61 57 62 58 unsigned int allocated = 0; 63 for (unsigned int i = 0; i < (MAX_FRAMES / count); i++) { 64 frames[allocated] = frame_alloc(count, FRAME_ATOMIC, 0); 65 if (frames[allocated]) { 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]) 66 71 allocated++; 67 }else {72 else { 68 73 TPRINTF("done. "); 69 74 break; … … 73 78 TPRINTF("%d blocks allocated.\n", allocated); 74 79 75 if (run > 0) {76 if (results[ count] != allocated)80 if (run) { 81 if (results[order] != allocated) 77 82 return "Possible frame leak"; 78 83 } else 79 results[ count] = allocated;84 results[order] = allocated; 80 85 81 86 TPRINTF("Deallocating ... "); 82 87 83 88 for (unsigned int i = 0; i < allocated; i++) 84 frame_free( frames[i], count);89 frame_free(KA2PA(frames[i])); 85 90 86 91 TPRINTF("done.\n");
Note:
See TracChangeset
for help on using the changeset viewer.