Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memblock tests: add labels to verbose output for generic alloc tests

Generic tests for memblock_alloc*() functions do not use separate
functions for testing top-down and bottom-up allocation directions.
Therefore, the function name that is displayed in the verbose testing
output does not include the allocation direction.

Add an additional prefix when running generic tests for
memblock_alloc*() functions that indicates which allocation direction is
set. The prefix will be displayed when the tests are run in verbose mode.

Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Shaoqin Huang <shaoqin.huang@intel.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/fb76a42253d2a196a7daea29dd8121a69904f58e.1661578349.git.remckee0@gmail.com

authored by

Rebecca Mckeever and committed by
Mike Rapoport
fb2e97fe 25b9defb

+44 -56
+12 -24
tools/testing/memblock/tests/alloc_api.c
··· 751 751 static int alloc_in_between_check(void) 752 752 { 753 753 test_print("\tRunning %s...\n", __func__); 754 - memblock_set_bottom_up(false); 755 - alloc_in_between_generic_check(); 756 - memblock_set_bottom_up(true); 757 - alloc_in_between_generic_check(); 754 + run_top_down(alloc_in_between_generic_check); 755 + run_bottom_up(alloc_in_between_generic_check); 758 756 759 757 return 0; 760 758 } ··· 771 773 static int alloc_small_gaps_check(void) 772 774 { 773 775 test_print("\tRunning %s...\n", __func__); 774 - memblock_set_bottom_up(false); 775 - alloc_small_gaps_generic_check(); 776 - memblock_set_bottom_up(true); 777 - alloc_small_gaps_generic_check(); 776 + run_top_down(alloc_small_gaps_generic_check); 777 + run_bottom_up(alloc_small_gaps_generic_check); 778 778 779 779 return 0; 780 780 } ··· 780 784 static int alloc_all_reserved_check(void) 781 785 { 782 786 test_print("\tRunning %s...\n", __func__); 783 - memblock_set_bottom_up(false); 784 - alloc_all_reserved_generic_check(); 785 - memblock_set_bottom_up(true); 786 - alloc_all_reserved_generic_check(); 787 + run_top_down(alloc_all_reserved_generic_check); 788 + run_bottom_up(alloc_all_reserved_generic_check); 787 789 788 790 return 0; 789 791 } ··· 789 795 static int alloc_no_space_check(void) 790 796 { 791 797 test_print("\tRunning %s...\n", __func__); 792 - memblock_set_bottom_up(false); 793 - alloc_no_space_generic_check(); 794 - memblock_set_bottom_up(true); 795 - alloc_no_space_generic_check(); 798 + run_top_down(alloc_no_space_generic_check); 799 + run_bottom_up(alloc_no_space_generic_check); 796 800 797 801 return 0; 798 802 } ··· 798 806 static int alloc_limited_space_check(void) 799 807 { 800 808 test_print("\tRunning %s...\n", __func__); 801 - memblock_set_bottom_up(false); 802 - alloc_limited_space_generic_check(); 803 - memblock_set_bottom_up(true); 804 - alloc_limited_space_generic_check(); 809 + run_top_down(alloc_limited_space_generic_check); 810 + run_bottom_up(alloc_limited_space_generic_check); 805 811 806 812 return 0; 807 813 } ··· 807 817 static int alloc_no_memory_check(void) 808 818 { 809 819 test_print("\tRunning %s...\n", __func__); 810 - memblock_set_bottom_up(false); 811 - alloc_no_memory_generic_check(); 812 - memblock_set_bottom_up(true); 813 - alloc_no_memory_generic_check(); 820 + run_top_down(alloc_no_memory_generic_check); 821 + run_bottom_up(alloc_no_memory_generic_check); 814 822 815 823 return 0; 816 824 }
+4 -8
tools/testing/memblock/tests/alloc_helpers_api.c
··· 357 357 static int alloc_from_simple_check(void) 358 358 { 359 359 test_print("\tRunning %s...\n", __func__); 360 - memblock_set_bottom_up(false); 361 - alloc_from_simple_generic_check(); 362 - memblock_set_bottom_up(true); 363 - alloc_from_simple_generic_check(); 360 + run_top_down(alloc_from_simple_generic_check); 361 + run_bottom_up(alloc_from_simple_generic_check); 364 362 365 363 return 0; 366 364 } ··· 366 368 static int alloc_from_misaligned_check(void) 367 369 { 368 370 test_print("\tRunning %s...\n", __func__); 369 - memblock_set_bottom_up(false); 370 - alloc_from_misaligned_generic_check(); 371 - memblock_set_bottom_up(true); 372 - alloc_from_misaligned_generic_check(); 371 + run_top_down(alloc_from_misaligned_generic_check); 372 + run_bottom_up(alloc_from_misaligned_generic_check); 373 373 374 374 return 0; 375 375 }
+12 -24
tools/testing/memblock/tests/alloc_nid_api.c
··· 1142 1142 static int alloc_try_nid_min_reserved_check(void) 1143 1143 { 1144 1144 test_print("\tRunning %s...\n", __func__); 1145 - memblock_set_bottom_up(false); 1146 - alloc_try_nid_min_reserved_generic_check(); 1147 - memblock_set_bottom_up(true); 1148 - alloc_try_nid_min_reserved_generic_check(); 1145 + run_top_down(alloc_try_nid_min_reserved_generic_check); 1146 + run_bottom_up(alloc_try_nid_min_reserved_generic_check); 1149 1147 1150 1148 return 0; 1151 1149 } ··· 1151 1153 static int alloc_try_nid_max_reserved_check(void) 1152 1154 { 1153 1155 test_print("\tRunning %s...\n", __func__); 1154 - memblock_set_bottom_up(false); 1155 - alloc_try_nid_max_reserved_generic_check(); 1156 - memblock_set_bottom_up(true); 1157 - alloc_try_nid_max_reserved_generic_check(); 1156 + run_top_down(alloc_try_nid_max_reserved_generic_check); 1157 + run_bottom_up(alloc_try_nid_max_reserved_generic_check); 1158 1158 1159 1159 return 0; 1160 1160 } ··· 1160 1164 static int alloc_try_nid_exact_address_check(void) 1161 1165 { 1162 1166 test_print("\tRunning %s...\n", __func__); 1163 - memblock_set_bottom_up(false); 1164 - alloc_try_nid_exact_address_generic_check(); 1165 - memblock_set_bottom_up(true); 1166 - alloc_try_nid_exact_address_generic_check(); 1167 + run_top_down(alloc_try_nid_exact_address_generic_check); 1168 + run_bottom_up(alloc_try_nid_exact_address_generic_check); 1167 1169 1168 1170 return 0; 1169 1171 } ··· 1169 1175 static int alloc_try_nid_reserved_full_merge_check(void) 1170 1176 { 1171 1177 test_print("\tRunning %s...\n", __func__); 1172 - memblock_set_bottom_up(false); 1173 - alloc_try_nid_reserved_full_merge_generic_check(); 1174 - memblock_set_bottom_up(true); 1175 - alloc_try_nid_reserved_full_merge_generic_check(); 1178 + run_top_down(alloc_try_nid_reserved_full_merge_generic_check); 1179 + run_bottom_up(alloc_try_nid_reserved_full_merge_generic_check); 1176 1180 1177 1181 return 0; 1178 1182 } ··· 1178 1186 static int alloc_try_nid_reserved_all_check(void) 1179 1187 { 1180 1188 test_print("\tRunning %s...\n", __func__); 1181 - memblock_set_bottom_up(false); 1182 - alloc_try_nid_reserved_all_generic_check(); 1183 - memblock_set_bottom_up(true); 1184 - alloc_try_nid_reserved_all_generic_check(); 1189 + run_top_down(alloc_try_nid_reserved_all_generic_check); 1190 + run_bottom_up(alloc_try_nid_reserved_all_generic_check); 1185 1191 1186 1192 return 0; 1187 1193 } ··· 1187 1197 static int alloc_try_nid_low_max_check(void) 1188 1198 { 1189 1199 test_print("\tRunning %s...\n", __func__); 1190 - memblock_set_bottom_up(false); 1191 - alloc_try_nid_low_max_generic_check(); 1192 - memblock_set_bottom_up(true); 1193 - alloc_try_nid_low_max_generic_check(); 1200 + run_top_down(alloc_try_nid_low_max_generic_check); 1201 + run_bottom_up(alloc_try_nid_low_max_generic_check); 1194 1202 1195 1203 return 0; 1196 1204 }
+16
tools/testing/memblock/tests/common.h
··· 100 100 prefix_pop(); 101 101 } 102 102 103 + static inline void run_top_down(int (*func)()) 104 + { 105 + memblock_set_bottom_up(false); 106 + prefix_push("top-down"); 107 + func(); 108 + prefix_pop(); 109 + } 110 + 111 + static inline void run_bottom_up(int (*func)()) 112 + { 113 + memblock_set_bottom_up(true); 114 + prefix_push("bottom-up"); 115 + func(); 116 + prefix_pop(); 117 + } 118 + 103 119 #endif