4 * Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #include <sys/queue.h>
43 #include <cmdline_parse.h>
45 #include <rte_common.h>
46 #include <rte_memory.h>
47 #include <rte_memzone.h>
48 #include <rte_per_lcore.h>
49 #include <rte_launch.h>
50 #include <rte_tailq.h>
52 #include <rte_per_lcore.h>
53 #include <rte_lcore.h>
54 #include <rte_malloc.h>
55 #include <rte_cycles.h>
56 #include <rte_random.h>
57 #include <rte_string_fns.h>
64 #define QUOTE(x) QUOTE_(x)
65 #define MALLOC_MEMZONE_SIZE QUOTE(RTE_MALLOC_MEMZONE_SIZE)
71 * Allocate some dynamic memory from heap (3 areas). Check that areas
72 * don't overlap an that alignment constraints match. This test is
73 * done many times on different lcores simultaneously.
76 /* Test if memory overlaps: return 1 if true, or 0 if false. */
78 is_memory_overlap(void *p1, size_t len1, void *p2, size_t len2)
80 unsigned long ptr1 = (unsigned long)p1;
81 unsigned long ptr2 = (unsigned long)p2;
83 if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
85 else if (ptr2 < ptr1 && (ptr1 - ptr2) < len2)
91 is_aligned(void *p, int align)
93 unsigned long addr = (unsigned long)p;
94 unsigned mask = align - 1;
102 test_align_overlap_per_lcore(__attribute__((unused)) void *arg)
104 const unsigned align1 = 8,
108 void *p1 = NULL, *p2 = NULL, *p3 = NULL;
111 for (i = 0; i < N; i++) {
112 p1 = rte_zmalloc("dummy", 1000, align1);
114 printf("rte_zmalloc returned NULL (i=%u)\n", i);
118 for(j = 0; j < 1000 ; j++) {
119 if( *(char *)p1 != 0) {
120 printf("rte_zmalloc didn't zero"
121 "the allocated memory\n");
125 p2 = rte_malloc("dummy", 1000, align2);
127 printf("rte_malloc returned NULL (i=%u)\n", i);
132 p3 = rte_malloc("dummy", 1000, align3);
134 printf("rte_malloc returned NULL (i=%u)\n", i);
140 if (is_memory_overlap(p1, 1000, p2, 1000)) {
141 printf("p1 and p2 overlaps\n");
144 if (is_memory_overlap(p2, 1000, p3, 1000)) {
145 printf("p2 and p3 overlaps\n");
148 if (is_memory_overlap(p1, 1000, p3, 1000)) {
149 printf("p1 and p3 overlaps\n");
152 if (!is_aligned(p1, align1)) {
153 printf("p1 is not aligned\n");
156 if (!is_aligned(p2, align2)) {
157 printf("p2 is not aligned\n");
160 if (!is_aligned(p3, align3)) {
161 printf("p3 is not aligned\n");
168 rte_malloc_dump_stats("dummy");
174 test_reordered_free_per_lcore(__attribute__((unused)) void *arg)
176 const unsigned align1 = 8,
183 for (i = 0; i < 30; i++) {
184 p1 = rte_zmalloc("dummy", 1000, align1);
186 printf("rte_zmalloc returned NULL (i=%u)\n", i);
190 for(j = 0; j < 1000 ; j++) {
191 if( *(char *)p1 != 0) {
192 printf("rte_zmalloc didn't zero"
193 "the allocated memory\n");
197 /* use calloc to allocate 1000 16-byte items this time */
198 p2 = rte_calloc("dummy", 1000, 16, align2);
199 /* for third request use regular malloc again */
200 p3 = rte_malloc("dummy", 1000, align3);
202 printf("rte_malloc returned NULL (i=%u)\n", i);
206 if (is_memory_overlap(p1, 1000, p2, 1000)) {
207 printf("p1 and p2 overlaps\n");
210 if (is_memory_overlap(p2, 1000, p3, 1000)) {
211 printf("p2 and p3 overlaps\n");
214 if (is_memory_overlap(p1, 1000, p3, 1000)) {
215 printf("p1 and p3 overlaps\n");
218 if (!is_aligned(p1, align1)) {
219 printf("p1 is not aligned\n");
222 if (!is_aligned(p2, align2)) {
223 printf("p2 is not aligned\n");
226 if (!is_aligned(p3, align3)) {
227 printf("p3 is not aligned\n");
230 /* try freeing in every possible order */
264 rte_malloc_dump_stats("dummy");
269 /* test function inside the malloc lib*/
271 test_str_to_size(void)
277 {{ "5G", (uint64_t)5 * 1024 * 1024 *1024 },
278 {"0x20g", (uint64_t)0x20 * 1024 * 1024 *1024},
279 {"10M", 10 * 1024 * 1024},
280 {"050m", 050 * 1024 * 1024},
286 {"-1", 0}, /* negative values return 0 */
289 {"18446744073709551616", 0} /* ULLONG_MAX + 1 == out of range*/
292 for (i = 0; i < sizeof(test_values)/sizeof(test_values[0]); i++)
293 if (rte_str_to_size(test_values[i].str) != test_values[i].value)
302 struct rte_malloc_socket_stats pre_stats, post_stats;
303 size_t size =rte_str_to_size(MALLOC_MEMZONE_SIZE)*2;
305 #ifndef RTE_LIBRTE_MALLOC_DEBUG
306 int overhead = 64 + 64;
308 int overhead = 64 + 64 + 64;
311 rte_malloc_get_socket_stats(socket, &pre_stats);
313 void *p1 = rte_malloc_socket("BIG", size , align, socket);
316 rte_malloc_get_socket_stats(socket,&post_stats);
318 /* Check statistics reported are correct */
319 /* Allocation increase, cannot be the same as before big allocation */
320 if (post_stats.heap_totalsz_bytes == pre_stats.heap_totalsz_bytes) {
321 printf("Malloc statistics are incorrect - heap_totalz_bytes\n");
324 /* Check that allocated size adds up correctly */
325 if (post_stats.heap_allocsz_bytes !=
326 pre_stats.heap_allocsz_bytes + size + align + overhead) {
327 printf("Malloc statistics are incorrect - alloc_size\n");
330 /* Check free size against tested allocated size */
331 if (post_stats.heap_freesz_bytes !=
332 post_stats.heap_totalsz_bytes - post_stats.heap_allocsz_bytes) {
333 printf("Malloc statistics are incorrect - heap_freesz_bytes\n");
336 /* Number of allocated blocks must increase after allocation */
337 if (post_stats.alloc_count != pre_stats.alloc_count + 1) {
338 printf("Malloc statistics are incorrect - alloc_count\n");
341 /* New blocks now available - just allocated 1 but also 1 new free */
342 if(post_stats.free_count != pre_stats.free_count ) {
343 printf("Malloc statistics are incorrect - free_count\n");
352 test_multi_alloc_statistics(void)
355 struct rte_malloc_socket_stats pre_stats, post_stats ,first_stats, second_stats;
358 #ifndef RTE_LIBRTE_MALLOC_DEBUG
359 int trailer_size = 0;
361 int trailer_size = 64;
363 int overhead = 64 + trailer_size;
365 rte_malloc_get_socket_stats(socket, &pre_stats);
367 void *p1 = rte_malloc_socket("stats", size , align, socket);
371 rte_malloc_dump_stats("stats");
373 rte_malloc_get_socket_stats(socket,&post_stats);
374 /* Check statistics reported are correct */
375 /* All post stats should be equal to pre stats after alloc freed */
376 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
377 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
378 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
379 (post_stats.alloc_count!=pre_stats.alloc_count)&&
380 (post_stats.free_count!=pre_stats.free_count)) {
381 printf("Malloc statistics are incorrect - freed alloc\n");
384 /* Check two consecutive allocations */
387 rte_malloc_get_socket_stats(socket,&pre_stats);
388 void *p2 = rte_malloc_socket("add", size ,align, socket);
391 rte_malloc_get_socket_stats(socket,&first_stats);
393 void *p3 = rte_malloc_socket("add2", size,align, socket);
397 rte_malloc_get_socket_stats(socket,&second_stats);
402 /* After freeing both allocations check stats return to original */
403 rte_malloc_get_socket_stats(socket, &post_stats);
406 * Check that no new blocks added after small allocations
407 * i.e. < RTE_MALLOC_MEMZONE_SIZE
409 if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
410 printf("Incorrect heap statistics: Total size \n");
413 /* Check allocated size is equal to two additions plus overhead */
414 if(second_stats.heap_allocsz_bytes !=
415 size + overhead + first_stats.heap_allocsz_bytes) {
416 printf("Incorrect heap statistics: Allocated size \n");
419 /* Check that allocation count increments correctly i.e. +1 */
420 if (second_stats.alloc_count != first_stats.alloc_count + 1) {
421 printf("Incorrect heap statistics: Allocated count \n");
425 if (second_stats.free_count != first_stats.free_count){
426 printf("Incorrect heap statistics: Free count \n");
430 /* Make sure that we didn't touch our greatest chunk: 2 * 11M) */
431 if (second_stats.greatest_free_size != pre_stats.greatest_free_size) {
432 printf("Incorrect heap statistics: Greatest free size \n");
435 /* Free size must equal the original free size minus the new allocation*/
436 if (first_stats.heap_freesz_bytes <= second_stats.heap_freesz_bytes) {
437 printf("Incorrect heap statistics: Free size \n");
441 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
442 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
443 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
444 (post_stats.alloc_count!=pre_stats.alloc_count)&&
445 (post_stats.free_count!=pre_stats.free_count)) {
446 printf("Malloc statistics are incorrect - freed alloc\n");
453 test_memzone_size_alloc(void)
455 void *p1 = rte_malloc("BIG", (size_t)(rte_str_to_size(MALLOC_MEMZONE_SIZE) - 128), 64);
459 /* one extra check - check no crashes if free(NULL) */
465 test_rte_malloc_type_limits(void)
467 /* The type-limits functionality is not yet implemented,
468 * so always return 0 no matter what the retval.
470 const char *typename = "limit_test";
471 rte_malloc_set_limit(typename, 64 * 1024);
472 rte_malloc_dump_stats(typename);
479 const char hello_str[] = "Hello, world!";
480 const unsigned size1 = 1024;
481 const unsigned size2 = size1 + 1024;
482 const unsigned size3 = size2;
483 const unsigned size4 = size3 + 1024;
485 /* test data is the same even if element is moved*/
486 char *ptr1 = rte_zmalloc(NULL, size1, CACHE_LINE_SIZE);
488 printf("NULL pointer returned from rte_zmalloc\n");
491 rte_snprintf(ptr1, size1, "%s" ,hello_str);
492 char *ptr2 = rte_realloc(ptr1, size2, CACHE_LINE_SIZE);
495 printf("NULL pointer returned from rte_realloc\n");
499 printf("unexpected - ptr1 == ptr2\n");
501 if (strcmp(ptr2, hello_str) != 0){
502 printf("Error - lost data from pointed area\n");
507 for (i = strnlen(hello_str, sizeof(hello_str)); i < size1; i++)
509 printf("Bad data in realloc\n");
513 /* now allocate third element, free the second
514 * and resize third. It should not move. (ptr1 is now invalid)
516 char *ptr3 = rte_zmalloc(NULL, size3, CACHE_LINE_SIZE);
518 printf("NULL pointer returned from rte_zmalloc\n");
522 for (i = 0; i < size3; i++)
524 printf("Bad data in zmalloc\n");
530 /* first resize to half the size of the freed block */
531 char *ptr4 = rte_realloc(ptr3, size4, CACHE_LINE_SIZE);
533 printf("NULL pointer returned from rte_realloc\n");
538 printf("Unexpected - ptr4 != ptr3\n");
542 /* now resize again to the full size of the freed block */
543 ptr4 = rte_realloc(ptr3, size3 + size2 + size1, CACHE_LINE_SIZE);
545 printf("Unexpected - ptr4 != ptr3 on second resize\n");
551 /* now try a resize to a smaller size, see if it works */
552 const unsigned size5 = 1024;
553 const unsigned size6 = size5 / 2;
554 char *ptr5 = rte_malloc(NULL, size5, CACHE_LINE_SIZE);
556 printf("NULL pointer returned from rte_malloc\n");
559 char *ptr6 = rte_realloc(ptr5, size6, CACHE_LINE_SIZE);
561 printf("NULL pointer returned from rte_realloc\n");
566 printf("Error, resizing to a smaller size moved data\n");
572 /* check for behaviour changing alignment */
573 const unsigned size7 = 1024;
574 const unsigned orig_align = CACHE_LINE_SIZE;
575 unsigned new_align = CACHE_LINE_SIZE * 2;
576 char *ptr7 = rte_malloc(NULL, size7, orig_align);
578 printf("NULL pointer returned from rte_malloc\n");
581 /* calc an alignment we don't already have */
582 while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
584 char *ptr8 = rte_realloc(ptr7, size7, new_align);
586 printf("NULL pointer returned from rte_realloc\n");
590 if (RTE_PTR_ALIGN(ptr8, new_align) != ptr8){
591 printf("Failure to re-align data\n");
597 /* test behaviour when there is a free block after current one,
598 * but its not big enough
600 unsigned size9 = 1024, size10 = 1024;
601 unsigned size11 = size9 + size10 + 256;
602 char *ptr9 = rte_malloc(NULL, size9, CACHE_LINE_SIZE);
604 printf("NULL pointer returned from rte_malloc\n");
607 char *ptr10 = rte_malloc(NULL, size10, CACHE_LINE_SIZE);
609 printf("NULL pointer returned from rte_malloc\n");
613 char *ptr11 = rte_realloc(ptr10, size11, CACHE_LINE_SIZE);
615 printf("NULL pointer returned from rte_realloc\n");
620 printf("Error, unexpected that realloc has not created new buffer\n");
626 /* check we don't crash if we pass null to realloc
627 * We should get a malloc of the size requested*/
628 const size_t size12 = 1024;
630 char *ptr12 = rte_realloc(NULL, size12, CACHE_LINE_SIZE);
632 printf("NULL pointer returned from rte_realloc\n");
635 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
636 size12_check != size12){
645 test_random_alloc_free(void *_ __attribute__((unused)))
648 struct mem_list *next;
654 rte_srand((unsigned)rte_rdtsc());
656 for (i = 0; i < N; i++){
657 unsigned free_mem = 0;
658 size_t allocated_size;
660 const unsigned mem_size = sizeof(struct mem_list) + \
661 rte_rand() % (64 * 1024);
662 const unsigned align = 1 << (rte_rand() % 12); /* up to 4k alignment */
663 struct mem_list *entry = rte_malloc(NULL,
667 if (RTE_PTR_ALIGN(entry, align)!= entry)
669 if (rte_malloc_validate(entry, &allocated_size) == -1
670 || allocated_size < mem_size)
672 memset(entry->data, rte_lcore_id(),
673 mem_size - sizeof(*entry));
674 entry->next = list_head;
675 if (rte_malloc_validate(entry, NULL) == -1)
680 /* switch to freeing the memory with a 20% probability */
681 free_mem = ((rte_rand() % 10) >= 8);
684 struct mem_list *entry = list_head;
685 list_head = list_head->next;
689 printf("Lcore %u allocated/freed %u blocks\n", rte_lcore_id(), count);
693 #define err_return() do { \
694 printf("%s: %d - Error\n", __func__, __LINE__); \
699 test_rte_malloc_validate(void)
701 const size_t request_size = 1024;
702 size_t allocated_size;
703 char *data_ptr = rte_malloc(NULL, request_size, CACHE_LINE_SIZE);
704 #ifdef RTE_LIBRTE_MALLOC_DEBUG
706 char *over_write_vals = NULL;
709 if (data_ptr == NULL) {
710 printf("%s: %d - Allocation error\n", __func__, __LINE__);
714 /* check that a null input returns -1 */
715 if (rte_malloc_validate(NULL, NULL) != -1)
718 /* check that we get ok on a valid pointer */
719 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
722 /* check that the returned size is ok */
723 if (allocated_size < request_size)
726 #ifdef RTE_LIBRTE_MALLOC_DEBUG
728 /****** change the header to be bad */
730 over_write_vals = (char *)((uintptr_t)data_ptr - sizeof(save_buf));
731 /* first save the data as a backup before overwriting it */
732 memcpy(save_buf, over_write_vals, sizeof(save_buf));
733 memset(over_write_vals, 1, sizeof(save_buf));
734 /* then run validate */
735 retval = rte_malloc_validate(data_ptr, NULL);
736 /* finally restore the data again */
737 memcpy(over_write_vals, save_buf, sizeof(save_buf));
738 /* check we previously had an error */
742 /* check all ok again */
743 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
746 /**** change the trailer to be bad */
747 over_write_vals = (char *)((uintptr_t)data_ptr + allocated_size);
748 /* first save the data as a backup before overwriting it */
749 memcpy(save_buf, over_write_vals, sizeof(save_buf));
750 memset(over_write_vals, 1, sizeof(save_buf));
751 /* then run validate */
752 retval = rte_malloc_validate(data_ptr, NULL);
753 /* finally restore the data again */
754 memcpy(over_write_vals, save_buf, sizeof(save_buf));
758 /* check all ok again */
759 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
773 test_zero_aligned_alloc(void)
775 char *p1 = rte_malloc(NULL,1024, 0);
778 if (!rte_is_aligned(p1, CACHE_LINE_SIZE))
785 if (p1) rte_free(p1);
790 test_malloc_bad_params(void)
792 const char *type = NULL;
794 unsigned align = CACHE_LINE_SIZE;
796 /* rte_malloc expected to return null with inappropriate size */
797 char *bad_ptr = rte_malloc(type, size, align);
801 /* rte_malloc expected to return null with inappropriate alignment */
805 bad_ptr = rte_malloc(type, size, align);
812 /* clean up pointer */
818 /* Check if memory is avilable on a specific socket */
820 is_mem_on_socket(int32_t socket)
822 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
825 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
826 if (socket == ms[i].socket_id)
833 * Find what socket a memory address is on. Only works for addresses within
834 * memsegs, not heap or stack...
837 addr_to_socket(void * addr)
839 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
842 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
843 if ((ms[i].addr <= addr) &&
845 ((uintptr_t)ms[i].addr + (uintptr_t)ms[i].len)))
846 return ms[i].socket_id;
851 /* Test using rte_[c|m|zm]alloc_socket() on a specific socket */
853 test_alloc_single_socket(int32_t socket)
855 const char *type = NULL;
856 const size_t size = 10;
857 const unsigned align = 0;
859 int32_t desired_socket = (socket == SOCKET_ID_ANY) ?
860 (int32_t)rte_socket_id() : socket;
862 /* Test rte_calloc_socket() */
863 mem = rte_calloc_socket(type, size, sizeof(char), align, socket);
866 if (addr_to_socket(mem) != desired_socket) {
872 /* Test rte_malloc_socket() */
873 mem = rte_malloc_socket(type, size, align, socket);
876 if (addr_to_socket(mem) != desired_socket) {
881 /* Test rte_zmalloc_socket() */
882 mem = rte_zmalloc_socket(type, size, align, socket);
885 if (addr_to_socket(mem) != desired_socket) {
895 test_alloc_socket(void)
897 unsigned socket_count = 0;
900 if (test_alloc_single_socket(SOCKET_ID_ANY) < 0)
903 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
904 if (is_mem_on_socket(i)) {
906 if (test_alloc_single_socket(i) < 0) {
907 printf("Fail: rte_malloc_socket(..., %u) did not succeed\n",
913 if (test_alloc_single_socket(i) == 0) {
914 printf("Fail: rte_malloc_socket(..., %u) succeeded\n",
921 /* Print warnign if only a single socket, but don't fail the test */
922 if (socket_count < 2) {
923 printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
935 if (test_str_to_size() < 0){
936 printf("test_str_to_size() failed\n");
939 else printf("test_str_to_size() passed\n");
941 if (test_memzone_size_alloc() < 0){
942 printf("test_memzone_size_alloc() failed\n");
945 else printf("test_memzone_size_alloc() passed\n");
947 if (test_big_alloc() < 0){
948 printf("test_big_alloc() failed\n");
951 else printf("test_big_alloc() passed\n");
953 if (test_zero_aligned_alloc() < 0){
954 printf("test_zero_aligned_alloc() failed\n");
957 else printf("test_zero_aligned_alloc() passed\n");
959 if (test_malloc_bad_params() < 0){
960 printf("test_malloc_bad_params() failed\n");
963 else printf("test_malloc_bad_params() passed\n");
965 if (test_realloc() < 0){
966 printf("test_realloc() failed\n");
969 else printf("test_realloc() passed\n");
971 /*----------------------------*/
972 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
973 rte_eal_remote_launch(test_align_overlap_per_lcore, NULL, lcore_id);
976 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
977 if (rte_eal_wait_lcore(lcore_id) < 0)
981 printf("test_align_overlap_per_lcore() failed\n");
984 else printf("test_align_overlap_per_lcore() passed\n");
986 /*----------------------------*/
987 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
988 rte_eal_remote_launch(test_reordered_free_per_lcore, NULL, lcore_id);
991 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
992 if (rte_eal_wait_lcore(lcore_id) < 0)
996 printf("test_reordered_free_per_lcore() failed\n");
999 else printf("test_reordered_free_per_lcore() passed\n");
1001 /*----------------------------*/
1002 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
1003 rte_eal_remote_launch(test_random_alloc_free, NULL, lcore_id);
1006 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
1007 if (rte_eal_wait_lcore(lcore_id) < 0)
1011 printf("test_random_alloc_free() failed\n");
1014 else printf("test_random_alloc_free() passed\n");
1016 /*----------------------------*/
1017 ret = test_rte_malloc_type_limits();
1019 printf("test_rte_malloc_type_limits() failed\n");
1022 /* TODO: uncomment following line once type limits are valid */
1023 /*else printf("test_rte_malloc_type_limits() passed\n");*/
1025 /*----------------------------*/
1026 ret = test_rte_malloc_validate();
1028 printf("test_rte_malloc_validate() failed\n");
1031 else printf("test_rte_malloc_validate() passed\n");
1033 ret = test_alloc_socket();
1035 printf("test_alloc_socket() failed\n");
1038 else printf("test_alloc_socket() passed\n");
1040 ret = test_multi_alloc_statistics();
1042 printf("test_muti_alloc_statistics() failed\n");
1046 printf("test_muti_alloc_statistics() passed\n");