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.

tools/testing/vma: clean up stubs in vma_internal.h

We do not need to references arguments just to avoid compiler warnings,
the warning in question does not arise here, so remove all of the
instances of '(void)xxx' introduced purely to avoid this warning.

As reported by WagYuli in the referenced mail, GCC 8.3 and before will
have issues compiling this file if parameter names are not provided, so
ensure these are always provided.

Finally, perform a trivial fix up of kmem_cache_alloc() which technically
has parameters in the incorrect order (as reported by Vlastimil Babka
off-list).

Link: https://lkml.kernel.org/r/20250826102824.22730-1-lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reported-by: WangYuli <wangyuli@uniontech.com>
Closes: https://lore.kernel.org/linux-mm/EFCEBE7E301589DE+20250729084700.208767-1-wangyuli@uniontech.com/
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: WangYuli <wangyuli@uniontech.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

authored by

Lorenzo Stoakes and committed by
Vlastimil Babka
da577f1f a8541957

+57 -110
+57 -110
tools/testing/vma/vma_internal.h
··· 676 676 677 677 static inline void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags) 678 678 { 679 - (void)gfpflags; 680 - 681 - return calloc(s->object_size, 1); 679 + return calloc(1, s->object_size); 682 680 } 683 681 684 682 static inline void kmem_cache_free(struct kmem_cache *s, void *x) ··· 840 842 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 841 843 } 842 844 843 - static inline void fput(struct file *) 845 + static inline void fput(struct file *file) 844 846 { 845 847 } 846 848 847 - static inline void mpol_put(struct mempolicy *) 849 + static inline void mpol_put(struct mempolicy *pol) 848 850 { 849 851 } 850 852 ··· 852 854 { 853 855 } 854 856 855 - static inline void tlb_gather_mmu(struct mmu_gather *, struct mm_struct *) 857 + static inline void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm) 856 858 { 857 859 } 858 860 859 - static inline void update_hiwater_rss(struct mm_struct *) 861 + static inline void update_hiwater_rss(struct mm_struct *mm) 860 862 { 861 863 } 862 864 863 - static inline void update_hiwater_vm(struct mm_struct *) 865 + static inline void update_hiwater_vm(struct mm_struct *mm) 864 866 { 865 867 } 866 868 ··· 869 871 unsigned long end_addr, unsigned long tree_end, 870 872 bool mm_wr_locked) 871 873 { 872 - (void)tlb; 873 - (void)mas; 874 - (void)vma; 875 - (void)start_addr; 876 - (void)end_addr; 877 - (void)tree_end; 878 - (void)mm_wr_locked; 879 874 } 880 875 881 876 static inline void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas, 882 877 struct vm_area_struct *vma, unsigned long floor, 883 878 unsigned long ceiling, bool mm_wr_locked) 884 879 { 885 - (void)tlb; 886 - (void)mas; 887 - (void)vma; 888 - (void)floor; 889 - (void)ceiling; 890 - (void)mm_wr_locked; 891 880 } 892 881 893 - static inline void mapping_unmap_writable(struct address_space *) 882 + static inline void mapping_unmap_writable(struct address_space *mapping) 894 883 { 895 884 } 896 885 897 - static inline void flush_dcache_mmap_lock(struct address_space *) 886 + static inline void flush_dcache_mmap_lock(struct address_space *mapping) 898 887 { 899 888 } 900 889 901 - static inline void tlb_finish_mmu(struct mmu_gather *) 890 + static inline void tlb_finish_mmu(struct mmu_gather *tlb) 902 891 { 903 892 } 904 893 ··· 894 909 return f; 895 910 } 896 911 897 - static inline int vma_dup_policy(struct vm_area_struct *, struct vm_area_struct *) 912 + static inline int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst) 898 913 { 899 914 return 0; 900 915 } ··· 921 936 unsigned long end, 922 937 struct vm_area_struct *next) 923 938 { 924 - (void)vma; 925 - (void)start; 926 - (void)end; 927 - (void)next; 928 939 } 929 940 930 941 static inline void hugetlb_split(struct vm_area_struct *, unsigned long) {} ··· 940 959 { 941 960 } 942 961 943 - static inline void vma_interval_tree_insert(struct vm_area_struct *, 944 - struct rb_root_cached *) 962 + static inline void vma_interval_tree_insert(struct vm_area_struct *vma, 963 + struct rb_root_cached *rb) 945 964 { 946 965 } 947 966 948 - static inline void vma_interval_tree_remove(struct vm_area_struct *, 949 - struct rb_root_cached *) 967 + static inline void vma_interval_tree_remove(struct vm_area_struct *vma, 968 + struct rb_root_cached *rb) 950 969 { 951 970 } 952 971 953 - static inline void flush_dcache_mmap_unlock(struct address_space *) 972 + static inline void flush_dcache_mmap_unlock(struct address_space *mapping) 954 973 { 955 974 } 956 975 957 - static inline void anon_vma_interval_tree_insert(struct anon_vma_chain*, 958 - struct rb_root_cached *) 976 + static inline void anon_vma_interval_tree_insert(struct anon_vma_chain *avc, 977 + struct rb_root_cached *rb) 959 978 { 960 979 } 961 980 962 - static inline void anon_vma_interval_tree_remove(struct anon_vma_chain*, 963 - struct rb_root_cached *) 981 + static inline void anon_vma_interval_tree_remove(struct anon_vma_chain *avc, 982 + struct rb_root_cached *rb) 964 983 { 965 984 } 966 985 967 - static inline void uprobe_mmap(struct vm_area_struct *) 986 + static inline void uprobe_mmap(struct vm_area_struct *vma) 968 987 { 969 988 } 970 989 971 990 static inline void uprobe_munmap(struct vm_area_struct *vma, 972 991 unsigned long start, unsigned long end) 973 992 { 974 - (void)vma; 975 - (void)start; 976 - (void)end; 977 993 } 978 994 979 - static inline void i_mmap_lock_write(struct address_space *) 995 + static inline void i_mmap_lock_write(struct address_space *mapping) 980 996 { 981 997 } 982 998 983 - static inline void anon_vma_lock_write(struct anon_vma *) 999 + static inline void anon_vma_lock_write(struct anon_vma *anon_vma) 984 1000 { 985 1001 } 986 1002 987 - static inline void vma_assert_write_locked(struct vm_area_struct *) 1003 + static inline void vma_assert_write_locked(struct vm_area_struct *vma) 988 1004 { 989 1005 } 990 1006 ··· 991 1013 vma->anon_vma->was_unlinked = true; 992 1014 } 993 1015 994 - static inline void anon_vma_unlock_write(struct anon_vma *) 1016 + static inline void anon_vma_unlock_write(struct anon_vma *anon_vma) 995 1017 { 996 1018 } 997 1019 998 - static inline void i_mmap_unlock_write(struct address_space *) 1020 + static inline void i_mmap_unlock_write(struct address_space *mapping) 999 1021 { 1000 1022 } 1001 1023 1002 - static inline void anon_vma_merge(struct vm_area_struct *, 1003 - struct vm_area_struct *) 1024 + static inline void anon_vma_merge(struct vm_area_struct *vma, 1025 + struct vm_area_struct *next) 1004 1026 { 1005 1027 } 1006 1028 ··· 1009 1031 unsigned long end, 1010 1032 struct list_head *unmaps) 1011 1033 { 1012 - (void)vma; 1013 - (void)start; 1014 - (void)end; 1015 - (void)unmaps; 1016 - 1017 1034 return 0; 1018 1035 } 1019 1036 1020 - static inline void mmap_write_downgrade(struct mm_struct *) 1037 + static inline void mmap_write_downgrade(struct mm_struct *mm) 1021 1038 { 1022 1039 } 1023 1040 1024 - static inline void mmap_read_unlock(struct mm_struct *) 1041 + static inline void mmap_read_unlock(struct mm_struct *mm) 1025 1042 { 1026 1043 } 1027 1044 1028 - static inline void mmap_write_unlock(struct mm_struct *) 1045 + static inline void mmap_write_unlock(struct mm_struct *mm) 1029 1046 { 1030 1047 } 1031 1048 1032 - static inline int mmap_write_lock_killable(struct mm_struct *) 1049 + static inline int mmap_write_lock_killable(struct mm_struct *mm) 1033 1050 { 1034 1051 return 0; 1035 1052 } ··· 1033 1060 unsigned long start, 1034 1061 unsigned long end) 1035 1062 { 1036 - (void)mm; 1037 - (void)start; 1038 - (void)end; 1039 - 1040 1063 return true; 1041 1064 } 1042 1065 ··· 1040 1071 unsigned long start, 1041 1072 unsigned long end) 1042 1073 { 1043 - (void)mm; 1044 - (void)start; 1045 - (void)end; 1046 1074 } 1047 1075 1048 - static inline void mmap_assert_locked(struct mm_struct *) 1076 + static inline void mmap_assert_locked(struct mm_struct *mm) 1049 1077 { 1050 1078 } 1051 1079 1052 - static inline bool mpol_equal(struct mempolicy *, struct mempolicy *) 1080 + static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) 1053 1081 { 1054 1082 return true; 1055 1083 } ··· 1054 1088 static inline void khugepaged_enter_vma(struct vm_area_struct *vma, 1055 1089 vm_flags_t vm_flags) 1056 1090 { 1057 - (void)vma; 1058 - (void)vm_flags; 1059 1091 } 1060 1092 1061 - static inline bool mapping_can_writeback(struct address_space *) 1093 + static inline bool mapping_can_writeback(struct address_space *mapping) 1062 1094 { 1063 1095 return true; 1064 1096 } 1065 1097 1066 - static inline bool is_vm_hugetlb_page(struct vm_area_struct *) 1098 + static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma) 1067 1099 { 1068 1100 return false; 1069 1101 } 1070 1102 1071 - static inline bool vma_soft_dirty_enabled(struct vm_area_struct *) 1103 + static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma) 1072 1104 { 1073 1105 return false; 1074 1106 } 1075 1107 1076 - static inline bool userfaultfd_wp(struct vm_area_struct *) 1108 + static inline bool userfaultfd_wp(struct vm_area_struct *vma) 1077 1109 { 1078 1110 return false; 1079 1111 } 1080 1112 1081 - static inline void mmap_assert_write_locked(struct mm_struct *) 1113 + static inline void mmap_assert_write_locked(struct mm_struct *mm) 1082 1114 { 1083 1115 } 1084 1116 1085 - static inline void mutex_lock(struct mutex *) 1117 + static inline void mutex_lock(struct mutex *lock) 1086 1118 { 1087 1119 } 1088 1120 1089 - static inline void mutex_unlock(struct mutex *) 1121 + static inline void mutex_unlock(struct mutex *lock) 1090 1122 { 1091 1123 } 1092 1124 1093 - static inline bool mutex_is_locked(struct mutex *) 1125 + static inline bool mutex_is_locked(struct mutex *lock) 1094 1126 { 1095 1127 return true; 1096 1128 } 1097 1129 1098 - static inline bool signal_pending(void *) 1130 + static inline bool signal_pending(void *p) 1099 1131 { 1100 1132 return false; 1101 1133 } 1102 1134 1103 - static inline bool is_file_hugepages(struct file *) 1135 + static inline bool is_file_hugepages(struct file *file) 1104 1136 { 1105 1137 return false; 1106 1138 } 1107 1139 1108 - static inline int security_vm_enough_memory_mm(struct mm_struct *, long) 1140 + static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) 1109 1141 { 1110 1142 return 0; 1111 1143 } 1112 1144 1113 - static inline bool may_expand_vm(struct mm_struct *, vm_flags_t, unsigned long) 1145 + static inline bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, 1146 + unsigned long npages) 1114 1147 { 1115 1148 return true; 1116 1149 } ··· 1134 1169 vma->__vm_flags &= ~flags; 1135 1170 } 1136 1171 1137 - static inline int shmem_zero_setup(struct vm_area_struct *) 1172 + static inline int shmem_zero_setup(struct vm_area_struct *vma) 1138 1173 { 1139 1174 return 0; 1140 1175 } ··· 1144 1179 vma->vm_ops = NULL; 1145 1180 } 1146 1181 1147 - static inline void ksm_add_vma(struct vm_area_struct *) 1182 + static inline void ksm_add_vma(struct vm_area_struct *vma) 1148 1183 { 1149 1184 } 1150 1185 1151 - static inline void perf_event_mmap(struct vm_area_struct *) 1186 + static inline void perf_event_mmap(struct vm_area_struct *vma) 1152 1187 { 1153 1188 } 1154 1189 1155 - static inline bool vma_is_dax(struct vm_area_struct *) 1190 + static inline bool vma_is_dax(struct vm_area_struct *vma) 1156 1191 { 1157 1192 return false; 1158 1193 } 1159 1194 1160 - static inline struct vm_area_struct *get_gate_vma(struct mm_struct *) 1195 + static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm) 1161 1196 { 1162 1197 return NULL; 1163 1198 } ··· 1182 1217 WRITE_ONCE(vma->vm_page_prot, vm_page_prot); 1183 1218 } 1184 1219 1185 - static inline bool arch_validate_flags(vm_flags_t) 1220 + static inline bool arch_validate_flags(vm_flags_t flags) 1186 1221 { 1187 1222 return true; 1188 1223 } 1189 1224 1190 - static inline void vma_close(struct vm_area_struct *) 1225 + static inline void vma_close(struct vm_area_struct *vma) 1191 1226 { 1192 1227 } 1193 1228 1194 - static inline int mmap_file(struct file *, struct vm_area_struct *) 1229 + static inline int mmap_file(struct file *file, struct vm_area_struct *vma) 1195 1230 { 1196 1231 return 0; 1197 1232 } ··· 1353 1388 1354 1389 static inline unsigned long move_page_tables(struct pagetable_move_control *pmc) 1355 1390 { 1356 - (void)pmc; 1357 - 1358 1391 return 0; 1359 1392 } 1360 1393 ··· 1360 1397 unsigned long addr, unsigned long end, 1361 1398 unsigned long floor, unsigned long ceiling) 1362 1399 { 1363 - (void)tlb; 1364 - (void)addr; 1365 - (void)end; 1366 - (void)floor; 1367 - (void)ceiling; 1368 1400 } 1369 1401 1370 1402 static inline int ksm_execve(struct mm_struct *mm) 1371 1403 { 1372 - (void)mm; 1373 - 1374 1404 return 0; 1375 1405 } 1376 1406 1377 1407 static inline void ksm_exit(struct mm_struct *mm) 1378 1408 { 1379 - (void)mm; 1380 1409 } 1381 1410 1382 1411 static inline void vma_lock_init(struct vm_area_struct *vma, bool reset_refcnt) 1383 1412 { 1384 - (void)vma; 1385 - (void)reset_refcnt; 1386 1413 } 1387 1414 1388 1415 static inline void vma_numab_state_init(struct vm_area_struct *vma) 1389 1416 { 1390 - (void)vma; 1391 1417 } 1392 1418 1393 1419 static inline void vma_numab_state_free(struct vm_area_struct *vma) 1394 1420 { 1395 - (void)vma; 1396 1421 } 1397 1422 1398 1423 static inline void dup_anon_vma_name(struct vm_area_struct *orig_vma, 1399 1424 struct vm_area_struct *new_vma) 1400 1425 { 1401 - (void)orig_vma; 1402 - (void)new_vma; 1403 1426 } 1404 1427 1405 1428 static inline void free_anon_vma_name(struct vm_area_struct *vma) 1406 1429 { 1407 - (void)vma; 1408 1430 } 1409 1431 1410 1432 /* Declared in vma.h. */ ··· 1443 1495 1444 1496 static inline void fixup_hugetlb_reservations(struct vm_area_struct *vma) 1445 1497 { 1446 - (void)vma; 1447 1498 } 1448 1499 1449 1500 static inline void vma_set_file(struct vm_area_struct *vma, struct file *file) ··· 1453 1506 fput(file); 1454 1507 } 1455 1508 1456 - static inline bool shmem_file(struct file *) 1509 + static inline bool shmem_file(struct file *file) 1457 1510 { 1458 1511 return false; 1459 1512 } 1460 1513 1461 - static inline vm_flags_t ksm_vma_flags(const struct mm_struct *, const struct file *, 1462 - vm_flags_t vm_flags) 1514 + static inline vm_flags_t ksm_vma_flags(const struct mm_struct *mm, 1515 + const struct file *file, vm_flags_t vm_flags) 1463 1516 { 1464 1517 return vm_flags; 1465 1518 }