4 * Copyright(c) 2010-2014 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.
40 #include <sys/queue.h>
42 #include <cmdline_parse.h>
44 #include <rte_common.h>
45 #include <rte_memory.h>
46 #include <rte_memzone.h>
47 #include <rte_per_lcore.h>
48 #include <rte_launch.h>
49 #include <rte_tailq.h>
51 #include <rte_per_lcore.h>
52 #include <rte_lcore.h>
53 #include <rte_malloc.h>
54 #include <rte_cycles.h>
55 #include <rte_random.h>
56 #include <rte_string_fns.h>
63 #define QUOTE(x) QUOTE_(x)
64 #define MALLOC_MEMZONE_SIZE QUOTE(RTE_MALLOC_MEMZONE_SIZE)
70 * Allocate some dynamic memory from heap (3 areas). Check that areas
71 * don't overlap an that alignment constraints match. This test is
72 * done many times on different lcores simultaneously.
75 /* Test if memory overlaps: return 1 if true, or 0 if false. */
77 is_memory_overlap(void *p1, size_t len1, void *p2, size_t len2)
79 unsigned long ptr1 = (unsigned long)p1;
80 unsigned long ptr2 = (unsigned long)p2;
82 if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
84 else if (ptr2 < ptr1 && (ptr1 - ptr2) < len2)
90 is_aligned(void *p, int align)
92 unsigned long addr = (unsigned long)p;
93 unsigned mask = align - 1;
101 test_align_overlap_per_lcore(__attribute__((unused)) void *arg)
103 const unsigned align1 = 8,
107 void *p1 = NULL, *p2 = NULL, *p3 = NULL;
110 for (i = 0; i < N; i++) {
111 p1 = rte_zmalloc("dummy", 1000, align1);
113 printf("rte_zmalloc returned NULL (i=%u)\n", i);
117 for(j = 0; j < 1000 ; j++) {
118 if( *(char *)p1 != 0) {
119 printf("rte_zmalloc didn't zero"
120 "the allocated memory\n");
124 p2 = rte_malloc("dummy", 1000, align2);
126 printf("rte_malloc returned NULL (i=%u)\n", i);
131 p3 = rte_malloc("dummy", 1000, align3);
133 printf("rte_malloc returned NULL (i=%u)\n", i);
139 if (is_memory_overlap(p1, 1000, p2, 1000)) {
140 printf("p1 and p2 overlaps\n");
143 if (is_memory_overlap(p2, 1000, p3, 1000)) {
144 printf("p2 and p3 overlaps\n");
147 if (is_memory_overlap(p1, 1000, p3, 1000)) {
148 printf("p1 and p3 overlaps\n");
151 if (!is_aligned(p1, align1)) {
152 printf("p1 is not aligned\n");
155 if (!is_aligned(p2, align2)) {
156 printf("p2 is not aligned\n");
159 if (!is_aligned(p3, align3)) {
160 printf("p3 is not aligned\n");
167 rte_malloc_dump_stats("dummy");
173 test_reordered_free_per_lcore(__attribute__((unused)) void *arg)
175 const unsigned align1 = 8,
182 for (i = 0; i < 30; i++) {
183 p1 = rte_zmalloc("dummy", 1000, align1);
185 printf("rte_zmalloc returned NULL (i=%u)\n", i);
189 for(j = 0; j < 1000 ; j++) {
190 if( *(char *)p1 != 0) {
191 printf("rte_zmalloc didn't zero"
192 "the allocated memory\n");
196 /* use calloc to allocate 1000 16-byte items this time */
197 p2 = rte_calloc("dummy", 1000, 16, align2);
198 /* for third request use regular malloc again */
199 p3 = rte_malloc("dummy", 1000, align3);
201 printf("rte_malloc returned NULL (i=%u)\n", i);
205 if (is_memory_overlap(p1, 1000, p2, 1000)) {
206 printf("p1 and p2 overlaps\n");
209 if (is_memory_overlap(p2, 1000, p3, 1000)) {
210 printf("p2 and p3 overlaps\n");
213 if (is_memory_overlap(p1, 1000, p3, 1000)) {
214 printf("p1 and p3 overlaps\n");
217 if (!is_aligned(p1, align1)) {
218 printf("p1 is not aligned\n");
221 if (!is_aligned(p2, align2)) {
222 printf("p2 is not aligned\n");
225 if (!is_aligned(p3, align3)) {
226 printf("p3 is not aligned\n");
229 /* try freeing in every possible order */
263 rte_malloc_dump_stats("dummy");
268 /* test function inside the malloc lib*/
270 test_str_to_size(void)
276 {{ "5G", (uint64_t)5 * 1024 * 1024 *1024 },
277 {"0x20g", (uint64_t)0x20 * 1024 * 1024 *1024},
278 {"10M", 10 * 1024 * 1024},
279 {"050m", 050 * 1024 * 1024},
285 {"-1", 0}, /* negative values return 0 */
288 {"18446744073709551616", 0} /* ULLONG_MAX + 1 == out of range*/
291 for (i = 0; i < sizeof(test_values)/sizeof(test_values[0]); i++)
292 if (rte_str_to_size(test_values[i].str) != test_values[i].value)
301 struct rte_malloc_socket_stats pre_stats, post_stats;
302 size_t size =rte_str_to_size(MALLOC_MEMZONE_SIZE)*2;
304 #ifndef RTE_LIBRTE_MALLOC_DEBUG
305 int overhead = 64 + 64;
307 int overhead = 64 + 64 + 64;
310 rte_malloc_get_socket_stats(socket, &pre_stats);
312 void *p1 = rte_malloc_socket("BIG", size , align, socket);
315 rte_malloc_get_socket_stats(socket,&post_stats);
317 /* Check statistics reported are correct */
318 /* Allocation increase, cannot be the same as before big allocation */
319 if (post_stats.heap_totalsz_bytes == pre_stats.heap_totalsz_bytes) {
320 printf("Malloc statistics are incorrect - heap_totalz_bytes\n");
323 /* Check that allocated size adds up correctly */
324 if (post_stats.heap_allocsz_bytes !=
325 pre_stats.heap_allocsz_bytes + size + align + overhead) {
326 printf("Malloc statistics are incorrect - alloc_size\n");
329 /* Check free size against tested allocated size */
330 if (post_stats.heap_freesz_bytes !=
331 post_stats.heap_totalsz_bytes - post_stats.heap_allocsz_bytes) {
332 printf("Malloc statistics are incorrect - heap_freesz_bytes\n");
335 /* Number of allocated blocks must increase after allocation */
336 if (post_stats.alloc_count != pre_stats.alloc_count + 1) {
337 printf("Malloc statistics are incorrect - alloc_count\n");
340 /* New blocks now available - just allocated 1 but also 1 new free */
341 if(post_stats.free_count != pre_stats.free_count ) {
342 printf("Malloc statistics are incorrect - free_count\n");
351 test_multi_alloc_statistics(void)
354 struct rte_malloc_socket_stats pre_stats, post_stats ,first_stats, second_stats;
357 #ifndef RTE_LIBRTE_MALLOC_DEBUG
358 int trailer_size = 0;
360 int trailer_size = 64;
362 int overhead = 64 + trailer_size;
364 rte_malloc_get_socket_stats(socket, &pre_stats);
366 void *p1 = rte_malloc_socket("stats", size , align, socket);
370 rte_malloc_dump_stats("stats");
372 rte_malloc_get_socket_stats(socket,&post_stats);
373 /* Check statistics reported are correct */
374 /* All post stats should be equal to pre stats after alloc freed */
375 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
376 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
377 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
378 (post_stats.alloc_count!=pre_stats.alloc_count)&&
379 (post_stats.free_count!=pre_stats.free_count)) {
380 printf("Malloc statistics are incorrect - freed alloc\n");
383 /* Check two consecutive allocations */
386 rte_malloc_get_socket_stats(socket,&pre_stats);
387 void *p2 = rte_malloc_socket("add", size ,align, socket);
390 rte_malloc_get_socket_stats(socket,&first_stats);
392 void *p3 = rte_malloc_socket("add2", size,align, socket);
396 rte_malloc_get_socket_stats(socket,&second_stats);
401 /* After freeing both allocations check stats return to original */
402 rte_malloc_get_socket_stats(socket, &post_stats);
405 * Check that no new blocks added after small allocations
406 * i.e. < RTE_MALLOC_MEMZONE_SIZE
408 if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
409 printf("Incorrect heap statistics: Total size \n");
412 /* Check allocated size is equal to two additions plus overhead */
413 if(second_stats.heap_allocsz_bytes !=
414 size + overhead + first_stats.heap_allocsz_bytes) {
415 printf("Incorrect heap statistics: Allocated size \n");
418 /* Check that allocation count increments correctly i.e. +1 */
419 if (second_stats.alloc_count != first_stats.alloc_count + 1) {
420 printf("Incorrect heap statistics: Allocated count \n");
424 if (second_stats.free_count != first_stats.free_count){
425 printf("Incorrect heap statistics: Free count \n");
429 /* Make sure that we didn't touch our greatest chunk: 2 * 11M) */
430 if (second_stats.greatest_free_size != pre_stats.greatest_free_size) {
431 printf("Incorrect heap statistics: Greatest free size \n");
434 /* Free size must equal the original free size minus the new allocation*/
435 if (first_stats.heap_freesz_bytes <= second_stats.heap_freesz_bytes) {
436 printf("Incorrect heap statistics: Free size \n");
440 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
441 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
442 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
443 (post_stats.alloc_count!=pre_stats.alloc_count)&&
444 (post_stats.free_count!=pre_stats.free_count)) {
445 printf("Malloc statistics are incorrect - freed alloc\n");
452 test_memzone_size_alloc(void)
454 void *p1 = rte_malloc("BIG", (size_t)(rte_str_to_size(MALLOC_MEMZONE_SIZE) - 128), 64);
458 /* one extra check - check no crashes if free(NULL) */
464 test_rte_malloc_type_limits(void)
466 /* The type-limits functionality is not yet implemented,
467 * so always return 0 no matter what the retval.
469 const char *typename = "limit_test";
470 rte_malloc_set_limit(typename, 64 * 1024);
471 rte_malloc_dump_stats(typename);
478 const char hello_str[] = "Hello, world!";
479 const unsigned size1 = 1024;
480 const unsigned size2 = size1 + 1024;
481 const unsigned size3 = size2;
482 const unsigned size4 = size3 + 1024;
484 /* test data is the same even if element is moved*/
485 char *ptr1 = rte_zmalloc(NULL, size1, CACHE_LINE_SIZE);
487 printf("NULL pointer returned from rte_zmalloc\n");
490 rte_snprintf(ptr1, size1, "%s" ,hello_str);
491 char *ptr2 = rte_realloc(ptr1, size2, CACHE_LINE_SIZE);
494 printf("NULL pointer returned from rte_realloc\n");
498 printf("unexpected - ptr1 == ptr2\n");
500 if (strcmp(ptr2, hello_str) != 0){
501 printf("Error - lost data from pointed area\n");
506 for (i = strnlen(hello_str, sizeof(hello_str)); i < size1; i++)
508 printf("Bad data in realloc\n");
512 /* now allocate third element, free the second
513 * and resize third. It should not move. (ptr1 is now invalid)
515 char *ptr3 = rte_zmalloc(NULL, size3, CACHE_LINE_SIZE);
517 printf("NULL pointer returned from rte_zmalloc\n");
521 for (i = 0; i < size3; i++)
523 printf("Bad data in zmalloc\n");
529 /* first resize to half the size of the freed block */
530 char *ptr4 = rte_realloc(ptr3, size4, CACHE_LINE_SIZE);
532 printf("NULL pointer returned from rte_realloc\n");
537 printf("Unexpected - ptr4 != ptr3\n");
541 /* now resize again to the full size of the freed block */
542 ptr4 = rte_realloc(ptr3, size3 + size2 + size1, CACHE_LINE_SIZE);
544 printf("Unexpected - ptr4 != ptr3 on second resize\n");
550 /* now try a resize to a smaller size, see if it works */
551 const unsigned size5 = 1024;
552 const unsigned size6 = size5 / 2;
553 char *ptr5 = rte_malloc(NULL, size5, CACHE_LINE_SIZE);
555 printf("NULL pointer returned from rte_malloc\n");
558 char *ptr6 = rte_realloc(ptr5, size6, CACHE_LINE_SIZE);
560 printf("NULL pointer returned from rte_realloc\n");
565 printf("Error, resizing to a smaller size moved data\n");
571 /* check for behaviour changing alignment */
572 const unsigned size7 = 1024;
573 const unsigned orig_align = CACHE_LINE_SIZE;
574 unsigned new_align = CACHE_LINE_SIZE * 2;
575 char *ptr7 = rte_malloc(NULL, size7, orig_align);
577 printf("NULL pointer returned from rte_malloc\n");
580 /* calc an alignment we don't already have */
581 while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
583 char *ptr8 = rte_realloc(ptr7, size7, new_align);
585 printf("NULL pointer returned from rte_realloc\n");
589 if (RTE_PTR_ALIGN(ptr8, new_align) != ptr8){
590 printf("Failure to re-align data\n");
596 /* test behaviour when there is a free block after current one,
597 * but its not big enough
599 unsigned size9 = 1024, size10 = 1024;
600 unsigned size11 = size9 + size10 + 256;
601 char *ptr9 = rte_malloc(NULL, size9, CACHE_LINE_SIZE);
603 printf("NULL pointer returned from rte_malloc\n");
606 char *ptr10 = rte_malloc(NULL, size10, CACHE_LINE_SIZE);
608 printf("NULL pointer returned from rte_malloc\n");
612 char *ptr11 = rte_realloc(ptr10, size11, CACHE_LINE_SIZE);
614 printf("NULL pointer returned from rte_realloc\n");
619 printf("Error, unexpected that realloc has not created new buffer\n");
625 /* check we don't crash if we pass null to realloc
626 * We should get a malloc of the size requested*/
627 const size_t size12 = 1024;
629 char *ptr12 = rte_realloc(NULL, size12, CACHE_LINE_SIZE);
631 printf("NULL pointer returned from rte_realloc\n");
634 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
635 size12_check != size12){
644 test_random_alloc_free(void *_ __attribute__((unused)))
647 struct mem_list *next;
653 rte_srand((unsigned)rte_rdtsc());
655 for (i = 0; i < N; i++){
656 unsigned free_mem = 0;
657 size_t allocated_size;
659 const unsigned mem_size = sizeof(struct mem_list) + \
660 rte_rand() % (64 * 1024);
661 const unsigned align = 1 << (rte_rand() % 12); /* up to 4k alignment */
662 struct mem_list *entry = rte_malloc(NULL,
666 if (RTE_PTR_ALIGN(entry, align)!= entry)
668 if (rte_malloc_validate(entry, &allocated_size) == -1
669 || allocated_size < mem_size)
671 memset(entry->data, rte_lcore_id(),
672 mem_size - sizeof(*entry));
673 entry->next = list_head;
674 if (rte_malloc_validate(entry, NULL) == -1)
679 /* switch to freeing the memory with a 20% probability */
680 free_mem = ((rte_rand() % 10) >= 8);
683 struct mem_list *entry = list_head;
684 list_head = list_head->next;
688 printf("Lcore %u allocated/freed %u blocks\n", rte_lcore_id(), count);
692 #define err_return() do { \
693 printf("%s: %d - Error\n", __func__, __LINE__); \
698 test_rte_malloc_validate(void)
700 const size_t request_size = 1024;
701 size_t allocated_size;
702 char *data_ptr = rte_malloc(NULL, request_size, CACHE_LINE_SIZE);
703 #ifdef RTE_LIBRTE_MALLOC_DEBUG
705 char *over_write_vals = NULL;
708 if (data_ptr == NULL) {
709 printf("%s: %d - Allocation error\n", __func__, __LINE__);
713 /* check that a null input returns -1 */
714 if (rte_malloc_validate(NULL, NULL) != -1)
717 /* check that we get ok on a valid pointer */
718 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
721 /* check that the returned size is ok */
722 if (allocated_size < request_size)
725 #ifdef RTE_LIBRTE_MALLOC_DEBUG
727 /****** change the header to be bad */
729 over_write_vals = (char *)((uintptr_t)data_ptr - sizeof(save_buf));
730 /* first save the data as a backup before overwriting it */
731 memcpy(save_buf, over_write_vals, sizeof(save_buf));
732 memset(over_write_vals, 1, sizeof(save_buf));
733 /* then run validate */
734 retval = rte_malloc_validate(data_ptr, NULL);
735 /* finally restore the data again */
736 memcpy(over_write_vals, save_buf, sizeof(save_buf));
737 /* check we previously had an error */
741 /* check all ok again */
742 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
745 /**** change the trailer to be bad */
746 over_write_vals = (char *)((uintptr_t)data_ptr + allocated_size);
747 /* first save the data as a backup before overwriting it */
748 memcpy(save_buf, over_write_vals, sizeof(save_buf));
749 memset(over_write_vals, 1, sizeof(save_buf));
750 /* then run validate */
751 retval = rte_malloc_validate(data_ptr, NULL);
752 /* finally restore the data again */
753 memcpy(over_write_vals, save_buf, sizeof(save_buf));
757 /* check all ok again */
758 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
772 test_zero_aligned_alloc(void)
774 char *p1 = rte_malloc(NULL,1024, 0);
777 if (!rte_is_aligned(p1, CACHE_LINE_SIZE))
784 if (p1) rte_free(p1);
789 test_malloc_bad_params(void)
791 const char *type = NULL;
793 unsigned align = CACHE_LINE_SIZE;
795 /* rte_malloc expected to return null with inappropriate size */
796 char *bad_ptr = rte_malloc(type, size, align);
800 /* rte_malloc expected to return null with inappropriate alignment */
804 bad_ptr = rte_malloc(type, size, align);
811 /* clean up pointer */
817 /* Check if memory is avilable on a specific socket */
819 is_mem_on_socket(int32_t socket)
821 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
824 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
825 if (socket == ms[i].socket_id)
832 * Find what socket a memory address is on. Only works for addresses within
833 * memsegs, not heap or stack...
836 addr_to_socket(void * addr)
838 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
841 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
842 if ((ms[i].addr <= addr) &&
844 ((uintptr_t)ms[i].addr + (uintptr_t)ms[i].len)))
845 return ms[i].socket_id;
850 /* Test using rte_[c|m|zm]alloc_socket() on a specific socket */
852 test_alloc_single_socket(int32_t socket)
854 const char *type = NULL;
855 const size_t size = 10;
856 const unsigned align = 0;
858 int32_t desired_socket = (socket == SOCKET_ID_ANY) ?
859 (int32_t)rte_socket_id() : socket;
861 /* Test rte_calloc_socket() */
862 mem = rte_calloc_socket(type, size, sizeof(char), align, socket);
865 if (addr_to_socket(mem) != desired_socket) {
871 /* Test rte_malloc_socket() */
872 mem = rte_malloc_socket(type, size, align, socket);
875 if (addr_to_socket(mem) != desired_socket) {
880 /* Test rte_zmalloc_socket() */
881 mem = rte_zmalloc_socket(type, size, align, socket);
884 if (addr_to_socket(mem) != desired_socket) {
894 test_alloc_socket(void)
896 unsigned socket_count = 0;
899 if (test_alloc_single_socket(SOCKET_ID_ANY) < 0)
902 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
903 if (is_mem_on_socket(i)) {
905 if (test_alloc_single_socket(i) < 0) {
906 printf("Fail: rte_malloc_socket(..., %u) did not succeed\n",
912 if (test_alloc_single_socket(i) == 0) {
913 printf("Fail: rte_malloc_socket(..., %u) succeeded\n",
920 /* Print warnign if only a single socket, but don't fail the test */
921 if (socket_count < 2) {
922 printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
934 if (test_str_to_size() < 0){
935 printf("test_str_to_size() failed\n");
938 else printf("test_str_to_size() passed\n");
940 if (test_memzone_size_alloc() < 0){
941 printf("test_memzone_size_alloc() failed\n");
944 else printf("test_memzone_size_alloc() passed\n");
946 if (test_big_alloc() < 0){
947 printf("test_big_alloc() failed\n");
950 else printf("test_big_alloc() passed\n");
952 if (test_zero_aligned_alloc() < 0){
953 printf("test_zero_aligned_alloc() failed\n");
956 else printf("test_zero_aligned_alloc() passed\n");
958 if (test_malloc_bad_params() < 0){
959 printf("test_malloc_bad_params() failed\n");
962 else printf("test_malloc_bad_params() passed\n");
964 if (test_realloc() < 0){
965 printf("test_realloc() failed\n");
968 else printf("test_realloc() passed\n");
970 /*----------------------------*/
971 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
972 rte_eal_remote_launch(test_align_overlap_per_lcore, NULL, lcore_id);
975 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
976 if (rte_eal_wait_lcore(lcore_id) < 0)
980 printf("test_align_overlap_per_lcore() failed\n");
983 else printf("test_align_overlap_per_lcore() passed\n");
985 /*----------------------------*/
986 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
987 rte_eal_remote_launch(test_reordered_free_per_lcore, NULL, lcore_id);
990 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
991 if (rte_eal_wait_lcore(lcore_id) < 0)
995 printf("test_reordered_free_per_lcore() failed\n");
998 else printf("test_reordered_free_per_lcore() passed\n");
1000 /*----------------------------*/
1001 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
1002 rte_eal_remote_launch(test_random_alloc_free, NULL, lcore_id);
1005 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
1006 if (rte_eal_wait_lcore(lcore_id) < 0)
1010 printf("test_random_alloc_free() failed\n");
1013 else printf("test_random_alloc_free() passed\n");
1015 /*----------------------------*/
1016 ret = test_rte_malloc_type_limits();
1018 printf("test_rte_malloc_type_limits() failed\n");
1021 /* TODO: uncomment following line once type limits are valid */
1022 /*else printf("test_rte_malloc_type_limits() passed\n");*/
1024 /*----------------------------*/
1025 ret = test_rte_malloc_validate();
1027 printf("test_rte_malloc_validate() failed\n");
1030 else printf("test_rte_malloc_validate() passed\n");
1032 ret = test_alloc_socket();
1034 printf("test_alloc_socket() failed\n");
1037 else printf("test_alloc_socket() passed\n");
1039 ret = test_multi_alloc_statistics();
1041 printf("test_muti_alloc_statistics() failed\n");
1045 printf("test_muti_alloc_statistics() passed\n");